You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "CosmosNi (via GitHub)" <gi...@apache.org> on 2025/06/16 08:52:10 UTC

[PR] [Feature][transform-v2] Data Validator Transform support [seatunnel]

CosmosNi opened a new pull request, #9445:
URL: https://github.com/apache/seatunnel/pull/9445

   close #9413 
   <!--
   
   Thank you for contributing to SeaTunnel! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   ## Contribution Checklist
     - Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/seatunnel/issues).
     - Name the pull request in the form "[Feature] [component] Title of the pull request", where *Feature* can be replaced by `Hotfix`, `Bug`, etc.
     - Minor fixes should be named following this pattern: `[hotfix] [docs] Fix typo in README.md doc`.
   -->
   
   ### Purpose of this pull request
   
   <!-- Describe the purpose of this pull request. For example: This pull request adds checkstyle plugin.-->
   
   
   ### Does this PR introduce _any_ user-facing change?
   
   <!--
   Note that it means *any* user-facing change including all aspects such as the documentation fix.
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released SeaTunnel versions or within the unreleased branches such as dev.
   If no, write 'No'.
   If you are adding/modifying connector documents, please follow our new specifications: https://github.com/apache/seatunnel/issues/4544.
   -->
   
   
   ### How was this patch tested?
   
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   If you are adding E2E test cases, maybe refer to https://github.com/apache/seatunnel/blob/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-cdc-mysql-e2e/src/test/resources/mysqlcdc_to_mysql.conf, here is a good example.
   -->
   
   
   ### Check list
   
   * [ ] If any new Jar binary package adding in your PR, please add License Notice according
     [New License Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/contribution/new-license.md)
   * [ ] If necessary, please update the documentation to describe the new feature. https://github.com/apache/seatunnel/tree/dev/docs
   * [ ] If you are contributing the connector code, please check that the following files are updated:
     1. Update [plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties) and add new connector information in it
     2. Update the pom file of [seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
     3. Add ci label in [label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml)
     4. Add e2e testcase in [seatunnel-e2e](https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/)
     5. Update connector [plugin_config](https://github.com/apache/seatunnel/blob/dev/config/plugin_config)


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature][transform-v2] Data Validator Transform support [seatunnel]

Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on code in PR #9445:
URL: https://github.com/apache/seatunnel/pull/9445#discussion_r2163045815


##########
seatunnel-transforms-v2/src/main/java/org/apache/seatunnel/transform/validator/DataValidatorTransform.java:
##########
@@ -0,0 +1,195 @@
+/*
+ * 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.
+ */
+
+package org.apache.seatunnel.transform.validator;
+
+import org.apache.seatunnel.api.configuration.ReadonlyConfig;
+import org.apache.seatunnel.api.table.catalog.CatalogTable;
+import org.apache.seatunnel.api.table.catalog.Column;
+import org.apache.seatunnel.api.table.catalog.ConstraintKey;
+import org.apache.seatunnel.api.table.catalog.PrimaryKey;
+import org.apache.seatunnel.api.table.catalog.TableIdentifier;
+import org.apache.seatunnel.api.table.catalog.TableSchema;
+import org.apache.seatunnel.api.table.type.SeaTunnelRow;
+import org.apache.seatunnel.api.table.type.SeaTunnelRowType;
+import org.apache.seatunnel.common.exception.CommonErrorCode;
+import org.apache.seatunnel.transform.common.AbstractCatalogSupportMapTransform;
+import org.apache.seatunnel.transform.common.ErrorHandleWay;
+import org.apache.seatunnel.transform.common.TransformCommonOptions;
+import org.apache.seatunnel.transform.exception.TransformException;
+import org.apache.seatunnel.transform.validator.ValidationResultHandler.ValidationProcessResult;
+
+import org.apache.commons.collections4.map.SingletonMap;
+
+import lombok.extern.slf4j.Slf4j;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/** DataValidator Transform for validating field values according to configured rules. */
+@Slf4j
+public class DataValidatorTransform extends AbstractCatalogSupportMapTransform {
+    public static final String PLUGIN_NAME = "DataValidator";
+
+    private final DataValidatorTransformConfig config;
+    private final List<FieldValidator> fieldValidators;
+    private final ValidationResultHandler resultHandler;
+    private final ErrorHandleWay errorHandleWay;
+    private final String errorTable;
+
+    public DataValidatorTransform(ReadonlyConfig readonlyConfig, CatalogTable catalogTable) {
+        super(catalogTable);
+        this.config = DataValidatorTransformConfig.of(readonlyConfig);
+        this.errorHandleWay =
+                readonlyConfig
+                        .getOptional(TransformCommonOptions.ROW_ERROR_HANDLE_WAY_OPTION)
+                        .orElse(ErrorHandleWay.FAIL);
+        this.errorTable =
+                readonlyConfig.getOptional(TransformCommonOptions.ERROR_TABLE_OPTION).orElse(null);
+        this.resultHandler = new ValidationResultHandler();
+        this.fieldValidators = initializeFieldValidators();
+    }
+
+    @Override
+    protected SeaTunnelRow transformRow(SeaTunnelRow inputRow) {
+        // Execute validation for all fields
+        Map<String, List<ValidationResult>> fieldResults = new HashMap<>();
+        ValidationContext context =
+                new ValidationContext(
+                        inputRow,
+                        inputCatalogTable.getTableSchema().toPhysicalRowDataType(),
+                        new HashMap<>(),
+                        null);
+
+        // Always validate all fields (no fail fast)
+        for (FieldValidator validator : fieldValidators) {
+            String fieldName = validator.getFieldName();
+            Object fieldValue = inputRow.getField(validator.getFieldIndex());
+
+            // Update context with current field name
+            ValidationContext fieldContext =
+                    new ValidationContext(
+                            inputRow,
+                            inputCatalogTable.getTableSchema().toPhysicalRowDataType(),
+                            context.getGlobalContext(),
+                            fieldName);
+
+            List<ValidationResult> results = validator.validate(fieldValue, fieldContext, false);
+            fieldResults.put(fieldName, results);
+        }
+
+        // Process validation results
+        ValidationProcessResult processResult =
+                resultHandler.processResults(inputRow, fieldResults);
+
+        // Handle validation failures
+        if (!processResult.isValid()) {
+            log.error(
+                    "Validation failed for row: {}",
+                    String.join("; ", processResult.getErrorMessages()));
+
+            if (errorHandleWay == ErrorHandleWay.FAIL) {
+                Map<String, String> params =
+                        new SingletonMap<>(
+                                "message",
+                                "Validation failed: "
+                                        + String.join("; ", processResult.getErrorMessages()));
+                throw new TransformException(CommonErrorCode.VALIDATION_FAILED, params);
+            } else if (errorHandleWay == ErrorHandleWay.SKIP) {
+                return null; // Skip this row
+            } else if (errorHandleWay.allowRouteToTable()) {
+                // Route invalid data to error table by setting tableId
+                if (errorTable != null && !errorTable.isEmpty()) {
+                    SeaTunnelRow errorRow = inputRow.copy();
+                    errorRow.setTableId(errorTable);
+                    log.debug("Routing invalid data to error table: {}", errorTable);
+                    return errorRow;

Review Comment:
   id, table_path, original_data, validation_error, create_time.
   
   Let original_data and validation_error store value as json format. So user can parse it easiler.
   



-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature][transform-v2] Data Validator Transform support [seatunnel]

Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on PR #9445:
URL: https://github.com/apache/seatunnel/pull/9445#issuecomment-3127367174

   waiting test case passes.


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature][transform-v2] Data Validator Transform support [seatunnel]

Posted by "CosmosNi (via GitHub)" <gi...@apache.org>.
CosmosNi commented on PR #9445:
URL: https://github.com/apache/seatunnel/pull/9445#issuecomment-3094973066

   @Hisoka-X PTAL


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature][transform-v2] Data Validator Transform support [seatunnel]

Posted by "CosmosNi (via GitHub)" <gi...@apache.org>.
CosmosNi commented on PR #9445:
URL: https://github.com/apache/seatunnel/pull/9445#issuecomment-2983210034

   @Hisoka-X PTAL


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature][transform-v2] Data Validator Transform support [seatunnel]

Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on code in PR #9445:
URL: https://github.com/apache/seatunnel/pull/9445#discussion_r2179984160


##########
seatunnel-e2e/seatunnel-transforms-v2-e2e/seatunnel-transforms-v2-e2e-part-1/src/test/java/org/apache/seatunnel/e2e/transform/TestDataValidatorIT.java:
##########
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+package org.apache.seatunnel.e2e.transform;
+
+import org.apache.seatunnel.e2e.common.container.TestContainer;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.TestTemplate;
+import org.testcontainers.containers.Container;
+
+import java.io.IOException;
+
+public class TestDataValidatorIT extends TestSuiteBase {
+
+    @TestTemplate
+    public void testDataValidatorWithValidData(TestContainer container)
+            throws IOException, InterruptedException {
+        Container.ExecResult execResult = container.executeJob("/data_validator_valid.conf");
+        Assertions.assertEquals(0, execResult.getExitCode());
+    }
+
+    @TestTemplate
+    public void testDataValidatorWithSkipMode(TestContainer container)
+            throws IOException, InterruptedException {
+        Container.ExecResult execResult = container.executeJob("/data_validator_skip.conf");
+        Assertions.assertEquals(0, execResult.getExitCode());
+    }
+
+    @TestTemplate
+    public void testDataValidatorWithFailMode(TestContainer container)
+            throws IOException, InterruptedException {
+        Container.ExecResult execResult = container.executeJob("/data_validator_fail.conf");
+        // Should fail due to validation errors
+        Assertions.assertNotEquals(0, execResult.getExitCode());

Review Comment:
   Could you add a check for error message in logs?



##########
docs/en/transform-v2/data-validator.md:
##########
@@ -0,0 +1,322 @@
+# DataValidator
+
+> Data validation transform plugin
+
+## Description
+
+The DataValidator transform validates field values according to configured rules and handles validation failures based on the specified error handling strategy. It supports multiple validation rule types including null checks, range validation, length validation, and regex pattern matching.
+
+## Options
+
+|      name       |  type  | required | default value |
+|-----------------|--------|----------|---------------|
+| error_handle_way| enum   | no       | FAIL          |
+| error_table     | string | no       |               |
+| field_rules     | array  | yes      |               |
+
+### error_handle_way [enum]
+
+Error handling strategy when validation fails:
+- `FAIL`: Fail the entire task when validation errors occur
+- `SKIP`: Skip invalid rows and continue processing
+- `ROUTE_TO_TABLE`: Route invalid data to a specified error table
+
+**Note**: `ROUTE_TO_TABLE` mode only works with sinks that support multiple tables. The sink must be capable of handling data routed to different table destinations.
+
+### error_table [string]
+
+Target table name for routing invalid data when `error_handle_way` is set to `ROUTE_TO_TABLE`. This parameter is required when using `ROUTE_TO_TABLE` mode.
+
+#### Error Table Schema
+
+When using `ROUTE_TO_TABLE` mode, DataValidator automatically creates an error table with a fixed schema to store validation failure data. The error table contains the following fields:
+
+| Field Name | Data Type | Description |
+|------------|-----------|-------------|
+| source_table_id | STRING | Source table identifier that identifies the originating table |
+| source_table_path | STRING | Source table path with complete table path information |
+| original_data | STRING | JSON representation of the original data containing the complete row that failed validation |
+| validation_errors | STRING | JSON array of validation error details containing all failed fields and error information |

Review Comment:
   any example for this two data value format?



-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature][transform-v2] Data Validator Transform support [seatunnel]

Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on code in PR #9445:
URL: https://github.com/apache/seatunnel/pull/9445#discussion_r2222253222


##########
seatunnel-common/src/main/java/org/apache/seatunnel/common/exception/CommonErrorCode.java:
##########
@@ -26,6 +26,7 @@ public enum CommonErrorCode implements SeaTunnelErrorCode {
     UNSUPPORTED_DATA_TYPE(
             "COMMON-07", "'<identifier>' unsupported data type '<dataType>' of '<field>'"),
     UNSUPPORTED_ENCODING("COMMON-08", "unsupported encoding '<encoding>'"),
+    VALIDATION_FAILED("COMMON-09", "Data validation failed: '<message>'"),

Review Comment:
   Please set the code to `COMMMON-38`, because we already had code `COMMON-09` in https://github.com/apache/seatunnel/blob/94bb6350df4ced5661268795aa8c43804983e196/seatunnel-common/src/main/java/org/apache/seatunnel/common/exception/CommonErrorCodeDeprecated.java#L34



##########
seatunnel-transforms-v2/src/main/java/org/apache/seatunnel/transform/validator/DataValidatorTransform.java:
##########
@@ -0,0 +1,314 @@
+/*
+ * 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.
+ */
+
+package org.apache.seatunnel.transform.validator;
+
+import org.apache.seatunnel.api.configuration.ReadonlyConfig;
+import org.apache.seatunnel.api.table.catalog.CatalogTable;
+import org.apache.seatunnel.api.table.catalog.Column;
+import org.apache.seatunnel.api.table.catalog.PhysicalColumn;
+import org.apache.seatunnel.api.table.catalog.TableIdentifier;
+import org.apache.seatunnel.api.table.catalog.TableSchema;
+import org.apache.seatunnel.api.table.type.BasicType;
+import org.apache.seatunnel.api.table.type.LocalTimeType;
+import org.apache.seatunnel.api.table.type.SeaTunnelRow;
+import org.apache.seatunnel.api.table.type.SeaTunnelRowType;
+import org.apache.seatunnel.common.exception.CommonErrorCode;
+import org.apache.seatunnel.common.utils.JsonUtils;
+import org.apache.seatunnel.transform.common.AbstractCatalogSupportMapTransform;
+import org.apache.seatunnel.transform.common.ErrorHandleWay;
+import org.apache.seatunnel.transform.common.TransformCommonOptions;
+import org.apache.seatunnel.transform.exception.TransformException;
+import org.apache.seatunnel.transform.validator.ValidationResultHandler.ValidationProcessResult;
+
+import org.apache.commons.collections4.map.SingletonMap;
+
+import lombok.extern.slf4j.Slf4j;
+
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/** DataValidator Transform for validating field values according to configured rules. */
+@Slf4j
+public class DataValidatorTransform extends AbstractCatalogSupportMapTransform {
+    public static final String PLUGIN_NAME = "DataValidator";
+    public static final String SOURCE_TABLE_ID = "source_table_id";
+    public static final String SOURCE_TABLE_PATH = "source_table_path";
+    public static final String ORIGINAL_DATA = "original_data";
+    public static final String VALIDATION_ERRORS = "validation_errors";
+    public static final String CREATE_TIME = "create_time";
+
+    private final DataValidatorTransformConfig config;
+    private final List<FieldValidator> fieldValidators;
+    private final ValidationResultHandler resultHandler;
+    private final ErrorHandleWay errorHandleWay;
+    private final String errorTable;
+
+    public DataValidatorTransform(ReadonlyConfig readonlyConfig, CatalogTable catalogTable) {
+        super(catalogTable);
+        this.config = DataValidatorTransformConfig.of(readonlyConfig);
+        this.errorHandleWay =
+                readonlyConfig
+                        .getOptional(TransformCommonOptions.ROW_ERROR_HANDLE_WAY_OPTION)
+                        .orElse(ErrorHandleWay.FAIL);
+        this.errorTable =
+                readonlyConfig.getOptional(TransformCommonOptions.ERROR_TABLE_OPTION).orElse(null);
+        this.resultHandler = new ValidationResultHandler();
+        this.fieldValidators = initializeFieldValidators();
+    }
+
+    @Override
+    protected SeaTunnelRow transformRow(SeaTunnelRow inputRow) {
+        // Execute validation for all fields
+        Map<String, List<ValidationResult>> fieldResults = new HashMap<>();
+        ValidationContext context =
+                new ValidationContext(
+                        inputRow,
+                        inputCatalogTable.getTableSchema().toPhysicalRowDataType(),
+                        new HashMap<>(),
+                        null);
+
+        // Always validate all fields (no fail fast)
+        for (FieldValidator validator : fieldValidators) {
+            String fieldName = validator.getFieldName();
+            Object fieldValue = inputRow.getField(validator.getFieldIndex());
+
+            // Update context with current field name
+            ValidationContext fieldContext =
+                    new ValidationContext(
+                            inputRow,
+                            inputCatalogTable.getTableSchema().toPhysicalRowDataType(),
+                            context.getGlobalContext(),
+                            fieldName);
+
+            List<ValidationResult> results = validator.validate(fieldValue, fieldContext, false);
+            fieldResults.put(fieldName, results);
+        }
+
+        // Process validation results
+        ValidationProcessResult processResult =
+                resultHandler.processResults(inputRow, fieldResults);
+
+        // Handle validation failures
+        if (!processResult.isValid()) {
+            log.error(
+                    "Validation failed for row: {}",
+                    String.join("; ", processResult.getErrorMessages()));
+
+            if (errorHandleWay == ErrorHandleWay.FAIL) {
+                Map<String, String> params =
+                        new SingletonMap<>(
+                                "message",
+                                "Validation failed: "
+                                        + String.join("; ", processResult.getErrorMessages()));
+                throw new TransformException(CommonErrorCode.VALIDATION_FAILED, params);

Review Comment:
   Please refer https://github.com/apache/seatunnel/blob/94bb6350df4ced5661268795aa8c43804983e196/seatunnel-common/src/main/java/org/apache/seatunnel/common/exception/CommonError.java#L61 to create new common error.



##########
seatunnel-transforms-v2/src/main/java/org/apache/seatunnel/transform/common/TransformCommonOptions.java:
##########
@@ -66,4 +69,11 @@ public class TransformCommonOptions {
                                     + "When fail is selected, data format error will block and an exception will be thrown. "
                                     + "When skip is selected, data format error will skip this column data."
                                     + "When skip_row is selected, data format error will skip this line data.");
+
+    public static final Option<String> ERROR_TABLE_OPTION =
+            Options.key("error_table")

Review Comment:
   ```suggestion
               Options.key("row_error_handle_way.error_table")
   ```



-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature][transform-v2] Data Validator Transform support [seatunnel]

Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on code in PR #9445:
URL: https://github.com/apache/seatunnel/pull/9445#discussion_r2155997406


##########
seatunnel-transforms-v2/src/main/java/org/apache/seatunnel/transform/validator/udf/DataValidatorUDF.java:
##########
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+
+package org.apache.seatunnel.transform.validator.udf;
+
+import org.apache.seatunnel.api.table.type.SeaTunnelDataType;
+import org.apache.seatunnel.transform.validator.ValidationContext;
+import org.apache.seatunnel.transform.validator.ValidationResult;
+
+import java.io.Serializable;
+
+public interface DataValidatorUDF extends Serializable {

Review Comment:
   any docs for udf and email?



##########
docs/en/transform-v2/data-validator.md:
##########
@@ -0,0 +1,200 @@
+# DataValidator
+
+> Data validation transform plugin
+
+## Description
+
+The DataValidator transform validates field values according to configured rules and handles validation failures based on the specified error handling strategy. It supports multiple validation rule types including null checks, range validation, length validation, and regex pattern matching.
+
+## Options
+
+|      name       |  type  | required | default value |
+|-----------------|--------|----------|---------------|
+| error_handle_way| enum   | no       | FAIL          |
+| error_table     | string | no       |               |
+| field_rules     | array  | yes      |               |
+
+### error_handle_way [enum]
+
+Error handling strategy when validation fails:
+- `FAIL`: Fail the entire task when validation errors occur
+- `SKIP`: Skip invalid rows and continue processing
+- `ROUTE_TO_TABLE`: Route invalid data to a specified error table
+
+**Note**: `ROUTE_TO_TABLE` mode only works with sinks that support multiple tables. The sink must be capable of handling data routed to different table destinations.
+
+### error_table [string]
+
+Target table name for routing invalid data when `error_handle_way` is set to `ROUTE_TO_TABLE`. This parameter is required when using `ROUTE_TO_TABLE` mode.
+
+### field_rules [array]
+
+Array of field validation rules. Each rule defines validation criteria for a specific field.
+
+#### Field Rule Structure
+
+Each field rule contains:
+- `field_name`: Name of the field to validate
+- `rules`: Array of validation rules to apply (nested format), or individual rule properties (flat format)
+
+#### Validation Rule Types
+
+##### NOT_NULL
+Validates that a field value is not null.
+
+Parameters:
+- `rule_type`: "NOT_NULL"
+- `custom_message` (optional): Custom error message
+
+##### RANGE
+Validates that a numeric value is within a specified range.
+
+Parameters:
+- `rule_type`: "RANGE"
+- `min_value` (optional): Minimum allowed value
+- `max_value` (optional): Maximum allowed value
+- `min_inclusive` (optional): Whether minimum value is inclusive (default: true)
+- `max_inclusive` (optional): Whether maximum value is inclusive (default: true)
+- `custom_message` (optional): Custom error message
+
+##### LENGTH
+Validates the length of string, array, or collection values.
+
+Parameters:
+- `rule_type`: "LENGTH"
+- `min_length` (optional): Minimum allowed length
+- `max_length` (optional): Maximum allowed length
+- `exact_length` (optional): Exact required length
+- `custom_message` (optional): Custom error message
+
+##### REGEX
+Validates that a string value matches a regular expression pattern.
+
+Parameters:
+- `rule_type`: "REGEX"
+- `pattern`: Regular expression pattern (required)
+- `case_sensitive` (optional): Whether pattern matching is case sensitive (default: true)
+- `custom_message` (optional): Custom error message
+
+### common options [string]
+
+Transform plugin common parameters, please refer to [Transform Plugin](common-options.md) for details
+
+## Examples
+
+### Example 1: Basic Validation with FAIL Mode
+
+```hocon
+transform {
+  DataValidator {
+    plugin_input = "source_table"
+    plugin_output = "validated_table"
+    error_handle_way = "FAIL"
+    field_rules = [
+      {
+        field_name = "name"
+        rule_type = "NOT_NULL"
+      },
+      {
+        field_name = "age"
+        rule_type = "RANGE"
+        min_value = 0
+        max_value = 150
+      },
+      {
+        field_name = "email"
+        rule_type = "REGEX"
+        pattern = "^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$"
+      }
+    ]
+  }
+}
+```
+
+### Example 2: Validation with SKIP Mode
+
+```hocon
+transform {
+  DataValidator {
+    plugin_input = "source_table"
+    plugin_output = "validated_table"
+    error_handle_way = "SKIP"
+    field_rules = [
+      {
+        field_name = "name"
+        rule_type = "NOT_NULL"
+      },
+      {
+        field_name = "name"
+        rule_type = "LENGTH"
+        min_length = 2
+        max_length = 50
+      }
+    ]
+  }
+}
+```
+
+### Example 3: Validation with ROUTE_TO_TABLE Mode
+
+```hocon
+transform {
+  DataValidator {
+    plugin_input = "source_table"
+    plugin_output = "validated_table"
+    error_handle_way = "ROUTE_TO_TABLE"
+    error_table = "error_data"
+    field_rules = [
+      {
+        field_name = "name"
+        rule_type = "NOT_NULL"
+      },
+      {
+        field_name = "age"
+        rule_type = "RANGE"
+        min_value = 0
+        max_value = 150
+      }
+    ]
+  }
+}
+```
+
+**Note**: When using `ROUTE_TO_TABLE`, ensure your sink connector supports multiple tables. Valid data will be sent to the main output table, while invalid data will be routed to the specified error table.
+
+### Example 4: Nested Rules Format
+
+```hocon
+transform {
+  DataValidator {
+    plugin_input = "source_table"
+    plugin_output = "validated_table"
+    error_handle_way = "FAIL"
+    field_rules = [
+      {
+        field_name = "name"
+        rules = [
+          {
+            rule_type = "NOT_NULL"
+            custom_message = "Name is required"
+          },
+          {
+            rule_type = "LENGTH"
+            min_length = 2
+            max_length = 50
+            custom_message = "Name must be between 2 and 50 characters"
+          }
+        ]
+      }
+    ]
+  }
+}
+```
+
+## Changelog
+
+### new version
+- Add DataValidator Transform Connector
+- Support NOT_NULL, RANGE, LENGTH, and REGEX validation rules
+- Support FAIL, SKIP, and ROUTE_TO_TABLE error handling modes
+- Support both flat and nested rule configuration formats

Review Comment:
   We don't need changelog for transform now. It is hard to maintain.



##########
seatunnel-transforms-v2/src/main/java/org/apache/seatunnel/transform/validator/DataValidatorTransformConfig.java:
##########
@@ -0,0 +1,422 @@
+/*
+ * 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.
+ */
+
+package org.apache.seatunnel.transform.validator;
+
+import org.apache.seatunnel.shade.com.fasterxml.jackson.annotation.JsonAlias;
+import org.apache.seatunnel.shade.com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import org.apache.seatunnel.shade.com.fasterxml.jackson.core.type.TypeReference;
+import org.apache.seatunnel.shade.com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.seatunnel.shade.com.google.common.collect.Lists;
+
+import org.apache.seatunnel.api.configuration.Option;
+import org.apache.seatunnel.api.configuration.Options;
+import org.apache.seatunnel.api.configuration.ReadonlyConfig;
+import org.apache.seatunnel.transform.validator.rule.LengthValidationRule;
+import org.apache.seatunnel.transform.validator.rule.NotNullValidationRule;
+import org.apache.seatunnel.transform.validator.rule.RangeValidationRule;
+import org.apache.seatunnel.transform.validator.rule.RegexValidationRule;
+import org.apache.seatunnel.transform.validator.rule.UDFValidationRule;
+import org.apache.seatunnel.transform.validator.rule.ValidationRule;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Slf4j
+public class DataValidatorTransformConfig implements Serializable {
+
+    public static final Option<ValidationErrorHandleWay> ERROR_HANDLE_WAY =
+            Options.key("error_handle_way")
+                    .enumType(ValidationErrorHandleWay.class)
+                    .defaultValue(ValidationErrorHandleWay.FAIL)
+                    .withDescription(
+                            "Error handling strategy: FAIL - fail the task, SKIP - skip invalid data, ROUTE_TO_TABLE - route to specified table");

Review Comment:
   Please reuse https://github.com/apache/seatunnel/blob/2f96f2e46c8fe4cc527924d02340bfb991ed3f6d/seatunnel-transforms-v2/src/main/java/org/apache/seatunnel/transform/common/TransformCommonOptions.java#L50-L68



-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature][transform-v2] Data Validator Transform support [seatunnel]

Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on code in PR #9445:
URL: https://github.com/apache/seatunnel/pull/9445#discussion_r2162834627


##########
seatunnel-e2e/seatunnel-transforms-v2-e2e/seatunnel-transforms-v2-e2e-part-1/src/test/java/org/apache/seatunnel/e2e/transform/TestDataValidatorIT.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+
+package org.apache.seatunnel.e2e.transform;
+
+import org.apache.seatunnel.e2e.common.container.EngineType;
+import org.apache.seatunnel.e2e.common.container.TestContainer;
+import org.apache.seatunnel.e2e.common.junit.DisabledOnContainer;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.TestTemplate;
+import org.testcontainers.containers.Container;
+
+import java.io.IOException;
+
+@DisabledOnContainer(
+        value = {},
+        type = {EngineType.SPARK, EngineType.FLINK},
+        disabledReason = "Currently SPARK not support adapt")

Review Comment:
   why disabled flink and spark?



##########
seatunnel-transforms-v2/src/main/java/org/apache/seatunnel/transform/validator/DataValidatorTransform.java:
##########
@@ -0,0 +1,195 @@
+/*
+ * 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.
+ */
+
+package org.apache.seatunnel.transform.validator;
+
+import org.apache.seatunnel.api.configuration.ReadonlyConfig;
+import org.apache.seatunnel.api.table.catalog.CatalogTable;
+import org.apache.seatunnel.api.table.catalog.Column;
+import org.apache.seatunnel.api.table.catalog.ConstraintKey;
+import org.apache.seatunnel.api.table.catalog.PrimaryKey;
+import org.apache.seatunnel.api.table.catalog.TableIdentifier;
+import org.apache.seatunnel.api.table.catalog.TableSchema;
+import org.apache.seatunnel.api.table.type.SeaTunnelRow;
+import org.apache.seatunnel.api.table.type.SeaTunnelRowType;
+import org.apache.seatunnel.common.exception.CommonErrorCode;
+import org.apache.seatunnel.transform.common.AbstractCatalogSupportMapTransform;
+import org.apache.seatunnel.transform.common.ErrorHandleWay;
+import org.apache.seatunnel.transform.common.TransformCommonOptions;
+import org.apache.seatunnel.transform.exception.TransformException;
+import org.apache.seatunnel.transform.validator.ValidationResultHandler.ValidationProcessResult;
+
+import org.apache.commons.collections4.map.SingletonMap;
+
+import lombok.extern.slf4j.Slf4j;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/** DataValidator Transform for validating field values according to configured rules. */
+@Slf4j
+public class DataValidatorTransform extends AbstractCatalogSupportMapTransform {
+    public static final String PLUGIN_NAME = "DataValidator";
+
+    private final DataValidatorTransformConfig config;
+    private final List<FieldValidator> fieldValidators;
+    private final ValidationResultHandler resultHandler;
+    private final ErrorHandleWay errorHandleWay;
+    private final String errorTable;
+
+    public DataValidatorTransform(ReadonlyConfig readonlyConfig, CatalogTable catalogTable) {
+        super(catalogTable);
+        this.config = DataValidatorTransformConfig.of(readonlyConfig);
+        this.errorHandleWay =
+                readonlyConfig
+                        .getOptional(TransformCommonOptions.ROW_ERROR_HANDLE_WAY_OPTION)
+                        .orElse(ErrorHandleWay.FAIL);
+        this.errorTable =
+                readonlyConfig.getOptional(TransformCommonOptions.ERROR_TABLE_OPTION).orElse(null);
+        this.resultHandler = new ValidationResultHandler();
+        this.fieldValidators = initializeFieldValidators();
+    }
+
+    @Override
+    protected SeaTunnelRow transformRow(SeaTunnelRow inputRow) {
+        // Execute validation for all fields
+        Map<String, List<ValidationResult>> fieldResults = new HashMap<>();
+        ValidationContext context =
+                new ValidationContext(
+                        inputRow,
+                        inputCatalogTable.getTableSchema().toPhysicalRowDataType(),
+                        new HashMap<>(),
+                        null);
+
+        // Always validate all fields (no fail fast)
+        for (FieldValidator validator : fieldValidators) {
+            String fieldName = validator.getFieldName();
+            Object fieldValue = inputRow.getField(validator.getFieldIndex());
+
+            // Update context with current field name
+            ValidationContext fieldContext =
+                    new ValidationContext(
+                            inputRow,
+                            inputCatalogTable.getTableSchema().toPhysicalRowDataType(),
+                            context.getGlobalContext(),
+                            fieldName);
+
+            List<ValidationResult> results = validator.validate(fieldValue, fieldContext, false);
+            fieldResults.put(fieldName, results);
+        }
+
+        // Process validation results
+        ValidationProcessResult processResult =
+                resultHandler.processResults(inputRow, fieldResults);
+
+        // Handle validation failures
+        if (!processResult.isValid()) {
+            log.error(
+                    "Validation failed for row: {}",
+                    String.join("; ", processResult.getErrorMessages()));
+
+            if (errorHandleWay == ErrorHandleWay.FAIL) {
+                Map<String, String> params =
+                        new SingletonMap<>(
+                                "message",
+                                "Validation failed: "
+                                        + String.join("; ", processResult.getErrorMessages()));
+                throw new TransformException(CommonErrorCode.VALIDATION_FAILED, params);
+            } else if (errorHandleWay == ErrorHandleWay.SKIP) {
+                return null; // Skip this row
+            } else if (errorHandleWay.allowRouteToTable()) {
+                // Route invalid data to error table by setting tableId
+                if (errorTable != null && !errorTable.isEmpty()) {
+                    SeaTunnelRow errorRow = inputRow.copy();
+                    errorRow.setTableId(errorTable);
+                    log.debug("Routing invalid data to error table: {}", errorTable);
+                    return errorRow;

Review Comment:
   If we have 1000 tables need to be verify. Does I also need create 1000 tables in sink for error table? Because each table has different schema. Can we design a standard structure so that the sink can use a table to store all error data?



-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature][transform-v2] Data Validator Transform support [seatunnel]

Posted by "CosmosNi (via GitHub)" <gi...@apache.org>.
CosmosNi commented on code in PR #9445:
URL: https://github.com/apache/seatunnel/pull/9445#discussion_r2163030594


##########
seatunnel-transforms-v2/src/main/java/org/apache/seatunnel/transform/validator/DataValidatorTransform.java:
##########
@@ -0,0 +1,195 @@
+/*
+ * 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.
+ */
+
+package org.apache.seatunnel.transform.validator;
+
+import org.apache.seatunnel.api.configuration.ReadonlyConfig;
+import org.apache.seatunnel.api.table.catalog.CatalogTable;
+import org.apache.seatunnel.api.table.catalog.Column;
+import org.apache.seatunnel.api.table.catalog.ConstraintKey;
+import org.apache.seatunnel.api.table.catalog.PrimaryKey;
+import org.apache.seatunnel.api.table.catalog.TableIdentifier;
+import org.apache.seatunnel.api.table.catalog.TableSchema;
+import org.apache.seatunnel.api.table.type.SeaTunnelRow;
+import org.apache.seatunnel.api.table.type.SeaTunnelRowType;
+import org.apache.seatunnel.common.exception.CommonErrorCode;
+import org.apache.seatunnel.transform.common.AbstractCatalogSupportMapTransform;
+import org.apache.seatunnel.transform.common.ErrorHandleWay;
+import org.apache.seatunnel.transform.common.TransformCommonOptions;
+import org.apache.seatunnel.transform.exception.TransformException;
+import org.apache.seatunnel.transform.validator.ValidationResultHandler.ValidationProcessResult;
+
+import org.apache.commons.collections4.map.SingletonMap;
+
+import lombok.extern.slf4j.Slf4j;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/** DataValidator Transform for validating field values according to configured rules. */
+@Slf4j
+public class DataValidatorTransform extends AbstractCatalogSupportMapTransform {
+    public static final String PLUGIN_NAME = "DataValidator";
+
+    private final DataValidatorTransformConfig config;
+    private final List<FieldValidator> fieldValidators;
+    private final ValidationResultHandler resultHandler;
+    private final ErrorHandleWay errorHandleWay;
+    private final String errorTable;
+
+    public DataValidatorTransform(ReadonlyConfig readonlyConfig, CatalogTable catalogTable) {
+        super(catalogTable);
+        this.config = DataValidatorTransformConfig.of(readonlyConfig);
+        this.errorHandleWay =
+                readonlyConfig
+                        .getOptional(TransformCommonOptions.ROW_ERROR_HANDLE_WAY_OPTION)
+                        .orElse(ErrorHandleWay.FAIL);
+        this.errorTable =
+                readonlyConfig.getOptional(TransformCommonOptions.ERROR_TABLE_OPTION).orElse(null);
+        this.resultHandler = new ValidationResultHandler();
+        this.fieldValidators = initializeFieldValidators();
+    }
+
+    @Override
+    protected SeaTunnelRow transformRow(SeaTunnelRow inputRow) {
+        // Execute validation for all fields
+        Map<String, List<ValidationResult>> fieldResults = new HashMap<>();
+        ValidationContext context =
+                new ValidationContext(
+                        inputRow,
+                        inputCatalogTable.getTableSchema().toPhysicalRowDataType(),
+                        new HashMap<>(),
+                        null);
+
+        // Always validate all fields (no fail fast)
+        for (FieldValidator validator : fieldValidators) {
+            String fieldName = validator.getFieldName();
+            Object fieldValue = inputRow.getField(validator.getFieldIndex());
+
+            // Update context with current field name
+            ValidationContext fieldContext =
+                    new ValidationContext(
+                            inputRow,
+                            inputCatalogTable.getTableSchema().toPhysicalRowDataType(),
+                            context.getGlobalContext(),
+                            fieldName);
+
+            List<ValidationResult> results = validator.validate(fieldValue, fieldContext, false);
+            fieldResults.put(fieldName, results);
+        }
+
+        // Process validation results
+        ValidationProcessResult processResult =
+                resultHandler.processResults(inputRow, fieldResults);
+
+        // Handle validation failures
+        if (!processResult.isValid()) {
+            log.error(
+                    "Validation failed for row: {}",
+                    String.join("; ", processResult.getErrorMessages()));
+
+            if (errorHandleWay == ErrorHandleWay.FAIL) {
+                Map<String, String> params =
+                        new SingletonMap<>(
+                                "message",
+                                "Validation failed: "
+                                        + String.join("; ", processResult.getErrorMessages()));
+                throw new TransformException(CommonErrorCode.VALIDATION_FAILED, params);
+            } else if (errorHandleWay == ErrorHandleWay.SKIP) {
+                return null; // Skip this row
+            } else if (errorHandleWay.allowRouteToTable()) {
+                // Route invalid data to error table by setting tableId
+                if (errorTable != null && !errorTable.isEmpty()) {
+                    SeaTunnelRow errorRow = inputRow.copy();
+                    errorRow.setTableId(errorTable);
+                    log.debug("Routing invalid data to error table: {}", errorTable);
+                    return errorRow;

Review Comment:
   How about keeping only three fields, source_table_id, original_data, validation_errors.



-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature][transform-v2] Data Validator Transform support [seatunnel]

Posted by "corgy-w (via GitHub)" <gi...@apache.org>.
corgy-w merged PR #9445:
URL: https://github.com/apache/seatunnel/pull/9445


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature][transform-v2] Data Validator Transform support [seatunnel]

Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on code in PR #9445:
URL: https://github.com/apache/seatunnel/pull/9445#discussion_r2230906334


##########
docs/en/transform-v2/data-validator.md:
##########
@@ -0,0 +1,333 @@
+# DataValidator
+
+> Data validation transform plugin
+
+## Description
+
+The DataValidator transform validates field values according to configured rules and handles validation failures based on the specified error handling strategy. It supports multiple validation rule types including null checks, range validation, length validation, and regex pattern matching.
+
+## Options
+
+|      name       |  type  | required | default value |
+|-----------------|--------|----------|---------------|
+| error_handle_way| enum   | no       | FAIL          |
+| error_table     | string | no       |               |

Review Comment:
   please update the doc too.



-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature][transform-v2] Data Validator Transform support [seatunnel]

Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on code in PR #9445:
URL: https://github.com/apache/seatunnel/pull/9445#discussion_r2234764521


##########
docs/en/transform-v2/data-validator.md:
##########
@@ -0,0 +1,333 @@
+# DataValidator
+
+> Data validation transform plugin
+
+## Description
+
+The DataValidator transform validates field values according to configured rules and handles validation failures based on the specified error handling strategy. It supports multiple validation rule types including null checks, range validation, length validation, and regex pattern matching.
+
+## Options
+
+|      name       |  type  | required | default value |
+|-----------------|--------|----------|---------------|
+| error_handle_way| enum   | no       | FAIL          |

Review Comment:
   ```suggestion
   | row_error_handle_way| enum   | no       | FAIL          |
   ```



-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org