Aditya Verma
01/07/2025, 8:52 AM"tableIndexConfig": {
"autoGeneratedInvertedIndex": false,
"enableDynamicStarTreeCreation": false,
"columnMajorSegmentBuilderEnabled": true,
"optimizeDictionaryForMetrics": false,
"noDictionarySizeRatioThreshold": 0.85,
"varLengthDictionaryColumns": [],
"rangeIndexVersion": 2,
"loadMode": "MMAP",
"streamConfigs": {
"streamType": "kafka",
"stream.kafka.topic.name": "user_stream_primary",
"stream.kafka.broker.list": "localhost:9092",
"stream.kafka.consumer.type": "lowlevel",
"stream.kafka.consumer.prop.auto.offset.reset": "smallest",
"stream.kafka.consumer.factory.class.name": "org.apache.pinot.plugin.stream.kafka20.KafkaConsumerFactory",
"stream.kafka.decoder.class.name": "org.apache.pinot.plugin.stream.kafka.KafkaJSONMessageDecoder",
"realtime.segment.flush.threshold.rows": "0",
"realtime.segment.flush.threshold.segment.rows": "0",
"realtime.segment.flush.threshold.time": "24h",
"realtime.segment.flush.threshold.segment.size": "100M"
},
"enableDefaultStarTree": false,
"aggregateMetrics": false,
"nullHandlingEnabled": false,
"optimizeDictionary": false,
"onHeapDictionaryColumns": [],
"rangeIndexColumns": [],
"sortedColumn": [],
"bloomFilterColumns": [],
"invertedIndexColumns": [],
"noDictionaryColumns": [],
"createInvertedIndexDuringSegmentGeneration": false,
"jsonIndexConfigs": {
"winnerDetail": {
"maxLevels": -1,
"excludeArray": false,
"disableCrossArrayUnnest": true,
"includePaths": null,
"excludePaths": null,
"excludeFields": null,
"indexPaths": null
},
"card": {
"maxLevels": -1,
"excludeArray": false,
"disableCrossArrayUnnest": true,
"includePaths": null,
"excludePaths": null,
"excludeFields": null,
"indexPaths": null
},
"communityCard": {
"maxLevels": -1,
"excludeArray": false,
"disableCrossArrayUnnest": true,
"includePaths": null,
"excludePaths": null,
"excludeFields": null,
"indexPaths": null
}
}
}
not able to understand why it has returned such a responce , is there anything wrong with my configs ?
@Maximilian Lau @Gonzalo Ortiz @MayankYash Mayya
01/07/2025, 8:59 AMfieldConfigList.indexes - https://docs.pinot.apache.org/basics/indexing/json-index#deprecated-ways-to-configure-json-indexes.Gonzalo Ortiz
01/07/2025, 9:01 AMAditya Verma
01/07/2025, 9:01 AMAditya Verma
01/07/2025, 9:01 AMAditya Verma
01/07/2025, 9:02 AM"jsonIndexConfigs": {
"winnerDetail": {
"maxLevels": -1,
"excludeArray": false,
"disableCrossArrayUnnest": true,
"includePaths": null,
"excludePaths": null,
"excludeFields": null,
"indexPaths": null
}
which of the configurations can I remove or should I remove ?Gonzalo Ortiz
01/07/2025, 9:03 AMGonzalo Ortiz
01/07/2025, 9:04 AMAditya Verma
01/07/2025, 9:06 AMjsonIndexConfigs": {
"winnerDetail": {
"excludeArray": false,
"disableCrossArrayUnnest": true,
"indexPaths": null
}Aditya Verma
01/07/2025, 9:06 AMGonzalo Ortiz
01/07/2025, 9:07 AMAditya Verma
01/07/2025, 9:07 AMAditya Verma
01/07/2025, 9:12 AM"communityCards": [
{
"card_suit": "HEART",
"card_value": 10
},
{
"card_suit": "SPADE",
"card_value": 2
},
{
"card_suit": "HEART",
"card_value": 5
},
{
"card_suit": "SPADE",
"card_value": 10
},
{
"card_suit": "CLUB",
"card_value": 9
}
],Aditya Verma
01/07/2025, 9:12 AMGonzalo Ortiz
01/07/2025, 9:14 AMAditya Verma
01/07/2025, 9:15 AMAditya Verma
01/07/2025, 9:47 AM{
"tableName": "user_stream_primary_REALTIME",
"tableType": "REALTIME",
"segmentsConfig": {
"timeColumnName": "last_login",
"minimizeDataMovement": false,
"schemaName": "user_stream_primary",
"replication": "1",
"replicasPerPartition": "1"
},
"tenants": {
"broker": "DefaultTenant",
"server": "DefaultTenant",
"tagOverrideConfig": {}
},
"tableIndexConfig": {
"autoGeneratedInvertedIndex": false,
"enableDynamicStarTreeCreation": false,
"columnMajorSegmentBuilderEnabled": true,
"optimizeDictionaryForMetrics": false,
"noDictionarySizeRatioThreshold": 0.85,
"varLengthDictionaryColumns": [],
"rangeIndexVersion": 2,
"loadMode": "MMAP",
"streamConfigs": {
"streamType": "kafka",
"stream.kafka.topic.name": "user_stream_primary",
"stream.kafka.broker.list": "localhost:9092",
"stream.kafka.consumer.type": "lowlevel",
"stream.kafka.consumer.prop.auto.offset.reset": "smallest",
"stream.kafka.consumer.factory.class.name": "org.apache.pinot.plugin.stream.kafka20.KafkaConsumerFactory",
"stream.kafka.decoder.class.name": "org.apache.pinot.plugin.stream.kafka.KafkaJSONMessageDecoder",
"realtime.segment.flush.threshold.rows": "0",
"realtime.segment.flush.threshold.segment.rows": "0",
"realtime.segment.flush.threshold.time": "24h",
"realtime.segment.flush.threshold.segment.size": "100M"
},
"enableDefaultStarTree": false,
"aggregateMetrics": false,
"nullHandlingEnabled": false,
"optimizeDictionary": false,
"onHeapDictionaryColumns": [],
"rangeIndexColumns": [],
"sortedColumn": [],
"bloomFilterColumns": [],
"invertedIndexColumns": [],
"noDictionaryColumns": [],
"createInvertedIndexDuringSegmentGeneration": false
},
"fieldConfigList": [
{
"name": "winnerDetail",
"indexes": {
"json": {
"maxLevels": -1,
"excludeArray": false,
"disableCrossArrayUnnest": true,
"indexPaths": null
}
}
}
]
},
"metadata": {},
"quota": {},
"routing": {
"instanceSelectorType": "strictReplicaGroup"
},
"query": {},
"upsertConfig": {
"mode": "FULL",
"defaultPartialUpsertStrategy": "OVERWRITE",
"upsertViewRefreshIntervalMs": 3000,
"hashFunction": "NONE",
"enablePreload": false,
"consistencyMode": "NONE",
"enableSnapshot": false,
"metadataTTL": 0,
"deletedKeysTTL": 0,
"dropOutOfOrderRecord": false,
"allowPartialUpsertConsumptionDuringCommit": false
},
"ingestionConfig": {
"continueOnError": false,
"rowTimeValueCheck": false,
"transformConfigs": [
{
"columnName": "userstr",
"transformFunction": "json_format(person)"
}
],
"segmentTimeValueCheck": true
},
"isDimTable": false
}
hi @Yash Mayya can you check now if its fine ?Yash Mayya
01/07/2025, 9:50 AMGonzalo Ortiz
01/07/2025, 9:52 AMAditya Verma
01/07/2025, 9:52 AM"fieldConfigList": [
{
"name": "winnerDetail",
"indexes": {
"json": {
"maxLevels": -1,
"excludeArray": false,
"disableCrossArrayUnnest": true,
"indexPaths": null
}
}
}
]
},
I guess I have an extra '}' here I might need to remove it
"fieldConfigList": [
{
"name": "winnerDetail",
"indexes": {
"json": {
"maxLevels": -1,
"excludeArray": false,
"disableCrossArrayUnnest": true,
"indexPaths": null
}
}
}
]
should be like this I suppose. It wont be inside t`ableindexconfig.` rightYash Mayya
01/07/2025, 9:53 AMAditya Verma
01/07/2025, 9:53 AMAditya Verma
01/07/2025, 10:03 AMGonzalo Ortiz
01/07/2025, 10:05 AMmaxLevels , excludeArray and indexPaths are being set to the default values (as specified in the table in the doc)Gonzalo Ortiz
01/07/2025, 10:06 AMGonzalo Ortiz
01/07/2025, 10:06 AMAditya Verma
01/07/2025, 10:07 AMAditya Verma
01/07/2025, 10:09 AMindexPaths
Index the given paths, e.g. *.*, a.**. Paths
this is mentioned
so is it equivalent to *`winnerDetail.`
for my data
"winnerDetails": [
{
"winnerUserId": 12121,
"winnerUserName": "user12121"
}
],Gonzalo Ortiz
01/07/2025, 10:09 AMindexPaths is a new field included in 1.3.0 (currently in snapshot)Aditya Verma
01/07/2025, 10:11 AMAditya Verma
01/07/2025, 10:11 AMAditya Verma
01/07/2025, 10:11 AMAditya Verma
01/07/2025, 10:29 AMSELECT userId
FROM game_hands_data
where json_extract_scalar(card, '$[0].card_value', 'STRING') = '4'
group by userId
is it because of the json indexing? its only applied on 3 columns .really couldn't understnd why the size would increase 3 timesAditya Verma
01/07/2025, 10:29 AMGonzalo Ortiz
01/07/2025, 10:32 AMGonzalo Ortiz
01/07/2025, 10:34 AMAditya Verma
01/07/2025, 10:34 AMGonzalo Ortiz
01/07/2025, 10:37 AMAditya Verma
01/07/2025, 10:39 AMAditya Verma
01/07/2025, 10:40 AMGonzalo Ortiz
01/07/2025, 10:40 AMAditya Verma
01/07/2025, 10:43 AMAditya Verma
01/07/2025, 10:44 AMAditya Verma
01/07/2025, 11:29 AMSELECT *
FROM game_hands_data
where JSON_MATCH(winnerDetail, '"$.winnerDetails.winnerUserName"=''user12121''' )
I am trying to run this query but it doesnt seem to run as an alteranative to json_scalar_extract (edited)
below is my json data snippet
"userId": 12121,
"handId": 88625293929,
"username": "user12121",
"handRank": "STRAIGHT",
"handRankValue": 8,
"splashDropAmount": None,
"winnerDetail": [
{
"winnerUserId": 12121,
"winnerUserName": "user12121"
}
],
"isBombpot": True,
"isBombpotConfig": False,
"isDoubleboardGame": True
}
I have index on json column
"transformConfigs": [
{
"columnName": "winnerDetail",
"transformFunction": "json_format(winnerDetails)"
}
]Aditya Verma
01/07/2025, 11:35 AMyes, if you do so, probably the space on disk will be reduced to less than 600MBs
this we wont be able to do it as it would create duplicate primary key IDs in the data base for such snippets
"cards": [
{
"card_suit": "DIAMOND",
"card_value": 4
},
{
"card_suit": "CLUB",
"card_value": 6
}
],
as you can see here card_value will hold two values for the same cards under the same primary keyGonzalo Ortiz
01/07/2025, 11:58 AMYash Mayya
01/07/2025, 1:04 PMbut the query time is almost the same which it was before close to 8 seconds
json_extract_scalar doesn't use the JSON index. You can try out json_extract_index instead - see https://github.com/apache/pinot/pull/12466, https://docs.pinot.apache.org/basics/indexing/json-index#how-to-use-the-json-index.Aditya Verma
01/07/2025, 3:10 PMAditya Verma
01/07/2025, 3:10 PMAditya Verma
01/07/2025, 3:10 PMYash Mayya
01/07/2025, 4:23 PM