-
Notifications
You must be signed in to change notification settings - Fork 29
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
FMWK-196 Index Cardinality #657
Conversation
|
||
// If index with min bin values ratio found, set filter with the matching qualifier | ||
if (minBinValuesRatioQualifier != null) { | ||
Filter filter = minBinValuesRatioQualifier.setQueryAsFilter(); |
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.
The setFilterFromSingleQualifier
method can be reused here.
if (minBinValuesRatio.isPresent()) { | ||
return minBinValuesRatio.get().getBinValuesRatio(); | ||
} | ||
return 0; |
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.
refactor to:
return minBinValuesRatio.map(Index::getBinValuesRatio).orElse(0);
private final IndexCollectionType indexCollectionType; | ||
private final CTX[] ctx; | ||
@Setter | ||
private Integer binValuesRatio; |
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.
Can be int
?
@@ -37,6 +44,8 @@ public class InternalIndexOperations { | |||
|
|||
private final IndexInfoParser indexInfoParser; | |||
|
|||
private final Logger log = LoggerFactory.getLogger(InternalIndexOperations.class); |
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.
Use the @Slf4j
annotation instead.
int currBinValuesRatio = getMinBinValuesRatioForQualifier(stmt, innerQualifier); | ||
// Compare the cardinality of each qualifier and select the qualifier that has the index with | ||
// the lowest bin values ratio | ||
if (currBinValuesRatio < minBinValuesRatio && currBinValuesRatio != 0) { |
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.
I would move currBinValuesRatio != 0
to be first in this statement.
.collect(Collectors.toMap(t -> t.get(0), t -> t.get(1))) | ||
.get("entries_per_bval")); | ||
} catch (Exception e) { | ||
log.warn("Failed to fetch secondary index %s cardinality".formatted(indexName), e); |
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.
Use
log.warn("Failed to fetch secondary index {} cardinality", indexName, e);
instead.
2. Reuse methods, avoid code duplication
…plify conditions
No description provided.