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 2022/09/11 23:11:02 UTC

[GitHub] [pinot] xiangfu0 commented on a diff in pull request #9377: Add support for gracefully handling the errors while transformations

xiangfu0 commented on code in PR #9377:
URL: https://github.com/apache/pinot/pull/9377#discussion_r967902186


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/recordtransformer/ComplexTypeTransformer.java:
##########
@@ -163,11 +172,20 @@ private static Map<String, String> parsePrefixesToRename(TableConfig tableConfig
 
   @Override
   public GenericRow transform(GenericRow record) {
-    flattenMap(record, new ArrayList<>(record.getFieldToValueMap().keySet()));
-    for (String collection : _fieldsToUnnest) {
-      unnestCollection(record, collection);
+    try {

Review Comment:
   cc: @Jackie-Jiang I remember you mentioned that try-catch will impact the performance? shall do if-else check first?
   
   Codewise I think this is simpler.
   ```
   if (_continueOnError) {
       flattenMap(record, new ArrayList<>(record.getFieldToValueMap().keySet()));
       for (String collection : _fieldsToUnnest) {
         unnestCollection(record, collection);
       }
   } else {
     try {
       flattenMap(record, new ArrayList<>(record.getFieldToValueMap().keySet()));
       for (String collection : _fieldsToUnnest) {
         unnestCollection(record, collection);
       }
     } catch (Exception e) {
          record.putValue(GenericRow.INCOMPLETE_RECORD_KEY, true);
          LOGGER.debug("Caught exception while transforming complex types for record: {}", record.toString(), e);
     }
   }
   ```
   
   Or this try-catch?
   



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

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

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