Hisoka-X commented on code in PR #9484:
URL: https://github.com/apache/seatunnel/pull/9484#discussion_r2166734688
##########
docs/zh/connector-v2/source/Paimon.md:
##########
@@ -59,7 +59,7 @@ Paimon 的 catalog uri,仅当 catalog_type 为 hive 时需要
读取表格的筛选条件,例如:`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)`,其他暂不支持。
Review Comment:
ditto
##########
docs/en/connector-v2/source/Paimon.md:
##########
@@ -58,7 +58,7 @@ The file path of `hdfs-site.xml`
### query [string]
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.
Review Comment:
```suggestion
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.
```
##########
seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/source/converter/SqlToPaimonPredicateConverter.java:
##########
@@ -241,6 +244,24 @@ private static Predicate parseExpressionToPredicate(
Object paimonEndVal =
convertValueByPaimonDataType(rowType,
column.getColumnName(), jsqlEndVal);
return builder.between(columnIndex, paimonStartVal, paimonEndVal);
+ } else if (expression instanceof LikeExpression) {
+ LikeExpression like = (LikeExpression) expression;
+ Column column = (Column) like.getLeftExpression();
+ int columnIndex = getColumnIndex(builder, column);
+ Object rightPredicate =
getJSQLParserDataTypeValue(like.getRightExpression());
+ Object rightVal =
+ convertValueByPaimonDataType(rowType,
column.getColumnName(), rightPredicate);
+
+ Pattern BEGIN_PATTERN = Pattern.compile("([^%]+)%");
+ Matcher matcher = BEGIN_PATTERN.matcher(rightVal.toString());
+ if (matcher.matches()) {
+ return builder.startsWith(columnIndex,
BinaryString.fromString(matcher.group(1)));
+ } else {
+ throw new IllegalArgumentException(
+ "Unsupported expression type: "
Review Comment:
ditto
--
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]