-
Notifications
You must be signed in to change notification settings - Fork 3.8k
refactor: adds StringColumnFormatSpec for string dimension configs #19258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,6 +75,8 @@ public static Builder builder() | |
| @Nullable | ||
| private final NestedCommonFormatColumnFormatSpec autoColumnFormatSpec; | ||
| @Nullable | ||
| private final StringColumnFormatSpec stringColumnFormatSpec; | ||
| @Nullable | ||
| private final CompressionStrategy metadataCompression; | ||
|
|
||
| /** | ||
|
|
@@ -109,6 +111,8 @@ public static Builder builder() | |
| * used to load the written segment | ||
| * @param autoColumnFormatSpec specify the default {@link NestedCommonFormatColumnFormatSpec} to use for json and | ||
| * auto columns. Defaults to null upon calling {@link #getEffectiveSpec()}. | ||
| * @param stringColumnFormatSpec specify the default {@link StringColumnFormatSpec} to use for string columns. | ||
| * Defaults to null upon calling {@link #getEffectiveSpec()}. | ||
| */ | ||
| @JsonCreator | ||
| public IndexSpec( | ||
|
|
@@ -121,7 +125,8 @@ public IndexSpec( | |
| @JsonProperty("complexMetricCompression") @Nullable CompressionStrategy complexMetricCompression, | ||
| @Deprecated @JsonProperty("jsonCompression") @Nullable CompressionStrategy jsonCompression, | ||
| @JsonProperty("segmentLoader") @Nullable SegmentizerFactory segmentLoader, | ||
| @JsonProperty("autoColumnFormatSpec") @Nullable NestedCommonFormatColumnFormatSpec autoColumnFormatSpec | ||
| @JsonProperty("autoColumnFormatSpec") @Nullable NestedCommonFormatColumnFormatSpec autoColumnFormatSpec, | ||
| @JsonProperty("stringColumnFormatSpec") @Nullable StringColumnFormatSpec stringColumnFormatSpec | ||
| ) | ||
| { | ||
| this.bitmapSerdeFactory = bitmapSerdeFactory; | ||
|
|
@@ -134,6 +139,7 @@ public IndexSpec( | |
| this.jsonCompression = jsonCompression; | ||
| this.segmentLoader = segmentLoader; | ||
| this.autoColumnFormatSpec = autoColumnFormatSpec; | ||
| this.stringColumnFormatSpec = stringColumnFormatSpec; | ||
| } | ||
|
|
||
| @JsonProperty("bitmap") | ||
|
|
@@ -212,6 +218,14 @@ public NestedCommonFormatColumnFormatSpec getAutoColumnFormatSpec() | |
| return autoColumnFormatSpec; | ||
| } | ||
|
|
||
| @JsonProperty | ||
| @JsonInclude(JsonInclude.Include.NON_NULL) | ||
| @Nullable | ||
| public StringColumnFormatSpec getStringColumnFormatSpec() | ||
| { | ||
| return stringColumnFormatSpec; | ||
| } | ||
|
|
||
| /** | ||
| * Populate all null fields of {@link IndexSpec}, first from {@link #getDefault()} and finally falling back to hard | ||
| * coded defaults if no overrides are defined. | ||
|
|
@@ -298,6 +312,16 @@ public IndexSpec getEffectiveSpec() | |
| ); | ||
| } | ||
|
|
||
| if (stringColumnFormatSpec != null) { | ||
| bob.withStringColumnFormatSpec( | ||
| StringColumnFormatSpec.getEffectiveFormatSpec(stringColumnFormatSpec, this) | ||
| ); | ||
| } else if (defaultSpec.stringColumnFormatSpec != null) { | ||
| bob.withStringColumnFormatSpec( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this needed? stringColumnFormatSpec is always null in the defaultSpec
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see a similar pattern for other properties but I don't think it's actually needed in this case |
||
| StringColumnFormatSpec.getEffectiveFormatSpec(defaultSpec.stringColumnFormatSpec, this) | ||
| ); | ||
| } | ||
|
|
||
| return bob.build(); | ||
| } | ||
|
|
||
|
|
@@ -320,7 +344,8 @@ public boolean equals(Object o) | |
| Objects.equals(complexMetricCompression, indexSpec.complexMetricCompression) && | ||
| Objects.equals(jsonCompression, indexSpec.jsonCompression) && | ||
| Objects.equals(segmentLoader, indexSpec.segmentLoader) && | ||
| Objects.equals(autoColumnFormatSpec, indexSpec.autoColumnFormatSpec); | ||
| Objects.equals(autoColumnFormatSpec, indexSpec.autoColumnFormatSpec) && | ||
| Objects.equals(stringColumnFormatSpec, indexSpec.stringColumnFormatSpec); | ||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -336,7 +361,8 @@ public int hashCode() | |
| complexMetricCompression, | ||
| jsonCompression, | ||
| segmentLoader, | ||
| autoColumnFormatSpec | ||
| autoColumnFormatSpec, | ||
| stringColumnFormatSpec | ||
| ); | ||
| } | ||
|
|
||
|
|
@@ -352,6 +378,7 @@ public String toString() | |
| ", longEncoding=" + longEncoding + | ||
| ", complexMetricCompression=" + complexMetricCompression + | ||
| ", autoColumnFormatSpec=" + autoColumnFormatSpec + | ||
| ", stringColumnFormatSpec=" + stringColumnFormatSpec + | ||
| ", jsonCompression=" + jsonCompression + | ||
| ", segmentLoader=" + segmentLoader + | ||
| '}'; | ||
|
|
@@ -379,6 +406,8 @@ public static class Builder | |
| private SegmentizerFactory segmentLoader; | ||
| @Nullable | ||
| private NestedCommonFormatColumnFormatSpec autoColumnFormatSpec; | ||
| @Nullable | ||
| private StringColumnFormatSpec stringColumnFormatSpec; | ||
|
|
||
| public Builder withBitmapSerdeFactory(@Nullable BitmapSerdeFactory bitmapSerdeFactory) | ||
| { | ||
|
|
@@ -441,6 +470,12 @@ public Builder withAutoColumnFormatSpec(@Nullable NestedCommonFormatColumnFormat | |
| return this; | ||
| } | ||
|
|
||
| public Builder withStringColumnFormatSpec(@Nullable StringColumnFormatSpec stringColumnFormatSpec) | ||
| { | ||
| this.stringColumnFormatSpec = stringColumnFormatSpec; | ||
| return this; | ||
| } | ||
|
|
||
| public IndexSpec build() | ||
| { | ||
| return new IndexSpec( | ||
|
|
@@ -453,7 +488,8 @@ public IndexSpec build() | |
| complexMetricCompression, | ||
| jsonCompression, | ||
| segmentLoader, | ||
| autoColumnFormatSpec | ||
| autoColumnFormatSpec, | ||
| stringColumnFormatSpec | ||
| ); | ||
| } | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving a comment so I can revisit this tomorrow. Why do we only pass in maxStringLength here, but use parent defaults for createBitmapIndex/multiValueHandling?