From 79abe86dde7db4ca571c2b0b57e91a4fe63bdb85 Mon Sep 17 00:00:00 2001 From: EricGao888 Date: Mon, 26 Sep 2022 12:04:55 +0800 Subject: [PATCH] Add examples for java file and md table --- docs/en/transform/nullRate.md | 29 +++++++++---------- .../api/configuration/util/Condition.java | 15 +++++----- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/docs/en/transform/nullRate.md b/docs/en/transform/nullRate.md index a5c7bf1ebaa1..5718f73d8ef0 100644 --- a/docs/en/transform/nullRate.md +++ b/docs/en/transform/nullRate.md @@ -14,14 +14,12 @@ This transform **ONLY** supported by Spark. ## Options -| name | type | required | default value | -| -------------------------| ------------ | -------- | ------------- | -| fields | string_list | yes | - | -| rates | double_list | yes | - | -| throw_exception_enable | boolean | no | - | -| save_to_table_name | string | no | - | - - +| name | type | required | default value | +|------------------------|-------------|----------|---------------| +| fields | string_list | yes | - | +| rates | double_list | yes | - | +| throw_exception_enable | boolean | no | - | +| save_to_table_name | string | no | - | ### field [string_list] @@ -58,12 +56,13 @@ Transform plugin common parameters, please refer to [Transform Plugin](common-op Use `NullRate` in transform's Dataset. ```bash - transform { - NullRate { - fields = ["msg", "name"] - rates = [10.0,3.45] - save_to_table_name = "tmp" - throw_exception_enable = true - } +transform { + NullRate { + fields = ["msg", "name"] + rates = [10.0,3.45] + save_to_table_name = "tmp" + throw_exception_enable = true } +} ``` + diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/configuration/util/Condition.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/configuration/util/Condition.java index 74c08c1c7060..d8f6a1fbf9d5 100644 --- a/seatunnel-api/src/main/java/org/apache/seatunnel/api/configuration/util/Condition.java +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/configuration/util/Condition.java @@ -22,6 +22,7 @@ import java.util.Objects; public class Condition { + private final Option option; private final T expectValue; private Boolean and = null; @@ -104,9 +105,9 @@ public boolean equals(Object obj) { } Condition that = (Condition) obj; return Objects.equals(this.option, that.option) - && Objects.equals(this.expectValue, that.expectValue) - && Objects.equals(this.and, that.and) - && Objects.equals(this.next, that.next); + && Objects.equals(this.expectValue, that.expectValue) + && Objects.equals(this.and, that.and) + && Objects.equals(this.next, that.next); } @Override @@ -121,10 +122,10 @@ public String toString() { boolean bracket = false; do { builder.append("'") - .append(cur.option.key()) - // TODO: support another condition - .append("' == ") - .append(cur.expectValue); + .append(cur.option.key()) + // TODO: support another condition + .append("' == ") + .append(cur.expectValue); if (bracket) { builder = new StringBuilder(String.format("(%s)", builder)); bracket = false;