mcvsubbu commented on a change in pull request #4954: Support schema evolution 
for consuming segments
URL: https://github.com/apache/incubator-pinot/pull/4954#discussion_r384857792
 
 

 ##########
 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:
   Should we be using PluginClassLoader here?

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


With regards,
Apache Git Services

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

Reply via email to