This is an automated email from the ASF dual-hosted git repository.

siddteotia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new b1bf79ca9a Add more information when JSON flattening throws exception 
(#10236)
b1bf79ca9a is described below

commit b1bf79ca9a56c678926f03c334b822274cebeddf
Author: Xiaotian (Jackie) Jiang <[email protected]>
AuthorDate: Tue Feb 7 11:08:05 2023 -0800

    Add more information when JSON flattening throws exception (#10236)
---
 .../src/main/java/org/apache/pinot/spi/utils/JsonUtils.java   | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/pinot-spi/src/main/java/org/apache/pinot/spi/utils/JsonUtils.java 
b/pinot-spi/src/main/java/org/apache/pinot/spi/utils/JsonUtils.java
index 3bf8a7f989..a6dbd0883e 100644
--- a/pinot-spi/src/main/java/org/apache/pinot/spi/utils/JsonUtils.java
+++ b/pinot-spi/src/main/java/org/apache/pinot/spi/utils/JsonUtils.java
@@ -351,7 +351,16 @@ public class JsonUtils {
    * </pre>
    */
   public static List<Map<String, String>> flatten(JsonNode node, 
JsonIndexConfig jsonIndexConfig) {
-    return flatten(node, jsonIndexConfig, 0, "$", false);
+    try {
+      return flatten(node, jsonIndexConfig, 0, "$", false);
+    } catch (OutOfMemoryError oom) {
+      throw new OutOfMemoryError(
+          String.format("Flattening JSON node: %s with config: %s requires too 
much memory, please adjust the config",
+              node, jsonIndexConfig));
+    } catch (Exception e) {
+      throw new IllegalArgumentException(
+          String.format("Caught exception while flattening JSON node: %s with 
config: %s", node, jsonIndexConfig), e);
+    }
   }
 
   private static List<Map<String, String>> flatten(JsonNode node, 
JsonIndexConfig jsonIndexConfig, int level,


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

Reply via email to