pinot icon indicating copy to clipboard operation
pinot copied to clipboard

Support nested json schema in realtime ingest

Open dubin555 opened this issue 5 years ago • 7 comments

Hi forks, Does the streaming ingest function support the nested json schema, e.g. { "a": { "b": "xxx" } } Is there a way like this in the schema statement: "a.b" is a string

Thanks

dubin555 avatar Mar 05 '21 01:03 dubin555

Do you want the column name to be a.b and value xxx?

kishoreg avatar Mar 05 '21 01:03 kishoreg

Do you want the column name to be a.b and value xxx?

yes, sir

dubin555 avatar Mar 05 '21 02:03 dubin555

Also does the kafka realtime ingest part have resource control? e.g. how many consumer thread

dubin555 avatar Mar 05 '21 08:03 dubin555

For the json field, you can configure it as string field in the schema, and enable json index for it (Check https://docs.pinot.apache.org/basics/indexing/json-index for more details) Note that the input data needs to be json strings. You may use jsonFormat() function to convert object to json string if needed.

For Kafka real-time ingestion, each Kafka partition is consumed by one thread (one consuming segment), and you can configure multiple replications of the segment

Jackie-Jiang avatar Mar 05 '21 19:03 Jackie-Jiang

For the json field, you can configure it as string field in the schema, and enable json index for it (Check https://docs.pinot.apache.org/basics/indexing/json-index for more details) Note that the input data needs to be json strings. You may use jsonFormat() function to convert object to json string if needed.

For Kafka real-time ingestion, each Kafka partition is consumed by one thread (one consuming segment), and you can configure multiple replications of the segment

Thanks for the reply! I check the link that you posted. If the upstream data is in nested json, like this: {"props":{"name":"tom"}}, can data be stored in a column field like 'name' WITHOUT nested 'props'?

I don't quite understand. Suppose the upstream Kafka topic has 10 partitions, and I want to configure 2 consumer threads. Question 1, where to config the setting. Question 2. If lag happens, I want to increase to 10 threads, how to change the setting

dubin555 avatar Mar 08 '21 05:03 dubin555

Yes. You can create a column “name” and use a transform function

see json functions here https://docs.pinot.apache.org/users/user-guide-query/supported-transformations

kishoreg avatar Mar 08 '21 06:03 kishoreg

We create one thread per partition automatically.

kishoreg avatar Mar 08 '21 06:03 kishoreg