Julian Reyes
11/14/2024, 12:37 PMJohn Kowtko
11/14/2024, 1:49 PMJulian Reyes
11/14/2024, 2:08 PMHi Julian, I don’t know the answer to your ingestion-time lookup-based filtering (... although from the streaming setup wizard it looks like filters operate post-transform)where can I read they operate post-transform? what happens then if there is no transform? On the second topic, would I need to re-index from a file? I am looking into how I could automate this on a monthly basis for example, where I do not really depend on index_parallel from file or s3.
John Kowtko
11/14/2024, 2:44 PMNote that within a, thetransformSpecare applied before thetransforms, so the filter can refer to a transform.filter
Julian Reyes
11/14/2024, 2:45 PMJohn Kowtko
11/14/2024, 2:46 PMJohn Kowtko
11/14/2024, 2:48 PMreplace into my_events overwrite where __time >= TIMESTAMP '2024-11-01' and __time < TIMESTAMP '2024-11-02'
select *
from my_events
where __time >= '2024-11-01' and __time < '2024-11-02'
and colA != 'whatever_I_am_filtering_out'Julian Reyes
11/14/2024, 3:27 PM{
"type": "index_parallel",
"spec": {
"dataSchema": {
"dataSource": "my_datasource",
"timestampSpec": {
"column": "ts",
"format": "millis",
"missingValue": null
},
"dimensionsSpec": {
"dimensions": [
{
"type": "string",
"name": "user_id",
"multiValueHandling": "SORTED_ARRAY",
"createBitmapIndex": true
},
{
"type": "string",
"name": "status_code",
"multiValueHandling": "SORTED_ARRAY",
"createBitmapIndex": true
},
{
"type": "long",
"name": "response_size",
"multiValueHandling": "SORTED_ARRAY",
"createBitmapIndex": false
},
{
"type": "long",
"name": "isSubRequest",
"multiValueHandling": "SORTED_ARRAY",
"createBitmapIndex": false
}
],
"dimensionExclusions": [
"__time",
"sum_units",
"units",
"count",
"ts",
"sum_response_size"
],
"includeAllDimensions": false,
"useSchemaDiscovery": false
},
"metricsSpec": [
{
"type": "count",
"name": "count"
},
{
"type": "longSum",
"name": "sum_response_size",
"fieldName": "response_size"
},
{
"type": "longSum",
"name": "sum_units",
"fieldName": "units"
}
],
"granularitySpec": {
"type": "uniform",
"segmentGranularity": "DAY",
"queryGranularity": "MINUTE",
"rollup": true,
"intervals": []
},
"transformSpec": {
"filter": null,
"transforms": [
{
"type": "expression",
"name": "isSubRequest",
"expression": "if(\"batch_id\" > 0, 1, 0)"
}
]
}
},
"ioConfig": {
"type": "index_parallel",
"inputSource": {
"type": "druid",
"dataSource": "my_datasource",
"interval": "2024-10-12/2024-11-11",
"filter": {
"type": "not",
"field": {
"type": "extraction",
"dimension": "user_id",
"value": "core_free_tier",
"extractionFn": {
"type": "registeredLookup",
"lookup": "customer_metadata",
"retainMissingValue": true
}
}
}
},
"appendToExisting": false,
"dropExisting": true
},
"tuningConfig": {
"type": "index_parallel",
"appendableIndexSpec": {
"type": "onheap",
"preserveExistingMetrics": false
},
"maxRowsInMemory": 1000000,
"maxBytesInMemory": 0,
"skipBytesInMemoryOverheadCheck": false,
"maxRowsPerSegment": 5000000,
"intermediatePersistPeriod": "PT5M",
"maxPendingPersists": 0,
"indexSpec": {
"bitmap": {
"type": "roaring",
"compressRunOnSerialization": true
},
"dimensionCompression": "lz4",
"metricCompression": "lz4",
"longEncoding": "longs"
},
"indexSpecForIntermediatePersists": {
"bitmap": {
"type": "roaring",
"compressRunOnSerialization": true
},
"dimensionCompression": "lz4",
"metricCompression": "lz4",
"longEncoding": "longs"
},
"reportParseExceptions": false,
"handoffConditionTimeout": 0,
"resetOffsetAutomatically": false,
"skipSequenceNumberAvailabilityCheck": true,
"chatRetries": 8,
"httpTimeout": "PT10S",
"shutdownTimeout": "PT80S",
"recordBufferSize": 10000,
"recordBufferOfferTimeout": 5000,
"recordBufferFullWait": 5000,
"logParseExceptions": true,
"maxParseExceptions": 2147483647,
"maxSavedParseExceptions": 0,
"maxRecordsPerPoll": 100,
"intermediateHandoffPeriod": "P2147483647D",
"repartitionTransitionDuration": "PT120S",
"offsetFetchPeriod": "PT30S",
"useListShards": true,
"skipIgnorableShards": false,
"maxNumConcurrentSubTasks": 150
}
},
"context": {
"forceTimeChunkLock": true,
"useLineageBasedSegmentAllocation": true,
"priority": 80
}
}
Also the key thing is that it checks a lookup table that has a map of user_ids with its tier as
Lookup : customer_metadata
------------------------------
key | value
------------------------------
01234abcd | developer_tier
098765ejf | core_free_tier
djck1234k | growth_tier
oldo4958d | core_free_tierJohn Kowtko
11/14/2024, 7:20 PMJulian Reyes
11/14/2024, 10:31 PM