Skip to content

Commit

Permalink
Fix default column handling when forward index is disabled (#14215)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackie-Jiang authored Oct 14, 2024
1 parent b067ae1 commit 095c166
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 243 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ public class IndexLoadingConfig {
private final Map<String, String> _noDictionaryConfig = new HashMap<>();
private final Set<String> _varLengthDictionaryColumns = new HashSet<>();
private Set<String> _onHeapDictionaryColumns = new HashSet<>();
private final Set<String> _forwardIndexDisabledColumns = new HashSet<>();
private Map<String, BloomFilterConfig> _bloomFilterConfigs = new HashMap<>();
private boolean _enableDynamicStarTreeCreation;
private List<StarTreeIndexConfig> _starTreeIndexConfigs;
Expand Down Expand Up @@ -540,10 +539,6 @@ public Set<String> getOnHeapDictionaryColumns() {
return unmodifiable(_onHeapDictionaryColumns);
}

public Set<String> getForwardIndexDisabledColumns() {
return unmodifiable(_forwardIndexDisabledColumns);
}

public Map<String, BloomFilterConfig> getBloomFilterConfigs() {
return unmodifiable(_bloomFilterConfigs);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ protected boolean createColumnV1Indices(String column)
}

// TODO: Support forward index disabled derived column
if (_indexLoadingConfig.getForwardIndexDisabledColumns().contains(column)) {
if (isForwardIndexDisabled(column)) {
LOGGER.warn("Skip creating forward index disabled derived column: {}", column);
if (errorOnFailure) {
throw new UnsupportedOperationException(
Expand Down Expand Up @@ -443,8 +443,8 @@ protected boolean createColumnV1Indices(String column)
* Check and return whether the forward index is disabled for a given column
*/
protected boolean isForwardIndexDisabled(String column) {
return _indexLoadingConfig.getForwardIndexDisabledColumns() != null
&& _indexLoadingConfig.getForwardIndexDisabledColumns().contains(column);
FieldIndexConfigs fieldIndexConfig = _indexLoadingConfig.getFieldIndexConfig(column);
return fieldIndexConfig != null && fieldIndexConfig.getConfig(StandardIndexes.forward()).isDisabled();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ private void validateIndex(IndexType<?, ?, ?> indexType, String column, int card
assertFalse(reader.hasIndexFor(column, StandardIndexes.inverted()));
} else {
// Updating dictionary or forward index for existing columns not supported for v1 segments yet
if (segmentMetadata.getVersion() == SegmentVersion.v3) {
if (segmentMetadata.getVersion() == SegmentVersion.v3 || isAutoGenerated) {
assertFalse(reader.hasIndexFor(column, StandardIndexes.forward()));
} else {
assertTrue(reader.hasIndexFor(column, StandardIndexes.forward()));
Expand Down

This file was deleted.

Loading

0 comments on commit 095c166

Please sign in to comment.