You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2020/11/04 16:32:29 UTC

[GitHub] [iceberg] jun-he commented on a change in pull request #1675: API: Extend partitioning and sort order

jun-he commented on a change in pull request #1675:
URL: https://github.com/apache/iceberg/pull/1675#discussion_r517474179



##########
File path: api/src/main/java/org/apache/iceberg/transforms/PartitionSpecVisitor.java
##########
@@ -26,20 +26,94 @@
 import org.apache.iceberg.relocated.com.google.common.collect.Lists;
 
 public interface PartitionSpecVisitor<T> {
-  T identity(String sourceName, int sourceId);
+  default T identity(int fieldId, String sourceName, int sourceId) {
+    return identity(sourceName, sourceId);
+  }
+
+  default T identity(String sourceName, int sourceId) {
+    throw new UnsupportedOperationException("Identity transform is not supported");
+  }
+
+  default T bucket(int fieldId, String sourceName, int sourceId, int width) {
+    return bucket(sourceName, sourceId, width);
+  }
+
+  default T bucket(String sourceName, int sourceId, int width) {
+    throw new UnsupportedOperationException("Bucket transform is not supported");
+  }
 
-  T bucket(String sourceName, int sourceId, int width);
+  default T truncate(int fieldId, String sourceName, int sourceId, int width) {
+    return truncate(sourceName, sourceId, width);
+  }
 
-  T truncate(String sourceName, int sourceId, int width);
+  default T truncate(String sourceName, int sourceId, int width) {
+    throw new UnsupportedOperationException("Truncate transform is not supported");
+  }
 
-  T year(String sourceName, int sourceId);
+  default T year(int fieldId, String sourceName, int sourceId) {
+    return year(sourceName, sourceId);
+  }
 
-  T month(String sourceName, int sourceId);
+  default T year(String sourceName, int sourceId) {
+    throw new UnsupportedOperationException("Year transform is not supported");
+  }
 
-  T day(String sourceName, int sourceId);
+  default T month(int fieldId, String sourceName, int sourceId) {
+    return month(sourceName, sourceId);
+  }
+
+  default T month(String sourceName, int sourceId) {
+    throw new UnsupportedOperationException("Month transform is not supported");
+  }
 
-  T hour(String sourceName, int sourceId);
+  default T day(int fieldId, String sourceName, int sourceId) {
+    return day(sourceName, sourceId);
+  }
+
+  default T day(String sourceName, int sourceId) {
+    throw new UnsupportedOperationException("Day transform is not supported");
+  }
+
+  default T hour(int fieldId, String sourceName, int sourceId) {
+    return hour(sourceName, sourceId);
+  }
+
+  default T hour(String sourceName, int sourceId) {
+    throw new UnsupportedOperationException("Hour transform is not supported");
+  }
+
+  default T alwaysNull(int fieldId, String sourceName, int sourceId) {

Review comment:
       nit: should we add `default T alwaysNull(String sourceName, int sourceId)` as well?




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org