Jackie-Jiang commented on a change in pull request #6945:
URL: https://github.com/apache/incubator-pinot/pull/6945#discussion_r635585801



##########
File path: 
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/recordtransformer/ComplexTypeTransformer.java
##########
@@ -145,6 +149,21 @@ public static ComplexTypeTransformer 
getComplexTypeTransformer(TableConfig table
     }
   }
 
+  public static Set<String> getFieldsToReadWithComplexType(Set<String> 
fieldsToRead, IngestionConfig ingestionConfig) {

Review comment:
       Suggest moving this method to `IngestionUtils`. Also add some javadoc

##########
File path: 
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/recordtransformer/ComplexTypeTransformer.java
##########
@@ -145,6 +149,21 @@ public static ComplexTypeTransformer 
getComplexTypeTransformer(TableConfig table
     }
   }
 
+  public static Set<String> getFieldsToReadWithComplexType(Set<String> 
fieldsToRead, IngestionConfig ingestionConfig) {
+    if (ingestionConfig == null || ingestionConfig.getComplexTypeConfig() == 
null) {
+      // do nothing
+      return fieldsToRead;
+    }
+    ComplexTypeConfig complexTypeConfig = 
ingestionConfig.getComplexTypeConfig();
+    Set<String> result = new HashSet<>();
+    String delimiter = complexTypeConfig.getDelimiter() == null ? 
DEFAULT_DELIMITER : complexTypeConfig.getDelimiter();
+    for (String field : fieldsToRead) {
+      // need to quote because split takes regex as arg
+      result.add(field.split(Pattern.quote(delimiter))[0]);

Review comment:
       Use `org.apache.commons.lang3.StringUtils.split()` which does not do 
regex matching




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



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

Reply via email to