Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature][Connector-V2] Assert support multi-table check #7687

Merged
merged 12 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 123 additions & 12 deletions docs/en/connector-v2/sink/Assert.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

## Description

A flink sink plugin which can assert illegal data by user defined rules
A sink plugin which can assert illegal data by user defined rules

## Key Features

- [ ] [exactly-once](../../concept/connector-v2-features.md)

## Options

| Name | Type | Required | Default |
| Name | Type | Required | Default |
|------------------------------------------------------------------------------------------------|-------------------------------------------------|----------|---------|
| rules | ConfigMap | yes | - |
| rules.field_rules | string | yes | - |
Expand Down Expand Up @@ -43,6 +43,8 @@ A flink sink plugin which can assert illegal data by user defined rules
| rules.catalog_table_rule.column_rule.default_value | string | no | - |
| rules.catalog_table_rule.column_rule.comment | comment | no | - |
| rules.table-names | ConfigList | no | - |
| rules.tables_configs | ConfigList | no | - |
| rules.tables_configs.table_path | String | no | - |
| common-options | | no | - |

### rules [ConfigMap]
Expand Down Expand Up @@ -97,12 +99,21 @@ Used to assert the catalog table is same with the user defined table.

Used to assert the table should be in the data.

### tables_configs [ConfigList]

Used to assert the multiple tables should be in the data.

### table_path [String]

The path of the table.

### common options

Sink plugin common parameters, please refer to [Sink Common Options](../sink-common-options.md) for details

## Example

### Simple
the whole config obey with `hocon` style

```hocon
Expand Down Expand Up @@ -191,6 +202,8 @@ Assert {
}
```

### Complex

Here is a more complex example about `equals_to`. The example involves FakeSource. You may want to learn it, please read this [document](../source/FakeSource.md).

```hocon
Expand Down Expand Up @@ -481,18 +494,116 @@ sink{
}
```

## Changelog
### Assert Multiple Tables

check multiple tables

### 2.2.0-beta 2022-09-26
```hocon
env {
parallelism = 1
job.mode = BATCH
}

- Add Assert Sink Connector
source {
FakeSource {
tables_configs = [
{
row.num = 16
schema {
table = "test.table1"
fields {
c_int = int
c_bigint = bigint
}
}
},
{
row.num = 17
schema {
table = "test.table2"
fields {
c_string = string
c_tinyint = tinyint
}
}
}
]
}
}

### 2.3.0-beta 2022-10-20
transform {
}

- [Improve] 1.Support check the number of rows ([2844](https://github.com/apache/seatunnel/pull/2844)) ([3031](https://github.com/apache/seatunnel/pull/3031)):
- check rows not empty
- check minimum number of rows
- check maximum number of rows
- [Improve] 2.Support direct define of data values(row) ([2844](https://github.com/apache/seatunnel/pull/2844)) ([3031](https://github.com/apache/seatunnel/pull/3031))
- [Improve] 3.Support setting parallelism as 1 ([2844](https://github.com/apache/seatunnel/pull/2844)) ([3031](https://github.com/apache/seatunnel/pull/3031))
sink {
Assert {
rules =
{
tables_configs = [
{
table_path = "test.table1"
row_rules = [
{
rule_type = MAX_ROW
rule_value = 16
},
{
rule_type = MIN_ROW
rule_value = 16
}
],
field_rules = [{
field_name = c_int
field_type = int
field_value = [
{
rule_type = NOT_NULL
}
]
}, {
field_name = c_bigint
field_type = bigint
field_value = [
{
rule_type = NOT_NULL
}
]
}]
},
{
table_path = "test.table2"
row_rules = [
{
rule_type = MAX_ROW
rule_value = 17
},
{
rule_type = MIN_ROW
rule_value = 17
}
],
field_rules = [{
field_name = c_string
field_type = string
field_value = [
{
rule_type = NOT_NULL
}
]
}, {
field_name = c_tinyint
field_type = tinyint
field_value = [
{
rule_type = NOT_NULL
}
]
}]
}
]

}
}
}

```

Loading
Loading