Skip to content
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

read metadata in SimpleQueryableIndex if available to compute segment ordering #17181

Merged
merged 1 commit into from
Sep 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public abstract class SimpleQueryableIndex implements QueryableIndex
private final Map<String, Supplier<ColumnHolder>> columns;
private final SmooshedFileMapper fileMapper;
private final Supplier<Map<String, DimensionHandler>> dimensionHandlers;
private final List<OrderBy> ordering;

public SimpleQueryableIndex(
Interval dataInterval,
Expand Down Expand Up @@ -83,6 +84,14 @@ public SimpleQueryableIndex(
} else {
this.dimensionHandlers = () -> initDimensionHandlers(availableDimensions);
}

final Metadata metadata = getMetadata();
if (metadata != null && metadata.getOrdering() != null) {
this.ordering = metadata.getOrdering();
} else {
// When sort order isn't set in metadata.drd, assume the segment is sorted by __time.
this.ordering = Cursors.ascendingTimeOrder();
}
}

@Override
Expand Down Expand Up @@ -112,13 +121,7 @@ public Indexed<String> getAvailableDimensions()
@Override
public List<OrderBy> getOrdering()
{
final Metadata metadata = getMetadata();
if (metadata != null && metadata.getOrdering() != null) {
return metadata.getOrdering();
} else {
// When sort order isn't set in metadata.drd, assume the segment is sorted by __time.
return Cursors.ascendingTimeOrder();
}
return ordering;
}

@Override
Expand Down
Loading