Hisoka-X commented on code in PR #9095: URL: https://github.com/apache/seatunnel/pull/9095#discussion_r2040535485
########## seatunnel-e2e/seatunnel-connector-v2-e2e/connector-iceberg-e2e/src/test/resources/iceberg/filter_iceberg_source.conf: ########## @@ -0,0 +1,108 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +###### +###### This config file is a demonstration of streaming processing in seatunnel config +###### + +env { + parallelism = 2 + job.mode = "BATCH" +} + +source { + Iceberg { + schema { + fields { + f2 = "boolean" + f1 = "bigint" + f3 = "int" + f4 = "bigint" + f5 = "float" + f6 = "double" + f7 = "date" + f9 = "timestamp" + f10 = "timestamp" + f11 = "string" + f12 = "bytes" + f13 = "bytes" + f14 = "decimal(19,9)" + f15 = "array<int>" + f16 = "map<string, int>" + } + } + catalog_name = "seatunnel" + iceberg.catalog.config={ + "type"="hadoop" + "warehouse"="file:///tmp/seatunnel/iceberg/hadoop/" + } + namespace = "database1" + table = "source" + plugin_output = "iceberg" + query = "select f1, f2 from t where f1 = 10" + } +} + +transform { +} + +sink { + Assert { + plugin_input = "iceberg" + rules = + { + row_rules = [ + { + rule_type = MAX_ROW + rule_value = 1 + } + { + rule_type = MIN_ROW + rule_value = 1 + } + ] + field_rules = [ + { + field_name = f1 + field_type = bigint + field_value = [ + { + rule_type = NOT_NULL + }, + { + rule_type = MIN + rule_value = 10 + }, + { + rule_type = MAX + rule_value = 10 + } Review Comment: ```suggestion ``` field_rules doesn't support this. ########## seatunnel-connectors-v2/connector-iceberg/src/main/java/org/apache/seatunnel/connectors/seatunnel/iceberg/config/IcebergSourceConfig.java: ########## @@ -22,13 +22,15 @@ import lombok.Getter; import lombok.ToString; +import lombok.extern.java.Log; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; @Getter @ToString +@Log Review Comment: I did not found any code to use log in this class. ########## seatunnel-connectors-v2/connector-iceberg/src/main/java/org/apache/seatunnel/connectors/seatunnel/iceberg/utils/ExpressionUtils.java: ########## @@ -199,6 +234,17 @@ public static Expression convert( } return Expressions.equal(column.getColumnName(), booleanExpression.isTrue()); } + if (condition instanceof LikeExpression) { + LikeExpression expr = (LikeExpression) condition; + String columnName = ((Column) expr.getLeftExpression()).getColumnName(); + String value = ((StringValue) expr.getRightExpression()).getValue(); + LikeExpression.KeyWord keyWord = expr.getLikeKeyWord(); + if (keyWord == LikeExpression.KeyWord.LIKE) { + return Expressions.startsWith(columnName, value); Review Comment: Can we not support like start with `%` now? ########## docs/en/connector-v2/source/Iceberg.md: ########## @@ -140,9 +143,11 @@ source { table_list = [ { table = "table_1 + query = "select * from table where f1 > 100" Review Comment: ```suggestion ``` Let's keep some config without query. ########## seatunnel-connectors-v2/connector-iceberg/src/main/java/org/apache/seatunnel/connectors/seatunnel/iceberg/source/enumerator/scan/IcebergScanContext.java: ########## @@ -20,17 +20,23 @@ import org.apache.seatunnel.api.table.catalog.TablePath; import org.apache.seatunnel.connectors.seatunnel.iceberg.config.IcebergSourceConfig; import org.apache.seatunnel.connectors.seatunnel.iceberg.config.SourceTableConfig; +import org.apache.seatunnel.connectors.seatunnel.iceberg.utils.ExpressionUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.iceberg.Schema; import org.apache.iceberg.expressions.Expression; +import org.apache.iceberg.expressions.Expressions; import lombok.Builder; import lombok.Getter; import lombok.ToString; +import lombok.extern.java.Log; +import net.sf.jsqlparser.JSQLParserException; @Getter @Builder(toBuilder = true) @ToString +@Log Review Comment: ```suggestion @Slf4j ``` ########## seatunnel-e2e/seatunnel-connector-v2-e2e/connector-iceberg-e2e/src/test/resources/iceberg/filter_iceberg_source_tables.conf: ########## @@ -0,0 +1,102 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +###### +###### This config file is a demonstration of streaming processing in seatunnel config +###### + +env { + parallelism = 2 + job.mode = "BATCH" +} + +source { + Iceberg { + schema { + fields { + f2 = "boolean" + f1 = "bigint" + f3 = "int" + f4 = "bigint" + f5 = "float" + f6 = "double" + f7 = "date" + f9 = "timestamp" + f10 = "timestamp" + f11 = "string" + f12 = "bytes" + f13 = "bytes" + f14 = "decimal(19,9)" + f15 = "array<int>" + f16 = "map<string, int>" + } + } + catalog_name = "seatunnel" + iceberg.catalog.config={ + "type"="hadoop" + "warehouse"="file:///tmp/seatunnel/iceberg/hadoop/" + } + namespace = "database1" + table_list = [ + { + table = "source" + query = "select * from t where f1 = 10" + } + ] + plugin_output = "iceberg" + } +} + +transform { +} + +sink { + Assert { + plugin_input = "iceberg" + rules = + { + row_rules = [ + { + rule_type = MAX_ROW + rule_value = 1 + } + { + rule_type = MIN_ROW + rule_value = 1 + } + ] + field_rules = [ + { + field_name = f1 + field_type = bigint + field_value = [ + { + rule_type = NOT_NULL + }, + { + rule_type = MIN + rule_value = 10 + }, + { + rule_type = MAX + rule_value = 10 + } 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]
