Compact segments using hadoop indexer


Having trouble with the hadoop druid indexer for compacting existing small segments into larger one. We are using the 0.12.0 version of the indexing package.

We have some smaller segments we want to compact into larger segments so there are fewer segments to keep track of.

We execute the compact command like this:

/opt/druid-0.12.0; java -Xmx512m -Dfile.encoding=UTF-8 -classpath
io.druid.cli.Main index hadoop


It would be really helpful to see an example of a working compact task spec for hadoop indexing.

The one we have come up with isn’t working:



Generally we index the segments using this:

"dataSchema": {...},
“”:"-Xmx6144m -XX:+UseG1GC",




I’m unsure how to translate the index task to a compaction task that is run via the hadoop indexer. The documentation here:
says that some sections are not required (tuningConfig, context, and id) but if you submit without tuningConfig it will throw a NullPointer.

Any help greatly appreciated.

Hey Asher,

At the moment I don’t think the compact tasks can index using Hadoop. It uses Druid’s native indexing.

You can create an index_hadoop task using existing segments as an input though which is little more complex but is capable of doing the same thing. I’ve included the structure of what that might look like below. Some more examples can be seen here:

    "type": "index_hadoop",
    "spec": {
        "ioConfig": {
            "type": "hadoop",
            "inputSpec": {
                "type": "dataSource",
                "ingestionSpec": {
                    "dataSource": "{replace_me}",
                    "intervals": [
        "dataSchema": {},
        "tuningConfig": {
            "type": "hadoop",
            "partitionsSpec": {}