Notice
Recent Posts
Recent Comments
Link
«   2026/04   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30
Tags
more
Archives
Today
Total
관리 메뉴

인턴기록지

[Druid] Writing an ingestion spec - rollup이 된 data 본문

Druid/Project

[Druid] Writing an ingestion spec - rollup이 된 data

인턴신분현경이 2020. 9. 17. 17:02

2. rollup된 data

 

롤업을 true로 설정하면 metrcs 를 꼭 작성해주어야 한다. 

{
    "type" : "index_parallel",
    "spec" : {
        "dataSchema" : {
            "dataSource" : "100_history_rollup_made",
            "timestampSpec" : {
                "column" : "rental_date",
                "format" : "iso"
            },
            "dimensionsSpec" : {
                "dimensions" : [
                    "bike_id",
                    "user_id",
                    "station_rental_id",
                    "return_date",
                    "station_return_id",
                    "mileage",
                    "holiday",
                    "holiday2",
                    "bike_type"
                ]
            },
            "metricsSpec" :[ //롤업 컬럼 지정 , name에는 새로운 컬럼이름 지정, fieldname에는 사용할 컬럼 지정
                {"type" : "count", "name" : "count"},
                { "type":"longSum","name": "sum_usage_time", "fieldName" : "usage_time"},
                { "type":"longSum","name": "sum_distance", "fieldName" : "distance"},
                { "type":"longSum","name": "sum_daytype", "fieldName" : "daytype"}
            ],
            "granularitySpec" : {
                "type" : "uniform",
                "segmentGranularity" : "week",
                "queryGranularity" : "minute",
                "rollup" : true  //롤업 true로 변경
            }
        },
        "ioConfig" : {
            "type":"index_parallel",
            "inputSource" : {
                "type":"local",
                "baseDir":"quickstart/tutorial",
                "filter":"100_history.txt"
            },
            "inputFormat" : {
                "type" : "json"
            },
            "appendToExisting":false
        }
    }
}
[root@localhost tutorial]# curl -X 'POST' -H 'Content-Type:application/json' -d @100-index-rollup.json http://localhost:8081/druid/indexer/v1/task
{"task":"index_parallel_100_history_rollup_made_ngdblekl_2020-09-17T01:25:24.264Z"}