pinot-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-pinot] haibow commented on a change in pull request #4954: Support schema evolution for consuming segments
Date Fri, 28 Feb 2020 08:02:08 GMT
haibow commented on a change in pull request #4954: Support schema evolution for consuming
segments
URL: https://github.com/apache/incubator-pinot/pull/4954#discussion_r385554338
 
 

 ##########
 File path: pinot-core/src/main/java/org/apache/pinot/core/segment/virtualcolumn/ColumnProviderFactory.java
 ##########
 @@ -20,18 +20,29 @@
 
 import org.apache.pinot.common.utils.CommonConstants.Segment.BuiltInVirtualColumn;
 import org.apache.pinot.common.utils.NetUtil;
+import org.apache.pinot.core.segment.index.column.ColumnContext;
+import org.apache.pinot.core.segment.index.column.ColumnProvider;
+import org.apache.pinot.core.segment.index.column.DefaultNullValueColumnProvider;
 import org.apache.pinot.spi.data.DimensionFieldSpec;
 import org.apache.pinot.spi.data.FieldSpec;
 import org.apache.pinot.spi.data.Schema;
 
 
 /**
- * Factory for virtual column providers.
+ * Factory for column providers.
  */
-public class VirtualColumnProviderFactory {
-  public static VirtualColumnProvider buildProvider(String virtualColumnProvider) {
+public class ColumnProviderFactory {
+  public static ColumnProvider buildProvider(ColumnContext columnContext) {
+    String virtualColumnProvider = columnContext.getFieldSpec().getVirtualColumnProvider();
     try {
-      return (VirtualColumnProvider) Class.forName(virtualColumnProvider).newInstance();
+      // Use the preset virtualColumnProvider if available
+      if (virtualColumnProvider != null && !virtualColumnProvider
+          .equals(DefaultNullValueColumnProvider.class.getName())) {
+        return (ColumnProvider) Class.forName(virtualColumnProvider).newInstance();
+      }
+      // Create the columnProvider that returns default null values based on the columnContext
+      return DefaultNullValueColumnProvider.class.getDeclaredConstructor(ColumnContext.class)
+          .newInstance(columnContext);
 
 Review comment:
   Didn't know this. updated

----------------------------------------------------------------
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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Mime
View raw message