Apache Druid 는 빠른 속도로 데이터를 Aggregation 할 수 있는 툴이지만, 처음 사용하면 이것저것 미묘하게 힘든 부분들이 있다.
다음과 같은 걸 기억해두자. transform에서 오래걸렸던 부분은 컬럼명은 더블 쿼터로 “__time” 이런식으로 그리고 날짜 포맷부분등은 리터럴이라 쿼터로 ‘yyyy-MM-dd’ 형식으로 감싸야 한다는 것이다. TimeZone 도 리터럴이다.
{
"type": "index_parallel",
"spec": {
"ioConfig": {
"type": "index_parallel",
"inputSource": {
"type": "s3",
"prefixes": [
"s3://test-bucket/path1/path2/2020-06-30/"
]
},
"inputFormat": {
"type": "parquet"
},
"appendToExisting": true
},
"tuningConfig": {
"type": "index_parallel",
"partitionsSpec": {
"type": "dynamic"
},
"maxNumConcurrentSubTasks": 4
},
"dataSchema": {
"dataSource": "test_druid_log",
"granularitySpec": {
"type": "uniform",
"queryGranularity": "HOUR",
"rollup": true,
"segmentGranularity": "HOUR"
},
"timestampSpec": {
"column": "timestamp_column",
"format": "iso"
},
"dimensionsSpec": {
"dimensions": [
"id",
"date"
"name",
"email",
"country",
"user_id",
"service"
]
},
"transformSpec": {
"transforms": [
{
"type": "expression",
"name": "date",
"expression": "timestamp_format(\"__time\", 'yyyy-MM-dd', 'Asia/Seoul')"
}
]
}
}
}
}