Skip to content

Conversation

@tsreaper
Copy link
Contributor

Filter pushdown is a critical optimization for sources as it can decrease number of records to read. Hive provides a HiveStoragePredicateHandler interface for this purpose. We need to implement this interface in TableStoreHiveStorageHandler.

Copy link
Contributor

@JingsongLi JingsongLi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution, left some comments.

public Optional<Predicate> convert() {
try {
return Optional.of(convertTree(tree));
} catch (Throwable t) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to catch a specific exception to avoid unexpected bugs.

private static final Logger LOG =
LoggerFactory.getLogger(SearchArgumentToPredicateConverter.class);

private final ExpressionTree tree;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename tree to root?
There are several places where the exception reference to tree is wrong, and the same name tends to cause this problem

}
}

private Predicate convertNotTree(ExpressionTree tree) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think negate logical for not should in flink-table-store-core.

Preconditions.checkArgument(idx >= 0, "Column " + columnName + " not found.");
LogicalType columnType = columnTypes.get(idx);
switch (leaf.getOperator()) {
case EQUALS:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto (I think negate logical for not should in flink-table-store-core.)

} else {
return FileStoreImpl.createWithValueCount(
tableLocation, new FileStoreOptions(options), user, partitionType, rowType);
private static class FileStoreWrapper {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should have a FileStoreFactory in flink-table-store-core after #101
Then we can create Predicate from that. (Maybe get row type from it)

Copy link
Contributor

@JingsongLi JingsongLi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@JingsongLi JingsongLi merged commit 660e72b into apache:master May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants