sunchao commented on a change in pull request #29066:
URL: https://github.com/apache/spark/pull/29066#discussion_r533745275



##########
File path: 
sql/catalyst/src/main/java/org/apache/spark/sql/connector/expressions/SortOrder.java
##########
@@ -0,0 +1,27 @@
+/*
+ * 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.connector.expressions;
+
+import org.apache.spark.annotation.Experimental;
+
+@Experimental

Review comment:
       nit: should we add `@since 3.1.0` following other existing expressions?

##########
File path: 
sql/catalyst/src/main/java/org/apache/spark/sql/connector/distributions/ClusteredDistribution.java
##########
@@ -0,0 +1,30 @@
+/*
+ * 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.connector.distributions;
+
+import org.apache.spark.annotation.Experimental;
+import org.apache.spark.sql.connector.expressions.Expression;
+
+/**
+ * A distribution where tuples that share the same values for clustering 
expressions are co-located
+ * in the same partition.
+ */
+@Experimental
+public interface ClusteredDistribution extends Distribution {
+  Expression[] clustering();

Review comment:
       Since this is a public interface, do you think we should add some 
documents for the method?

##########
File path: 
sql/catalyst/src/main/java/org/apache/spark/sql/connector/write/WriteBuilder.java
##########
@@ -23,17 +23,34 @@
 import org.apache.spark.sql.connector.write.streaming.StreamingWrite;
 
 /**
- * An interface for building the {@link BatchWrite}. Implementations can mix 
in some interfaces to
+ * An interface for building the {@link Write}. Implementations can mix in 
some interfaces to
  * support different ways to write data to data sources.
  *
- * Unless modified by a mixin interface, the {@link BatchWrite} configured by 
this builder is to
+ * Unless modified by a mixin interface, the {@link Write} configured by this 
builder is to
  * append data without affecting existing data.
  *
  * @since 3.0.0
  */
 @Evolving
 public interface WriteBuilder {
 
+  /**
+   * Returns a logical {@link Write} shared between batch and streaming.
+   */
+  default Write build() {

Review comment:
       Have you considered to change the default impl for `buildForBatch` to:
   ```scala
     default BatchWrite buildForBatch() {
       build().toBatch()
     }
   ```
   
   and also the `build()` to just return a simple anonymous `new Write() {}`? 
   
   Otherwise, I can see that we'll have the `buildForBatch` (and similarly 
`buildForStreaming`) logic in two different places: `WriteBuilder` and `Write`. 
It is easy to miss one or another.

##########
File path: 
sql/core/src/main/java/org/apache/spark/sql/connector/write/V1Write.java
##########
@@ -0,0 +1,26 @@
+/*
+ * 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.connector.write;
+
+import org.apache.spark.annotation.Unstable;
+import org.apache.spark.sql.sources.InsertableRelation;
+
+@Unstable
+public interface V1Write extends Write {

Review comment:
       Similar to the `Write` interface, perhaps we should mention that data 
sources must implement this if it returns `V1_BATCH_WRITE` capability? 
   
   and also the `@since` tag.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to