Skip to content

Commit

Permalink
Add examples for java file and md table
Browse files Browse the repository at this point in the history
  • Loading branch information
EricGao888 committed Sep 26, 2022
1 parent 6d30730 commit 0980661
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
29 changes: 14 additions & 15 deletions docs/en/transform/nullRate.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down Expand Up @@ -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
}
}
```

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.Objects;

public class Condition<T> {

private final Option<T> option;
private final T expectValue;
private Boolean and = null;
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand Down

0 comments on commit 0980661

Please sign in to comment.