Skip to content

Commit

Permalink
add planned commands folder
Browse files Browse the repository at this point in the history
Signed-off-by: YANGDB <[email protected]>
  • Loading branch information
YANG-DB committed Oct 4, 2024
1 parent 33029c1 commit 5b3716d
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/ppl-lang/PPL-Example-Commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,3 +353,16 @@ source = supplier

> ppl-correlation-command is an experimental command - it may be removed in future versions

---
### Planned Commands:

#### **fillnull**

```sql
- `source=accounts | fillnull fields status_code=101`
- `source=accounts | fillnull fields request_path='/not_found', timestamp='*'`
- `source=accounts | fillnull using field1=101`
- `source=accounts | fillnull using field1=concat(field2, field3), field4=2*pi()*field5`
- `source=accounts | fillnull using field1=concat(field2, field3), field4=2*pi()*field5, field6 = 'N/A'`
```
[See additional command details](planning/ppl-fillnull-command.md)
4 changes: 4 additions & 0 deletions docs/ppl-lang/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ For additional examples see the next [documentation](PPL-Example-Commands.md).
See samples of [PPL queries](PPL-Example-Commands.md)

---
### Planned PPL Commands

- [`FillNull`](planning/ppl-fillnull-command.md)

---
### PPL Project Roadmap
[PPL Github Project Roadmap](https://github.com/orgs/opensearch-project/projects/214)
50 changes: 50 additions & 0 deletions docs/ppl-lang/planning/ppl-fillnull-command.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
## fillnull syntax proposal

1. **Proposed syntax changes with `null` replacement with the same values in various fields**
- `... | fillnull with 0 in field1`
- `... | fillnull with 'N/A' in field1, field2, field3`
- `... | fillnull with 2*pi() + field1 in field2`
- `... | fillnull with concat(field1, field2) in field3, field4`
- `... | fillnull with 'N/A'`
- incorrect syntax
- `... | fillnull with 'N/A' in`
- validation error related to missing columns

2. **Proposed syntax changes with `null` replacement with the various values in various fields**
* currently implemented, not conform to previous syntax proposal (`fields` addition)
- `... | fillnull fields status_code=101`
- `... | fillnull fields request_path='/not_found', timestamp='*'`
* New syntax proposal
- `... | fillnull using field1=101`
- `... | fillnull using field1=concat(field2, field3), field4=2*pi()*field5`
- `... | fillnull using field1=concat(field2, field3), field4=2*pi()*field5, field6 = 'N/A'`
- `... | fillnull using`
- validation error related to missing columns

### New syntax definition in ANTLR

```ANTLR
fillnullCommand
: FILLNULL (fillNullWithTheSameValue
| fillNullWithFieldVariousValues)
;
fillNullWithTheSameValue
: WITH nullReplacement IN nullableField (COMMA nullableField)*
;
fillNullWithFieldVariousValues
: USING nullableField EQUAL nullReplacement (COMMA nullableField EQUAL nullReplacement)*
;
nullableField
: fieldExpression
;
nullReplacement
: expression
;
```

0 comments on commit 5b3716d

Please sign in to comment.