Github user arunmahadevan commented on a diff in the pull request:
https://github.com/apache/spark/pull/21721#discussion_r206241038
--- Diff:
sql/core/src/main/java/org/apache/spark/sql/sources/v2/writer/streaming/SupportsCustomWriterMetrics.java
---
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.spark.sql.sources.v2.writer.streaming;
+
+import org.apache.spark.annotation.InterfaceStability;
+import org.apache.spark.sql.sources.v2.CustomMetrics;
+import org.apache.spark.sql.sources.v2.writer.DataSourceWriter;
+
+/**
+ * A mix in interface for {@link DataSourceWriter}. Data source writers
can implement this
--- End diff --
The intention was to restrict the mixin so that it can be applied only to
`DataSourceReader` and `DataSourceWriter` (similar pattern followed in other
mixins) by inheriting the appropriate types. Unfortunately theres no common
ancestor for the mixin to inherit from so I had to duplicate the interface.
Agree that its not ideal.
A few options:
1. Have a common ancestor marker interface (say `DataSourceComponent`)
which is the super type of `DataSourceReader` and `DataSourceWriter`. Then we
can have a single mixin that is a subtype of that interface. We may encounter
similar usages for other mixins in future.
2. The mixin does not inherit anything (neither DataSourceReader nor
DataSourceWriter). Here we cannot impose a restriction on the type of classes
the mixin can be applied to.
3. Duplicate interfaces (the proposed option in the patch).
I prefer option 1, but would like to proceed based on the feedback.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]