```{ "schemaName": "user_stream_nested5", "ena...
# troubleshooting
a
Copy code
{
  "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 ?
f
What do your
transformConfigs
look like in your table? You need to extract the
id
out of your JSON payload and into the appropriate column.
a
"transformConfigs": [
{
"columnName": "userstr",
"transformFunction": "json_format(person)"
}
]
f
@Aditya Verma You need one to extract the ID out of your payload into the
id
column. Here's a snippet that I use. Please feel free to modify for your usecase.
Copy code
{
  "columnName": "id",
  "transformFunction": "jsonPath(payload, '$.after.id')"
}
a
so 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
In my opinion I think we only need for nested json and id was not nested so I wont be needing it
f
Ah, I see. Do you see ID column populated when you query from the query console?
a
yess
Copy code
{
  "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"
  ]
}
Also I want to ask one thing . I keeop seeings this and hard to understand which service is down
x
this means your pinot server is down
can you check your k8s pod status?
if u have the UI access, then likely to be brokers
a
Yes I am not running on k8s I mean I am just running on my local server. Yes I can see the UI but its doesnt let me query it
hi @Fasih Khatib any updates on the same
Copy code
so 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?
f
table.json
I'm unable to reproduce the issue you've mentioned. When I try the table and schema configuration similar to what you've described, I only see the latest version of the row. Here's my table configuration for your reference. Please change the table name and Kafka topic to match what you have.
^ @Aditya Verma
a
Hi @Fasih Khatib Here how you can replicate the issue
DATA:
{  "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"
]
}
Copy code
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
}
}
This is how i am doing the json_format(person) in the UI just for your reference
This is how data looks even after using ID as primary key column
This is how table looks after creating in UI
Please try this and you might be able to replicate it @Fasih Khatib
f
You need to add the following to your table configuration to remediate the issue.
Copy code
"routing": {
    "instanceSelectorType": "strictReplicaGroup"
  },
  "upsertConfig": {
    "mode": "FULL"
  }
@Aditya Verma
a
I did this still it didn’t work . Should I send you the whole config after updation Also I read for streaming you need to use dedup config which I did already
f
Works for me.