Skip to content

Conversation

@xiaochen-zhou
Copy link
Contributor

Purpose of this pull request

Support like predicate pushdown in paimon

Does this PR introduce any user-facing change?

No

How was this patch tested?

Add new tests

Check list

This comment was marked as outdated.

@Hisoka-X
Copy link
Member

cc @hawk9821 as well.

Copy link
Member

@Hisoka-X Hisoka-X left a comment

Choose a reason for hiding this comment

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

Please update the docs.

@xiaochen-zhou
Copy link
Contributor Author

Please update the docs.

OK.

Object rightVal =
convertValueByPaimonDataType(rowType, column.getColumnName(), rightPredicate);

Pattern BEGIN_PATTERN = Pattern.compile("([^%]+)%");
Copy link
Contributor

Choose a reason for hiding this comment

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

%keyword% not supported . I think should be printe some logs or throw exception.

@github-actions github-actions bot added the e2e label Jun 25, 2025

The filter condition of the table read. For example: `select * from st_test where id > 100`. If not specified, all rows are read.
Currently, where conditions only support <, <=, >, >=, =, !=, or, and,is null, is not null, between...and, in, not in, and others are not supported.
Currently, where conditions only support <, <=, >, >=, =, !=, or, and,is null, is not null, between...and, in, not in, like(only support startWith) ,and others are not supported.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Currently, where conditions only support <, <=, >, >=, =, !=, or, and,is null, is not null, between...and, in, not in, like(only support startWith) ,and others are not supported.
Currently, where conditions only support <, <=, >, >=, =, !=, or, and,is null, is not null, between...and, in, not in, like(pattern matching with prefix only) ,and others are not supported.

读取表格的筛选条件,例如:`select * from st_test where id > 100`。如果未指定,则将读取所有记录。

目前,`where` 支持`<, <=, >, >=, =, !=, or, and,is null, is not null, between...and, in , not in`,其他暂不支持。
目前,`where` 支持`<, <=, >, >=, =, !=, or, and,is null, is not null, between...and, in , not in, like(only support startWith)`,其他暂不支持。
Copy link
Member

Choose a reason for hiding this comment

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

ditto

return builder.startsWith(columnIndex, BinaryString.fromString(matcher.group(1)));
} else {
throw new IllegalArgumentException(
"Unsupported expression type: "
Copy link
Member

Choose a reason for hiding this comment

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

ditto

@nielifeng nielifeng requested a review from Copilot June 26, 2025 02:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request adds support for like predicate pushdown in Paimon by enhancing the SQL predicate conversion logic, updating end-to-end tests, and revising documentation.

  • Enhanced SQL to Paimon predicate conversion to support prefix matching via the LIKE operator.
  • Introduced new end-to-end tests to validate the functionality.
  • Updated documentation (both English and Chinese) to reflect supported where clause conditions.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-paimon-e2e/src/test/resources/paimon_to_assert_with_filter8.conf New test configuration file for LIKE predicate tests
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-paimon-e2e/src/test/java/org/apache/seatunnel/e2e/connector/paimon/PaimonSinkCDCIT.java Added test execution for new filter config; increased wait durations
seatunnel-connectors-v2/connector-paimon/src/test/java/org/apache/seatunnel/connectors/seatunnel/paimon/source/converter/SqlToPaimonConverterTest.java Added test validating LIKE predicate conversion for prefix matching
seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/source/converter/SqlToPaimonPredicateConverter.java Updated SQL predicate converter to handle LIKE expressions with prefix matching
docs/zh/connector-v2/source/Paimon.md, docs/en/connector-v2/source/Paimon.md Updated documentation to include support for like (prefix matching) in the where clause

container.executeJob("/changelog_fake_cdc_sink_paimon_case1_ddl.conf");
Assertions.assertEquals(0, writeResult.getExitCode());
TimeUnit.SECONDS.sleep(20);
TimeUnit.SECONDS.sleep(120);
Copy link

Copilot AI Jun 26, 2025

Choose a reason for hiding this comment

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

The increased sleep duration to 120 seconds may unnecessarily prolong test execution; consider using a condition-based waiting mechanism to detect readiness instead of a fixed sleep.

Suggested change
TimeUnit.SECONDS.sleep(120);
given().ignoreExceptions()
.await()
.atMost(120, TimeUnit.SECONDS)
.untilAsserted(() -> {
// Check readiness condition
Container.ExecResult readinessCheck =
container.executeJob("/changelog_fake_cdc_sink_paimon_case1_readiness_check.conf");
Assertions.assertEquals(0, readinessCheck.getExitCode());
});

Copilot uses AI. Check for mistakes.
Object rightVal =
convertValueByPaimonDataType(rowType, column.getColumnName(), rightPredicate);

Pattern BEGIN_PATTERN = Pattern.compile("([^%]+)%");
Copy link

Copilot AI Jun 26, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider defining the compiled pattern as a static final constant to avoid recompiling it on each method invocation, which can improve performance and readability.

Suggested change
Pattern BEGIN_PATTERN = Pattern.compile("([^%]+)%");

Copilot uses AI. Check for mistakes.
throw new IllegalArgumentException(
"Unsupported expression type: "
+ expression.getClass().getSimpleName()
+ ", only support LikeExpression with 'startWith' pattern ");
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
+ ", only support LikeExpression with 'startWith' pattern ");
+ ", only support LikeExpression pattern matching with prefix");

@xiaochen-zhou
Copy link
Contributor Author

@Hisoka-X @hawk9821 done.

Copy link
Member

@Hisoka-X Hisoka-X left a comment

Choose a reason for hiding this comment

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

LGTM. But we should waiting #9467 be merged first.

@Hisoka-X
Copy link
Member

Hisoka-X commented Jul 2, 2025

Hi @xiaochen-zhou . Please rebase on dev to retrigger ci. Thanks

@corgy-w corgy-w merged commit a19720c into apache:dev Jul 4, 2025
5 checks passed
dybyte pushed a commit to dybyte/seatunnel that referenced this pull request Jul 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants