Hello, everyone! I currently have this set up for ...
# general
g
Hello, everyone! I currently have this set up for Kafka ingestion in Pinot - I ingest data from a Kafka topic of the form Id - INT, Price - DOUBLE, UnixTime - LONG into a Pinot REALTIME table. I wanted to ask if there is a way to use the UnixTime timestamp from the ingested data as the timestamp column in the table - to use the value in the ingested message as Timestamp instead of ingestion time?
x
can you drop your schema and table config here?
g
This is currently what I am testing: { "schemaName": "TestRollup", "enableColumnBasedNullHandling": false, "dimensionFieldSpecs": [ { "name": "Id", "dataType": "INT", "fieldType": "DIMENSION", "notNull": false } ], "metricFieldSpecs": [ { "name": "Price", "dataType": "DOUBLE", "fieldType": "METRIC", "notNull": false } ], "dateTimeFieldSpecs": [ { "name": "ValueTimestamp", "dataType": "TIMESTAMP", "fieldType": "DATE_TIME", "notNull": false, "format": "TIMESTAMP", "granularity": "1:MILLISECONDS" }, { "name": "Timestamp", "dataType": "TIMESTAMP", "fieldType": "DATE_TIME", "notNull": false, "format": "TIMESTAMP", "granularity": "1:MILLISECONDS" } ] } { "REALTIME": { "tableName": "TestRollup_REALTIME", "tableType": "REALTIME", "segmentsConfig": { "schemaName": "TestRollup", "replication": "1", "replicasPerPartition": "1", "timeColumnName": "Timestamp", "minimizeDataMovement": false }, "tenants": { "broker": "DefaultTenant", "server": "DefaultTenant", "tagOverrideConfig": {} }, "tableIndexConfig": { "enableDefaultStarTree": false, "nullHandlingEnabled": false, "noDictionaryColumns": [], "bloomFilterColumns": [], "invertedIndexColumns": [], "onHeapDictionaryColumns": [], "rangeIndexColumns": [], "sortedColumn": [], "varLengthDictionaryColumns": [], "rangeIndexVersion": 2, "optimizeDictionaryForMetrics": false, "optimizeDictionary": false, "streamConfigs": { "streamType": "kafka", "stream.kafka.topic.name": "rollup-price-aggregation", "stream.kafka.broker.list": "kafka: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": "50", "realtime.segment.flush.threshold.time": "5m" }, "aggregateMetrics": false, "optimizeDictionaryType": false, "noDictionarySizeRatioThreshold": 0.85, "autoGeneratedInvertedIndex": false, "createInvertedIndexDuringSegmentGeneration": false, "loadMode": "MMAP", "enableDynamicStarTreeCreation": false, "columnMajorSegmentBuilderEnabled": true }, "metadata": {}, "quota": {}, "routing": {}, "query": {}, "ingestionConfig": { "rowTimeValueCheck": false, "continueOnError": false, "segmentTimeValueCheck": true }, "MergeRollupTask": { "1hour.mergeType": "rollup", "1hour.bucketTimePeriod": "1h", "1hour.bufferTimePeriod": "1h", "Price.aggregationType": "sum", }, "isDimTable": false } } I have a value in my message in Kafka (ValueTimestamp) and Timestamp is what I've set as Timestamp column in my REALTIME table. In that case, the Timestamp column will contain the ingestion date, right?
I've been playing around with the merge rollup task and I was curious if I could use the value in the ValueTimestamp from the message for the table's timestamp.
Also, considering the merge rollup task, will it group the rows in the segments to be merged based on the dimension column (Id) and perform the aggregation on Price?
x
why you need both
ValueTimestamp
and
Timestamp
?
I think
ValueTimestamp
is good enough in your case
in your realtime table config you can configure
"timeColumnName": "ValueTimestamp",
btw, where you configure the MergeRollupTask seems wrong, it should be under a configs:
tasks.taskTypeConfigsMap
Copy code
"task": {
    "taskTypeConfigsMap": {
      "MergeRollupTask": {
        "1hour.mergeType": "rollup",
        "1hour.bucketTimePeriod": "1h",
        "1hour.bufferTimePeriod": "3h",
        "1hour.maxNumRecordsPerSegment": "1000000",
        "1hour.maxNumRecordsPerTask": "5000000",
        "1hour.maxNumParallelBuckets": "5",
        "1day.mergeType": "rollup",
        "1day.bucketTimePeriod": "1d",
        "1day.bufferTimePeriod": "1d",
        "1day.roundBucketTimePeriod": "1d",
        "1day.maxNumRecordsPerSegment": "1000000",
        "1day.maxNumRecordsPerTask": "5000000",
        "metricColA.aggregationType": "sum",
        "metricColB.aggregationType": "max"
      }
    }
  }
g
Yes, my bad, I've copied the config wrong it is with the correct configuration.
x
ack
then if you are not publishing
Timestamp
field in kafka, you don’t have to configure it
g
Yes, but when I choose "ValueTimestamp" as my timeColumnName, the values in that column are not the ones from the messages in Kafka but the time of ingestion in Pinot (I assume)
I think I saw where my problem was with this one
x
can you confirm? Pinot doesn’t use ingestion time
g
I will run some tests to make sure but I think I made a mistake in the table config.