blob: 0ab75f696ebf94465526101ee6fdb01384e29708 [file] [log] [blame]
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[6160],{3905:(t,e,n)=>{n.d(e,{Zo:()=>s,kt:()=>k});var a=n(67294);function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,a)}return n}function l(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function o(t,e){if(null==t)return{};var n,a,i=function(t,e){if(null==t)return{};var n,a,i={},r=Object.keys(t);for(a=0;a<r.length;a++)n=r[a],e.indexOf(n)>=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(a=0;a<r.length;a++)n=r[a],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}var p=a.createContext({}),m=function(t){var e=a.useContext(p),n=e;return t&&(n="function"==typeof t?t(e):l(l({},e),t)),n},s=function(t){var e=m(t.components);return a.createElement(p.Provider,{value:e},t.children)},d="mdxType",c={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},u=a.forwardRef((function(t,e){var n=t.components,i=t.mdxType,r=t.originalType,p=t.parentName,s=o(t,["components","mdxType","originalType","parentName"]),d=m(n),u=i,k=d["".concat(p,".").concat(u)]||d[u]||c[u]||r;return n?a.createElement(k,l(l({ref:e},s),{},{components:n})):a.createElement(k,l({ref:e},s))}));function k(t,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof t||i){var r=n.length,l=new Array(r);l[0]=u;var o={};for(var p in e)hasOwnProperty.call(e,p)&&(o[p]=e[p]);o.originalType=t,o[d]="string"==typeof t?t:i,l[1]=o;for(var m=2;m<r;m++)l[m]=n[m];return a.createElement.apply(null,l)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"},22841:(t,e,n)=>{n.r(e),n.d(e,{assets:()=>s,contentTitle:()=>p,default:()=>k,frontMatter:()=>o,metadata:()=>m,toc:()=>d});var a=n(87462),i=n(63366),r=(n(67294),n(3905)),l=["components"],o={id:"manual-compaction",title:"Manual compaction"},p=void 0,m={unversionedId:"data-management/manual-compaction",id:"data-management/manual-compaction",title:"Manual compaction",description:"\x3c!--",source:"@site/docs/latest/data-management/manual-compaction.md",sourceDirName:"data-management",slug:"/data-management/manual-compaction",permalink:"/docs/latest/data-management/manual-compaction",draft:!1,tags:[],version:"current",frontMatter:{id:"manual-compaction",title:"Manual compaction"},sidebar:"docs",previous:{title:"Automatic compaction",permalink:"/docs/latest/data-management/automatic-compaction"},next:{title:"Overview and syntax",permalink:"/docs/latest/querying/sql"}},s={},d=[{value:"Setting up manual compaction",id:"setting-up-manual-compaction",level:2},{value:"Manual compaction task example",id:"manual-compaction-task-example",level:2},{value:"Compaction I/O configuration",id:"compaction-io-configuration",level:2},{value:"Interval <code>inputSpec</code>",id:"interval-inputspec",level:3},{value:"Segments <code>inputSpec</code>",id:"segments-inputspec",level:3},{value:"Compaction dimensions spec",id:"compaction-dimensions-spec",level:2},{value:"Compaction transform spec",id:"compaction-transform-spec",level:2},{value:"Compaction granularity spec",id:"compaction-granularity-spec",level:2},{value:"Learn more",id:"learn-more",level:2}],c={toc:d},u="wrapper";function k(t){var e=t.components,n=(0,i.Z)(t,l);return(0,r.kt)(u,(0,a.Z)({},c,n,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"In Apache Druid, compaction is a special type of ingestion task that reads data from a Druid datasource and writes it back into the same datasource. A common use case for this is to ",(0,r.kt)("a",{parentName:"p",href:"/docs/latest/operations/segment-optimization"},"optimally size segments")," after ingestion to improve query performance."),(0,r.kt)("p",null,"You can perform manual compaction where you submit a one-time compaction task for a specific interval. Generally, you don't need to do this if you use ",(0,r.kt)("a",{parentName:"p",href:"/docs/latest/data-management/automatic-compaction"},"automatic compaction"),", which is recommended for most workloads."),(0,r.kt)("h2",{id:"setting-up-manual-compaction"},"Setting up manual compaction"),(0,r.kt)("p",null," Compaction tasks merge all segments for the defined interval according to the following syntax:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json"},'{\n "type": "compact",\n "id": <task_id>,\n "dataSource": <task_datasource>,\n "ioConfig": <IO config>,\n "dimensionsSpec": <custom dimensionsSpec>,\n "transformSpec": <custom transformSpec>,\n "metricsSpec": <custom metricsSpec>,\n "tuningConfig": <parallel indexing task tuningConfig>,\n "granularitySpec": <compaction task granularitySpec>,\n "context": <task context>\n}\n')),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Field"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"type")),(0,r.kt)("td",{parentName:"tr",align:null},"Task type. Set the value to ",(0,r.kt)("inlineCode",{parentName:"td"},"compact"),"."),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"id")),(0,r.kt)("td",{parentName:"tr",align:null},"Task ID"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"dataSource")),(0,r.kt)("td",{parentName:"tr",align:null},"Data source name to compact"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"ioConfig")),(0,r.kt)("td",{parentName:"tr",align:null},"I/O configuration for compaction task. See ",(0,r.kt)("a",{parentName:"td",href:"#compaction-io-configuration"},"Compaction I/O configuration")," for details."),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"dimensionsSpec")),(0,r.kt)("td",{parentName:"tr",align:null},"When set, the compaction task uses the specified ",(0,r.kt)("inlineCode",{parentName:"td"},"dimensionsSpec")," rather than generating one from existing segments. See ",(0,r.kt)("a",{parentName:"td",href:"#compaction-dimensions-spec"},"Compaction dimensionsSpec")," for details."),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"transformSpec")),(0,r.kt)("td",{parentName:"tr",align:null},"When set, the compaction task uses the specified ",(0,r.kt)("inlineCode",{parentName:"td"},"transformSpec")," rather than using ",(0,r.kt)("inlineCode",{parentName:"td"},"null"),". See ",(0,r.kt)("a",{parentName:"td",href:"#compaction-transform-spec"},"Compaction transformSpec")," for details."),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"metricsSpec")),(0,r.kt)("td",{parentName:"tr",align:null},"When set, the compaction task uses the specified ",(0,r.kt)("inlineCode",{parentName:"td"},"metricsSpec")," rather than generating one from existing segments."),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"segmentGranularity")),(0,r.kt)("td",{parentName:"tr",align:null},"Deprecated. Use ",(0,r.kt)("inlineCode",{parentName:"td"},"granularitySpec"),"."),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"tuningConfig")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/latest/ingestion/native-batch#tuningconfig"},"Tuning configuration")," for parallel indexing. ",(0,r.kt)("inlineCode",{parentName:"td"},"awaitSegmentAvailabilityTimeoutMillis")," value is not supported for compaction tasks. Leave this parameter at the default value, 0."),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"granularitySpec")),(0,r.kt)("td",{parentName:"tr",align:null},"When set, the compaction task uses the specified ",(0,r.kt)("inlineCode",{parentName:"td"},"granularitySpec")," rather than generating one from existing segments. See ",(0,r.kt)("a",{parentName:"td",href:"#compaction-granularity-spec"},"Compaction ",(0,r.kt)("inlineCode",{parentName:"a"},"granularitySpec"))," for details."),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"context")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/latest/ingestion/tasks#context"},"Task context")),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"}," Note: Use ",(0,r.kt)("inlineCode",{parentName:"p"},"granularitySpec")," over ",(0,r.kt)("inlineCode",{parentName:"p"},"segmentGranularity")," and only set one of these values. If you specify different values for these in the same compaction spec, the task fails.")),(0,r.kt)("p",null,"To control the number of result segments per time chunk, you can set ",(0,r.kt)("a",{parentName:"p",href:"/docs/latest/ingestion/native-batch#partitionsspec"},(0,r.kt)("inlineCode",{parentName:"a"},"maxRowsPerSegment"))," or ",(0,r.kt)("a",{parentName:"p",href:"/docs/latest/ingestion/native-batch#tuningconfig"},(0,r.kt)("inlineCode",{parentName:"a"},"numShards")),"."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"}," You can run multiple compaction tasks in parallel. For example, if you want to compact the data for a year, you are not limited to running a single task for the entire year. You can run 12 compaction tasks with month-long intervals.")),(0,r.kt)("p",null,"A compaction task internally generates an ",(0,r.kt)("inlineCode",{parentName:"p"},"index")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"index_parallel")," task spec for performing compaction work with some fixed parameters. For example, its ",(0,r.kt)("inlineCode",{parentName:"p"},"inputSource")," is always the ",(0,r.kt)("a",{parentName:"p",href:"/docs/latest/ingestion/input-sources"},(0,r.kt)("inlineCode",{parentName:"a"},"druid")," input source"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"dimensionsSpec")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"metricsSpec")," include all dimensions and metrics of the input segments by default."),(0,r.kt)("p",null,"Compaction tasks typically fetch all ",(0,r.kt)("a",{parentName:"p",href:"#compaction-io-configuration"},"relevant segments")," prior to launching any subtasks, ",(0,r.kt)("em",{parentName:"p"},"unless")," the following properties are all set to non-null values. It is strongly recommended to set them to non-null values to maximize performance and minimize disk usage of the ",(0,r.kt)("inlineCode",{parentName:"p"},"compact")," task:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#compaction-granularity-spec"},(0,r.kt)("inlineCode",{parentName:"a"},"granularitySpec")),", with non-null values for each of ",(0,r.kt)("inlineCode",{parentName:"li"},"segmentGranularity"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"queryGranularity"),", and ",(0,r.kt)("inlineCode",{parentName:"li"},"rollup")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#compaction-dimensions-spec"},(0,r.kt)("inlineCode",{parentName:"a"},"dimensionsSpec"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"metricsSpec"))),(0,r.kt)("p",null,"Compaction tasks exit without doing anything and issue a failure status code in either of the following cases:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"If the interval you specify has no data segments loaded."),(0,r.kt)("li",{parentName:"ul"},"If the interval you specify is empty.")),(0,r.kt)("p",null,"Note that the metadata between input segments and the resulting compacted segments may differ if the metadata among the input segments differs as well. If all input segments have the same metadata, however, the resulting output segment will have the same metadata as all input segments."),(0,r.kt)("h2",{id:"manual-compaction-task-example"},"Manual compaction task example"),(0,r.kt)("p",null,"The following JSON illustrates a compaction task to compact ",(0,r.kt)("em",{parentName:"p"},"all segments")," within the interval ",(0,r.kt)("inlineCode",{parentName:"p"},"2020-01-01/2021-01-01")," and create new segments:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json"},'{\n "type": "compact",\n "dataSource": "wikipedia",\n "ioConfig": {\n "type": "compact",\n "inputSpec": {\n "type": "interval",\n "interval": "2020-01-01/2021-01-01"\n }\n },\n "granularitySpec": {\n "segmentGranularity": "day",\n "queryGranularity": "hour"\n }\n}\n')),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"granularitySpec")," is an optional field.\nIf you don't specify ",(0,r.kt)("inlineCode",{parentName:"p"},"granularitySpec"),", Druid retains the original segment and query granularities when compaction is complete."),(0,r.kt)("h2",{id:"compaction-io-configuration"},"Compaction I/O configuration"),(0,r.kt)("p",null,"The compaction ",(0,r.kt)("inlineCode",{parentName:"p"},"ioConfig")," requires specifying ",(0,r.kt)("inlineCode",{parentName:"p"},"inputSpec")," as follows:"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Field"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Default"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"type")),(0,r.kt)("td",{parentName:"tr",align:null},"Task type. Set the value to ",(0,r.kt)("inlineCode",{parentName:"td"},"compact"),"."),(0,r.kt)("td",{parentName:"tr",align:null},"none"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"inputSpec")),(0,r.kt)("td",{parentName:"tr",align:null},"Specification of the target ",(0,r.kt)("a",{parentName:"td",href:"#interval-inputspec"},"interval")," or ",(0,r.kt)("a",{parentName:"td",href:"#segments-inputspec"},"segments"),"."),(0,r.kt)("td",{parentName:"tr",align:null},"none"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"dropExisting")),(0,r.kt)("td",{parentName:"tr",align:null},"If ",(0,r.kt)("inlineCode",{parentName:"td"},"true"),", the task replaces all existing segments fully contained by either of the following:",(0,r.kt)("br",null),"- the ",(0,r.kt)("inlineCode",{parentName:"td"},"interval")," in the ",(0,r.kt)("inlineCode",{parentName:"td"},"interval")," type ",(0,r.kt)("inlineCode",{parentName:"td"},"inputSpec"),".",(0,r.kt)("br",null),"- the umbrella interval of the ",(0,r.kt)("inlineCode",{parentName:"td"},"segments")," in the ",(0,r.kt)("inlineCode",{parentName:"td"},"segment")," type ",(0,r.kt)("inlineCode",{parentName:"td"},"inputSpec"),".",(0,r.kt)("br",null),"If compaction fails, Druid does not change any of the existing segments.",(0,r.kt)("br",null),(0,r.kt)("strong",{parentName:"td"},"WARNING"),": ",(0,r.kt)("inlineCode",{parentName:"td"},"dropExisting")," in ",(0,r.kt)("inlineCode",{parentName:"td"},"ioConfig")," is a beta feature."),(0,r.kt)("td",{parentName:"tr",align:null},"false"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"allowNonAlignedInterval")),(0,r.kt)("td",{parentName:"tr",align:null},"If ",(0,r.kt)("inlineCode",{parentName:"td"},"true"),", the task allows an explicit ",(0,r.kt)("a",{parentName:"td",href:"#compaction-granularity-spec"},(0,r.kt)("inlineCode",{parentName:"a"},"segmentGranularity"))," that is not aligned with the provided ",(0,r.kt)("a",{parentName:"td",href:"#interval-inputspec"},"interval")," or ",(0,r.kt)("a",{parentName:"td",href:"#segments-inputspec"},"segments"),". This parameter is only used if ",(0,r.kt)("a",{parentName:"td",href:"#compaction-granularity-spec"},(0,r.kt)("inlineCode",{parentName:"a"},"segmentGranularity"))," is explicitly provided.",(0,r.kt)("br",null),(0,r.kt)("br",null),"This parameter is provided for backwards compatibility. In most scenarios it should not be set, as it can lead to data being accidentally overshadowed. This parameter may be removed in a future release."),(0,r.kt)("td",{parentName:"tr",align:null},"false"),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("p",null,"The compaction task has two kinds of ",(0,r.kt)("inlineCode",{parentName:"p"},"inputSpec"),":"),(0,r.kt)("h3",{id:"interval-inputspec"},"Interval ",(0,r.kt)("inlineCode",{parentName:"h3"},"inputSpec")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Field"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"type")),(0,r.kt)("td",{parentName:"tr",align:null},"Task type. Set the value to ",(0,r.kt)("inlineCode",{parentName:"td"},"interval"),"."),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"interval")),(0,r.kt)("td",{parentName:"tr",align:null},"Interval to compact."),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h3",{id:"segments-inputspec"},"Segments ",(0,r.kt)("inlineCode",{parentName:"h3"},"inputSpec")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Field"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"type")),(0,r.kt)("td",{parentName:"tr",align:null},"Task type. Set the value to ",(0,r.kt)("inlineCode",{parentName:"td"},"segments"),"."),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"segments")),(0,r.kt)("td",{parentName:"tr",align:null},"A list of segment IDs."),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h2",{id:"compaction-dimensions-spec"},"Compaction dimensions spec"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Field"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"dimensions")),(0,r.kt)("td",{parentName:"tr",align:null},"A list of dimension names or objects. Cannot have the same column in both ",(0,r.kt)("inlineCode",{parentName:"td"},"dimensions")," and ",(0,r.kt)("inlineCode",{parentName:"td"},"dimensionExclusions"),". Defaults to ",(0,r.kt)("inlineCode",{parentName:"td"},"null"),", which preserves the original dimensions."),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"dimensionExclusions")),(0,r.kt)("td",{parentName:"tr",align:null},"The names of dimensions to exclude from compaction. Only names are supported here, not objects. This list is only used if the dimensions list is null or empty; otherwise it is ignored. Defaults to ",(0,r.kt)("inlineCode",{parentName:"td"},"[]"),"."),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h2",{id:"compaction-transform-spec"},"Compaction transform spec"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Field"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"filter")),(0,r.kt)("td",{parentName:"tr",align:null},"The ",(0,r.kt)("inlineCode",{parentName:"td"},"filter")," conditionally filters input rows during compaction. Only rows that pass the filter will be included in the compacted segments. Any of Druid's standard ",(0,r.kt)("a",{parentName:"td",href:"/docs/latest/querying/filters"},"query filters")," can be used. Defaults to 'null', which will not filter any row."),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h2",{id:"compaction-granularity-spec"},"Compaction granularity spec"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Field"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"segmentGranularity")),(0,r.kt)("td",{parentName:"tr",align:null},"Time chunking period for the segment granularity. Defaults to 'null', which preserves the original segment granularity. Accepts all ",(0,r.kt)("a",{parentName:"td",href:"/docs/latest/querying/granularities"},"Query granularity")," values."),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"queryGranularity")),(0,r.kt)("td",{parentName:"tr",align:null},"The resolution of timestamp storage within each segment. Defaults to 'null', which preserves the original query granularity. Accepts all ",(0,r.kt)("a",{parentName:"td",href:"/docs/latest/querying/granularities"},"Query granularity")," values."),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"rollup")),(0,r.kt)("td",{parentName:"tr",align:null},"Enables compaction-time rollup. To preserve the original setting, keep the default value. To enable compaction-time rollup, set the value to ",(0,r.kt)("inlineCode",{parentName:"td"},"true"),". Once the data is rolled up, you can no longer recover individual records."),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h2",{id:"learn-more"},"Learn more"),(0,r.kt)("p",null,"See the following topics for more information:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/latest/data-management/compaction"},"Compaction")," for an overview of compaction and how to set up manual compaction in Druid."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/latest/operations/segment-optimization"},"Segment optimization")," for guidance on evaluating and optimizing Druid segment size."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/latest/design/coordinator#automatic-compaction"},"Coordinator process")," for details on how the Coordinator plans compaction tasks.")))}k.isMDXComponent=!0}}]);