im facing error `Caught exception while flattening...
# troubleshooting
i
im facing error
Caught exception while flattening JSON node
when streaming data from kafka on a realtime table with
skipInvalidJson
true, anybody familiar with this ? in the thread i put some of the log
Copy code
at org.apache.pinot.spi.utils.JsonUtils.flatten(JsonUtils.java:376) ~[pinot-all-1.2.0-jar-with-dependencies.jar:1.2.0-cc33ac502a02e2fe830fe21e556234ee99351a7a]
	at org.apache.pinot.spi.utils.JsonUtils.flatten(JsonUtils.java:747) ~[pinot-all-1.2.0-jar-with-dependencies.jar:1.2.0-cc33ac502a02e2fe830fe21e556234ee99351a7a]
	at org.apache.pinot.segment.local.realtime.impl.json.MutableJsonIndexImpl.add(MutableJsonIndexImpl.java:91) ~[pinot-all-1.2.0-jar-with-dependencies.jar:1.2.0-cc33ac502a02e2fe830fe21e556234ee99351a7a]
	at org.apache.pinot.segment.spi.index.mutable.MutableJsonIndex.add(MutableJsonIndex.java:32) ~[pinot-all-1.2.0-jar-with-dependencies.jar:1.2.0-cc33ac502a02e2fe830fe21e556234ee99351a7a]
	at org.apache.pinot.segment.local.indexsegment.mutable.MutableSegmentImpl.addNewRow(MutableSegmentImpl.java:707) [pinot-all-1.2.0-jar-with-dependencies.jar:1.2.0-cc33ac502a02e2fe830fe21e556234ee99351a7a]
	at org.apache.pinot.segment.local.indexsegment.mutable.MutableSegmentImpl.index(MutableSegmentImpl.java:533) [pinot-all-1.2.0-jar-with-dependencies.jar:1.2.0-cc33ac502a02e2fe830fe21e556234ee99351a7a]
	at org.apache.pinot.core.data.manager.realtime.RealtimeSegmentDataManager.processStreamEvents(RealtimeSegmentDataManager.java:638) [pinot-all-1.2.0-jar-with-dependencies.jar:1.2.0-cc33ac502a02e2fe830fe21e556234ee99351a7a]
	at org.apache.pinot.core.data.manager.realtime.RealtimeSegmentDataManager.consumeLoop(RealtimeSegmentDataManager.java:474) [pinot-all-1.2.0-jar-with-dependencies.jar:1.2.0-cc33ac502a02e2fe830fe21e556234ee99351a7a]
	at org.apache.pinot.core.data.manager.realtime.RealtimeSegmentDataManager$PartitionConsumer.run(RealtimeSegmentDataManager.java:727) [pinot-all-1.2.0-jar-with-dependencies.jar:1.2.0-cc33ac502a02e2fe830fe21e556234ee99351a7a]
	at java.base/java.lang.Thread.run(Thread.java:840) [?:?]
Caused by: java.lang.IllegalStateException: Got too many combinations
	at org.apache.pinot.shaded.com.google.common.base.Preconditions.checkState(Preconditions.java:515) ~[pinot-all-1.2.0-jar-with-dependencies.jar:1.2.0-cc33ac502a02e2fe830fe21e556234ee99351a7a]
	at org.apache.pinot.spi.utils.JsonUtils.flatten(JsonUtils.java:532) ~[pinot-all-1.2.0-jar-with-dependencies.jar:1.2.0-cc33ac502a02e2fe830fe21e556234ee99351a7a]
	at org.apache.pinot.spi.utils.JsonUtils.flatten(JsonUtils.java:466) ~[pinot-all-1.2.0-jar-with-dependencies.jar:1.2.0-cc33ac502a02e2fe830fe21e556234ee99351a7a]
	at org.apache.pinot.spi.utils.JsonUtils.flatten(JsonUtils.java:369) ~[pinot-all-1.2.0-jar-with-dependencies.jar:1.2.0-cc33ac502a02e2fe830fe21e556234ee99351a7a]
	... 9 more
2025/02/18 10:33:47.120 ERROR [RealtimeSegmentDataManager_master_product_log__0__1__20250218T1029Z] [master_product_log__0__1__20250218T1029Z] Could not build segment
java.lang.IllegalArgumentException: Caught exception while flattening JSON node: {"fields":{"medias":[{"mediaContentType":{"new":"IMAGE"},"variantId":{"new":["gid://shopify/ProductVariant/44958643093800"]},"originalSource":{"new":"https://cdn.shopify.com/s/files/1/0571/0384/3527/products/HF807213-ANTR_09d8c420-8203-473e-a996-5989643d3696.jpg?v=1649689679"}},{"mediaContentType":{"new":"IMAGE"},"originalSource":{"new":"https://cdn.shopify.com/s/files/1/0571/0384/3527/products/HF807213-GREY_6_008855dc-4c33-4cd4-866a-1dbc5c771db0_600x-PhotoRoom.png?v=1681165341"}},{"mediaContentType":{"new":"IMAGE"},"originalSource":{"new":"https://cdn.shopify.com/s/files/1/0571/0384/3527/products/HF807213-VRDP_7_bc14c2f3-e55c-4c46-a684-e8e5af108477.jpg?v=1681165341"}},{"mediaContentType":{"new":"IMAGE"},"originalSource":{".....
m
Did you specify the data type as JSON or String? With String data type, long strings can get truncated to a length of 512 by default (configurable). This limit does not apply if data type is JSON
i
@Mayank json data type
m
Does the exception print the entire JSON blob? If so, can you check if it is a valid JSON?
i
yes and yes i checked it is a valid json
b
'Got too many combinations' means that unnesting a JSON document results in at least 100k flattened documents . If you still want to index the document, you can set disableCrossArrayUnnest=true in JSON index options. The side effect is that it won't keep elements from two arrays in the same flattened document and thus could affect results of queries on more than one array at a time . See https://docs.pinot.apache.org/basics/indexing/json-index for details .
i
alright thanks @Bolek Ziobrowski, i will give a try first on this