somandal commented on code in PR #16094:
URL: https://github.com/apache/pinot/pull/16094#discussion_r2192982162


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/creator/impl/inv/json/BaseJsonIndexCreator.java:
##########
@@ -94,6 +101,27 @@ public void add(String jsonString)
     addFlattenedRecords(JsonUtils.flatten(jsonString, _jsonIndexConfig));
   }
 
+  @Override
+  public void add(Object value)
+      throws IOException {
+    String valueToAdd;
+    try {
+      valueToAdd = JsonUtils.objectToString(value);
+    } catch (JsonProcessingException e) {
+      if (_jsonIndexConfig.getSkipInvalidJson()) {
+        // Caught exception while trying to add, update metric and add a 
default SKIPPED_FLATTENED_RECORD
+        String metricKeyName =
+            _tableNameWithType + "-" + 
JsonIndexType.INDEX_DISPLAY_NAME.toUpperCase(Locale.US) + "-indexingError";
+        ServerMetrics.get().addMeteredTableValue(metricKeyName, 
ServerMeter.INDEXING_FAILURES, 1);
+        addFlattenedRecords(JsonUtils.SKIPPED_FLATTENED_RECORD);
+        return;

Review Comment:
   perhaps we can tackle this as a future change, as this concept of 
`SKIPPED_FLATTENED_RECORD` is not newly introduced in this PR. does that work 
@gortiz ?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to