Meryl Charleston
10/11/2024, 2:09 AMBenjamin Hopp
10/11/2024, 3:32 AMHLLSketchBuild. At query time you then can use HLLSketchMerge to query them.
If you're using MSQ, you probably want to use DS_HLL when you ingest and APPROX_COUNT_DISTINCT_DS_HLL when you query.Nick Marsh
10/14/2024, 3:28 AMBenjamin Hopp
10/14/2024, 1:05 PMMeryl Charleston
10/25/2024, 9:07 PMSELECT COUNT( DISTINCT "schema_coordinate_cardinality") from "cardinality_stats"
does that seem right to you? it always returns 0, which is incorrect. cardinality stats has the following metricsSpec:
"metricsSpec" : [ {
"name" : "client_name_cardinality",
"fieldName" : "client_name",
"type" : "HLLSketchBuild",
"lgK" : 12,
"tgtHllType" : "HLL_4"
}, {
"name" : "client_version_cardinality",
"fieldName" : "client_version",
"type" : "HLLSketchBuild",
"lgK" : 12,
"tgtHllType" : "HLL_4"
}, {
"name" : "operation_shape_cardinality",
"fieldName" : "query_id",
"type" : "HLLSketchBuild",
"lgK" : 12,
"tgtHllType" : "HLL_4"
}, {
"name" : "schema_coordinate_cardinality",
"fieldName" : "parent_type_and_field_name",
"type" : "HLLSketchBuild",
"lgK" : 12,
"tgtHllType" : "HLL_4"
} ],Benjamin Hopp
10/30/2024, 10:43 PMSELECT APPROX_COUNT_DISTINCT_DS_HLL(schema_coordinate_cardinality) from "cardinality_stats"?Meryl Charleston
11/01/2024, 6:14 PMMeryl Charleston
11/01/2024, 6:28 PM"dimensionsSpec" : {
"dimensions" : [ {
"name" : "service_id",
"type" : "string"
}, {
"name" : "schema_tag",
"type" : "string"
} ]
},
"metricsSpec" : [ {
"name" : "client_name_cardinality",
"fieldName" : "client_name",
"type" : "HLLSketchBuild",
"lgK" : 12,
"tgtHllType" : "HLL_4"
}]
I'm leaving out client_name from the dimensionsspec based on the docs saying "This will perform a HLL sketch on the userid field at ingestion time, allowing for highly-performant approximate COUNT DISTINCT query operations and improving roll-up ratios when userid is then left out of the dimensionsSpec."
I also saw here that the metricsspec field names need to be in the ioconfig as dimensions-- is that true?Benjamin Hopp
11/02/2024, 8:26 PM"type": "index_parallel",
"spec": {
"ioConfig": {
"type": "index_parallel",
"inputSource": {
"type": "http",
"uris": [
"<https://druid.apache.org/data/wikipedia.json.gz>"
]
},
"inputFormat": {
"type": "json"
}
},
"dataSchema": {
"granularitySpec": {
"segmentGranularity": "day",
"queryGranularity": "hour",
"rollup": true
},
"dataSource": "wikipedia_rollup",
"timestampSpec": {
"column": "timestamp",
"format": "iso"
},
"dimensionsSpec": {
"dimensions": [
"channel",
"page"
]
},
"metricsSpec": [
{
"name": "count",
"type": "count"
},
{
"type": "HLLSketchBuild",
"name": "distinct_users",
"fieldName": "user"
}
]
},
"tuningConfig": {
"type": "index_parallel",
"partitionsSpec": {
"type": "hashed"
},
"forceGuaranteedRollup": true
}
}
}Meryl Charleston
11/04/2024, 5:55 PM{
"type": "kafka",
"dataSchema": {
"dataSource": "cardinality_stats",
"timestampSpec": {
"column": "timestamp",
"format": "auto"
},
"dimensionsSpec": {
"dimensions": [
{
"name": "id",
"type": "string"
},
{
"name": "tag",
"type": "string"
}
]
},
"metricsSpec": [
{
"name": "client_name_cardinality",
"fieldName": "client_name",
"type": "HLLSketchBuild",
"lgK": 12,
"tgtHllType": "HLL_4"
},
{
"name": "client_version_cardinality",
"fieldName": "client_version",
"type": "HLLSketchBuild",
"lgK": 12,
"tgtHllType": "HLL_4"
},
{
"name": "operation_shape_cardinality",
"fieldName": "query_id",
"type": "HLLSketchBuild",
"lgK": 12,
"tgtHllType": "HLL_4"
}
],
"granularitySpec": {
"type": "uniform",
"segmentGranularity": "HOUR",
"queryGranularity": "MINUTE",
"rollup": true
}
},
"ioConfig": {
"topic": "stats",
"inputFormat": {
"type": "stats"
},
"consumerProperties": {
"bootstrap.servers": "test.server:8080",
"max.partition.fetch.bytes": 1234567,
"fetch.max.bytes": 12345678,
"max.poll.records": 500
},
"taskCount": 1,
"replicas": 1,
"period": "test",
"taskDuration": "test",
"lateMessageRejectionPeriod": "test",
"earlyMessageRejectionPeriod": "test",
"useEarliestOffset": false
},
"tuningConfig": {
"type": "kafka",
"logParseExceptions": true,
"maxParseExceptions": 0,
"maxSavedParseExceptions": 1,
"maxRowsPerSegment": 5000000,
"workerThreads": 1,
"indexSpec": {
"stringDictionaryEncoding": {
"type": "test",
"bucketSize": 4,
"formatVersion": 0
}
},
"intermediatePersistPeriod": "test"
}
}Meryl Charleston
11/04/2024, 7:25 PMindex_kafka. would it be helpful if I sent its payload?Benjamin Hopp
11/04/2024, 7:33 PMMeryl Charleston
11/04/2024, 7:50 PM"ioConfig" : {
"topic" : "engine-reports-stats",
"inputFormat" : {
"type" : "mdg_cardinality_stats"
},
and the inputFormat for the task that the supervisor submitted is:
"inputFormat": {
"type": "mdg_cardinality_stats"
},
should I be submitting additional tasks for ingestion?Meryl Charleston
11/04/2024, 7:51 PM"dimensionExclusions": [
"__time",
"operation_shape_cardinality",
"query_id",
"schema_coordinate_cardinality",
"client_name_cardinality",
"client_version_cardinality",
"client_version",
"client_name",
"timestamp"
],Benjamin Hopp
11/04/2024, 7:52 PM"inputFormat": {
"type": "csv",
"columns" : ["timestamp","page","language","user","unpatrolled","newPage","robot","anonymous","namespace","continent","country","region","city","added","deleted","delta"]
},Meryl Charleston
11/04/2024, 8:32 PMBenjamin Hopp
11/04/2024, 9:07 PMMeryl Charleston
11/05/2024, 6:03 PM