You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2021/05/19 21:08:33 UTC

[GitHub] [incubator-pinot] Jackie-Jiang commented on a change in pull request #6945: Add the complex-type support to

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



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