somandal commented on code in PR #10260:
URL: https://github.com/apache/pinot/pull/10260#discussion_r1115197451
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/loader/ForwardIndexHandler.java:
##########
@@ -110,86 +109,81 @@ public ForwardIndexHandler(SegmentDirectory
segmentDirectory, IndexLoadingConfig
@Override
public boolean needUpdateIndices(SegmentDirectory.Reader segmentReader)
throws Exception {
- Map<String, Operation> columnOperationMap =
computeOperation(segmentReader);
- return !columnOperationMap.isEmpty();
+ Map<String, List<Operation>> columnOperationsMap =
computeOperations(segmentReader);
+ return !columnOperationsMap.isEmpty();
}
@Override
public void updateIndices(SegmentDirectory.Writer segmentWriter,
IndexCreatorProvider indexCreatorProvider)
throws Exception {
- Map<String, Operation> columnOperationMap =
computeOperation(segmentWriter);
- if (columnOperationMap.isEmpty()) {
+ Map<String, List<Operation>> columnOperationsMap =
computeOperations(segmentWriter);
+ if (columnOperationsMap.isEmpty()) {
return;
}
- for (Map.Entry<String, Operation> entry : columnOperationMap.entrySet()) {
+ for (Map.Entry<String, List<Operation>> entry :
columnOperationsMap.entrySet()) {
String column = entry.getKey();
- Operation operation = entry.getValue();
-
- switch (operation) {
- case DISABLE_FORWARD_INDEX_FOR_DICT_COLUMN: {
- // Deletion of the forward index will be handled outside the index
handler to ensure that other index
- // handlers that need the forward index to construct their own
indexes will have it available.
- // The existing forward index must be in dictionary format for this
to be a no-op.
- _tmpForwardIndexColumns.add(column);
- break;
- }
- case DISABLE_FORWARD_INDEX_FOR_RAW_COLUMN: {
- // The forward index has been disabled for a column which has a
noDictionary based forward index. A dictionary
- // and inverted index need to be created before we can delete the
forward index. We create a dictionary here,
- // but let the InvertedIndexHandler handle the creation of the
inverted index. We create a temporary
- // forward index here which is dictionary based and allow the post
deletion step handle the actual deletion
- // of the forward index.
- createDictBasedForwardIndex(column, segmentWriter,
indexCreatorProvider);
- if (!segmentWriter.hasIndexFor(column,
ColumnIndexType.FORWARD_INDEX)) {
- throw new IOException(String.format("Temporary forward index was
not created for column: %s", column));
- }
- _tmpForwardIndexColumns.add(column);
- break;
- }
- case ENABLE_FORWARD_INDEX_FOR_DICT_COLUMN: {
- createForwardIndexIfNeeded(segmentWriter, column,
indexCreatorProvider, false);
- if (!segmentWriter.hasIndexFor(column, ColumnIndexType.DICTIONARY)) {
- throw new IOException(
- String.format("Dictionary should still exist after rebuilding
forward index for dictionary column: %s",
- column));
- }
- break;
- }
- case ENABLE_FORWARD_INDEX_FOR_RAW_COLUMN: {
- createForwardIndexIfNeeded(segmentWriter, column,
indexCreatorProvider, false);
- if (segmentWriter.hasIndexFor(column, ColumnIndexType.DICTIONARY)) {
- throw new IOException(
- String.format("Dictionary should not exist after rebuilding
forward index for raw column: %s", column));
- }
- break;
+ List<Operation> operations = entry.getValue();
+
+ for (Operation operation : operations) {
+ switch (operation) {
+ case DISABLE_FORWARD_INDEX:
+ // Deletion of the forward index will be handled outside the index
handler to ensure that other index
+ // handlers that need the forward index to construct their own
indexes will have it available.
+ _tmpForwardIndexColumns.add(column);
+ break;
+ case ENABLE_FORWARD_INDEX:
+ ColumnMetadata columnMetadata =
createForwardIndexIfNeeded(segmentWriter, column, indexCreatorProvider,
+ false);
+ if (columnMetadata.hasDictionary()) {
+ if (!segmentWriter.hasIndexFor(column,
ColumnIndexType.DICTIONARY)) {
+ throw new IOException(String.format("Dictionary should still
exist after rebuilding forward index "
Review Comment:
done
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/creator/impl/DefaultIndexCreatorProvider.java:
##########
@@ -76,6 +75,10 @@ public ForwardIndexCreator
newForwardIndexCreator(IndexCreationContext.Forward c
throws Exception {
if (!context.hasDictionary()) {
// Dictionary disabled columns
+ if (context.forwardIndexDisabled()) {
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]