@@ -75,6 +75,8 @@ public static Builder builder()
7575 @ Nullable
7676 private final NestedCommonFormatColumnFormatSpec autoColumnFormatSpec ;
7777 @ Nullable
78+ private final StringColumnFormatSpec stringColumnFormatSpec ;
79+ @ Nullable
7880 private final CompressionStrategy metadataCompression ;
7981
8082 /**
@@ -109,6 +111,8 @@ public static Builder builder()
109111 * used to load the written segment
110112 * @param autoColumnFormatSpec specify the default {@link NestedCommonFormatColumnFormatSpec} to use for json and
111113 * auto columns. Defaults to null upon calling {@link #getEffectiveSpec()}.
114+ * @param stringColumnFormatSpec specify the default {@link StringColumnFormatSpec} to use for string columns.
115+ * Defaults to null upon calling {@link #getEffectiveSpec()}.
112116 */
113117 @ JsonCreator
114118 public IndexSpec (
@@ -121,7 +125,8 @@ public IndexSpec(
121125 @ JsonProperty ("complexMetricCompression" ) @ Nullable CompressionStrategy complexMetricCompression ,
122126 @ Deprecated @ JsonProperty ("jsonCompression" ) @ Nullable CompressionStrategy jsonCompression ,
123127 @ JsonProperty ("segmentLoader" ) @ Nullable SegmentizerFactory segmentLoader ,
124- @ JsonProperty ("autoColumnFormatSpec" ) @ Nullable NestedCommonFormatColumnFormatSpec autoColumnFormatSpec
128+ @ JsonProperty ("autoColumnFormatSpec" ) @ Nullable NestedCommonFormatColumnFormatSpec autoColumnFormatSpec ,
129+ @ JsonProperty ("stringColumnFormatSpec" ) @ Nullable StringColumnFormatSpec stringColumnFormatSpec
125130 )
126131 {
127132 this .bitmapSerdeFactory = bitmapSerdeFactory ;
@@ -134,6 +139,7 @@ public IndexSpec(
134139 this .jsonCompression = jsonCompression ;
135140 this .segmentLoader = segmentLoader ;
136141 this .autoColumnFormatSpec = autoColumnFormatSpec ;
142+ this .stringColumnFormatSpec = stringColumnFormatSpec ;
137143 }
138144
139145 @ JsonProperty ("bitmap" )
@@ -212,6 +218,14 @@ public NestedCommonFormatColumnFormatSpec getAutoColumnFormatSpec()
212218 return autoColumnFormatSpec ;
213219 }
214220
221+ @ JsonProperty
222+ @ JsonInclude (JsonInclude .Include .NON_NULL )
223+ @ Nullable
224+ public StringColumnFormatSpec getStringColumnFormatSpec ()
225+ {
226+ return stringColumnFormatSpec ;
227+ }
228+
215229 /**
216230 * Populate all null fields of {@link IndexSpec}, first from {@link #getDefault()} and finally falling back to hard
217231 * coded defaults if no overrides are defined.
@@ -298,6 +312,16 @@ public IndexSpec getEffectiveSpec()
298312 );
299313 }
300314
315+ if (stringColumnFormatSpec != null ) {
316+ bob .withStringColumnFormatSpec (
317+ StringColumnFormatSpec .getEffectiveFormatSpec (stringColumnFormatSpec , this )
318+ );
319+ } else if (defaultSpec .stringColumnFormatSpec != null ) {
320+ bob .withStringColumnFormatSpec (
321+ StringColumnFormatSpec .getEffectiveFormatSpec (defaultSpec .stringColumnFormatSpec , this )
322+ );
323+ }
324+
301325 return bob .build ();
302326 }
303327
@@ -320,7 +344,8 @@ public boolean equals(Object o)
320344 Objects .equals (complexMetricCompression , indexSpec .complexMetricCompression ) &&
321345 Objects .equals (jsonCompression , indexSpec .jsonCompression ) &&
322346 Objects .equals (segmentLoader , indexSpec .segmentLoader ) &&
323- Objects .equals (autoColumnFormatSpec , indexSpec .autoColumnFormatSpec );
347+ Objects .equals (autoColumnFormatSpec , indexSpec .autoColumnFormatSpec ) &&
348+ Objects .equals (stringColumnFormatSpec , indexSpec .stringColumnFormatSpec );
324349 }
325350
326351 @ Override
@@ -336,7 +361,8 @@ public int hashCode()
336361 complexMetricCompression ,
337362 jsonCompression ,
338363 segmentLoader ,
339- autoColumnFormatSpec
364+ autoColumnFormatSpec ,
365+ stringColumnFormatSpec
340366 );
341367 }
342368
@@ -352,6 +378,7 @@ public String toString()
352378 ", longEncoding=" + longEncoding +
353379 ", complexMetricCompression=" + complexMetricCompression +
354380 ", autoColumnFormatSpec=" + autoColumnFormatSpec +
381+ ", stringColumnFormatSpec=" + stringColumnFormatSpec +
355382 ", jsonCompression=" + jsonCompression +
356383 ", segmentLoader=" + segmentLoader +
357384 '}' ;
@@ -379,6 +406,8 @@ public static class Builder
379406 private SegmentizerFactory segmentLoader ;
380407 @ Nullable
381408 private NestedCommonFormatColumnFormatSpec autoColumnFormatSpec ;
409+ @ Nullable
410+ private StringColumnFormatSpec stringColumnFormatSpec ;
382411
383412 public Builder withBitmapSerdeFactory (@ Nullable BitmapSerdeFactory bitmapSerdeFactory )
384413 {
@@ -441,6 +470,12 @@ public Builder withAutoColumnFormatSpec(@Nullable NestedCommonFormatColumnFormat
441470 return this ;
442471 }
443472
473+ public Builder withStringColumnFormatSpec (@ Nullable StringColumnFormatSpec stringColumnFormatSpec )
474+ {
475+ this .stringColumnFormatSpec = stringColumnFormatSpec ;
476+ return this ;
477+ }
478+
444479 public IndexSpec build ()
445480 {
446481 return new IndexSpec (
@@ -453,7 +488,8 @@ public IndexSpec build()
453488 complexMetricCompression ,
454489 jsonCompression ,
455490 segmentLoader ,
456- autoColumnFormatSpec
491+ autoColumnFormatSpec ,
492+ stringColumnFormatSpec
457493 );
458494 }
459495 }
0 commit comments