Aditya Verma
12/28/2024, 11:05 AM{
"schemaName": "user_stream_nested5",
"enableColumnBasedNullHandling": false,
"dimensionFieldSpecs": [
{
"name": "id",
"dataType": "INT",
"notNull": true
},
{
"name": "userstr",
"dataType": "STRING",
"notNull": false
}
],
"dateTimeFieldSpecs": [
{
"name": "last_login",
"dataType": "LONG",
"notNull": false,
"format": "1:MILLISECONDS:EPOCH",
"granularity": "1:MILLISECONDS"
}
],
"primaryKeyColumns": [
"id"
]
}
even tho my schema has primary key mentioned it still took two records for the same primary key
{ "id":1, "person" : [{"firstName" : "John","lastName" : "Smith" },{"firstName" : "Jai","lastName" : "hanuman"}], "last_login" : 1620150498000}
The above record was inserted two times into the table even tho Id is a primary key . Can anyone explain how ?Fasih Khatib
12/28/2024, 11:14 AMtransformConfigs look like in your table? You need to extract the id out of your JSON payload and into the appropriate column.Aditya Verma
12/28/2024, 11:45 AM"transformConfigs": [
{
"columnName": "userstr",
"transformFunction": "json_format(person)"
}
]Fasih Khatib
12/28/2024, 11:57 AMid column. Here's a snippet that I use. Please feel free to modify for your usecase.
{
"columnName": "id",
"transformFunction": "jsonPath(payload, '$.after.id')"
}Aditya Verma
12/28/2024, 12:04 PM"person" : [{"firstName" : "John","lastName" : "Smith" },{"firstName" : "Jai","lastName" : "hanuman"}]
on my console I have mentioned
userstr = json_format(person). So it parses only person as a JSON formatterAditya Verma
12/28/2024, 12:05 PMFasih Khatib
12/28/2024, 12:05 PMAditya Verma
12/28/2024, 12:06 PMAditya Verma
12/28/2024, 12:07 PM{
"schemaName": "user_stream_nested5",
"enableColumnBasedNullHandling": false,
"dimensionFieldSpecs": [
{
"name": "id",
"dataType": "INT",
"notNull": true
},
{
"name": "userstr",
"dataType": "STRING",
"notNull": false
}
],
"dateTimeFieldSpecs": [
{
"name": "last_login",
"dataType": "LONG",
"notNull": false,
"format": "1:MILLISECONDS:EPOCH",
"granularity": "1:MILLISECONDS"
}
],
"primaryKeyColumns": [
"id"
]
}Aditya Verma
12/28/2024, 12:16 PMXiang Fu
Xiang Fu
Xiang Fu
Aditya Verma
12/28/2024, 5:21 PMAditya Verma
12/29/2024, 5:48 AMso in below config
"columnName": "userstr",
userstr is for the array json only
"person" : [{"firstName" : "John","lastName" : "Smith" },{"firstName" : "Jai","lastName" : "hanuman"}]
on my console I have mentioned
userstr = json_format(person). So it parses only person as a JSON formatter
[5:35 PM]
In my opinion I think we only need for nested json and id was not nested so I wont be needing it
Ah, I see. Do you see ID column populated when you query from the query console?Fasih Khatib
12/29/2024, 6:10 AMFasih Khatib
12/29/2024, 6:10 AMFasih Khatib
12/29/2024, 6:11 AMAditya Verma
12/29/2024, 7:25 AMDATA:
{ "id":1, "person" : [{"firstName" : "John","lastName" : "Smith" },{"firstName" : "Jai","lastName" : "hanuman"}], "last_login" : 1620150498000}
• Table Schema
{
"schemaName": "user_stream_primary",
"enableColumnBasedNullHandling": false,
"dimensionFieldSpecs": [
{
"name": "id",
"dataType": "INT",
"notNull": true
},
{
"name": "userstr",
"dataType": "STRING",
"notNull": false
}
],
"dateTimeFieldSpecs": [
{
"name": "last_login",
"dataType": "LONG",
"notNull": false,
"format": "1:MILLISECONDS:EPOCH",
"granularity": "1:MILLISECONDS"
}
],
"primaryKeyColumns": [
"id"
]
}
Table real time schema
{
"REALTIME": {
"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
},
"metadata": {},
"quota": {},
"routing": {},
"query": {},
"ingestionConfig": {
"continueOnError": false,
"rowTimeValueCheck": false,
"transformConfigs": [
{
"columnName": "userstr",
"transformFunction": "json_format(person)"
}
],
"segmentTimeValueCheck": true
},
"isDimTable": false
}
}Aditya Verma
12/29/2024, 7:26 AMAditya Verma
12/29/2024, 7:26 AMAditya Verma
12/29/2024, 7:28 AMAditya Verma
12/29/2024, 7:33 AMFasih Khatib
12/29/2024, 11:47 AM"routing": {
"instanceSelectorType": "strictReplicaGroup"
},
"upsertConfig": {
"mode": "FULL"
}Fasih Khatib
12/29/2024, 11:47 AMAditya Verma
12/29/2024, 11:49 AMFasih Khatib
12/29/2024, 11:53 AM