-
Notifications
You must be signed in to change notification settings - Fork 176
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
docs: Improve user documentation for supported operators and expressions #520
Merged
Merged
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
8295e53
Improve documentation about supported operators and expressions
andygrove b979cbf
Improve documentation about supported operators and expressions
andygrove 6f02238
more notes
andygrove b2b8ff9
Add more supported expressions
andygrove 53d6e39
rename protobuf Negative to UnaryMinus for consistency
andygrove 5e20a6a
format
andygrove 2c1e518
remove duplicate ASF header
andygrove 14e6e14
SMJ not disabled by default
andygrove 1476b9e
Update docs/source/user-guide/operators.md
andygrove 4dcba12
Update docs/source/user-guide/operators.md
andygrove a8c409b
remove RLike
andygrove 5d8a384
Merge branch 'improve-docs' of github.com:andygrove/datafusion-comet …
andygrove File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,99 +19,175 @@ | |
|
||
# Supported Spark Expressions | ||
|
||
The following Spark expressions are currently available: | ||
|
||
- Literals | ||
- Arithmetic Operators | ||
- UnaryMinus | ||
- Add/Minus/Multiply/Divide/Remainder | ||
- Conditional functions | ||
- Case When | ||
- If | ||
- Cast | ||
- Coalesce | ||
- BloomFilterMightContain | ||
- Boolean functions | ||
- And | ||
- Or | ||
- Not | ||
- EqualTo | ||
- EqualNullSafe | ||
- GreaterThan | ||
- GreaterThanOrEqual | ||
- LessThan | ||
- LessThanOrEqual | ||
- IsNull | ||
- IsNotNull | ||
- In | ||
- String functions | ||
- Substring | ||
- Coalesce | ||
- StringSpace | ||
- Like | ||
- Contains | ||
- Startswith | ||
- Endswith | ||
- Ascii | ||
- Bit_length | ||
- Octet_length | ||
- Upper | ||
- Lower | ||
- Chr | ||
- Initcap | ||
- Trim/Btrim/Ltrim/Rtrim | ||
- Concat_ws | ||
- Repeat | ||
- Length | ||
- Reverse | ||
- Instr | ||
- Replace | ||
- Translate | ||
- Bitwise functions | ||
- Shiftright/Shiftleft | ||
- Date/Time functions | ||
- Year/Hour/Minute/Second | ||
- Hash functions | ||
- Md5 | ||
- Sha2 | ||
- Hash | ||
- Xxhash64 | ||
- Math functions | ||
- Abs | ||
- Acos | ||
- Asin | ||
- Atan | ||
- Atan2 | ||
- Cos | ||
- Exp | ||
- Ln | ||
- Log10 | ||
- Log2 | ||
- Pow | ||
- Round | ||
- Signum | ||
- Sin | ||
- Sqrt | ||
- Tan | ||
- Ceil | ||
- Floor | ||
- Aggregate functions | ||
- Count | ||
- Sum | ||
- Max | ||
- Min | ||
- Avg | ||
- First | ||
- Last | ||
- BitAnd | ||
- BitOr | ||
- BitXor | ||
- BoolAnd | ||
- BoolOr | ||
- CovPopulation | ||
- CovSample | ||
- VariancePop | ||
- VarianceSamp | ||
- StddevPop | ||
- StddevSamp | ||
- Corr | ||
The following Spark expressions are currently available. Any known compatibility issues are noted in the following tables. | ||
|
||
## Literal Values | ||
|
||
| Expression | Notes | | ||
| -------------------------------------- | ----- | | ||
| Literal values of supported data types | | | ||
|
||
## Unary Arithmetic | ||
|
||
| Expression | Notes | | ||
| ---------------- | ----- | | ||
| UnaryMinus (`-`) | | | ||
|
||
## Binary Arithmeticx | ||
|
||
| Expression | Notes | | ||
| --------------- | --------------------------------------------------- | | ||
| Add (`+`) | | | ||
| Subtract (`-`) | | | ||
| Multiply (`*`) | | | ||
| Divide (`/`) | | | ||
| Remainder (`%`) | Comet produces `NaN` instead of `NULL` for `% -0.0` | | ||
|
||
## Conditional Expressions | ||
|
||
| Expression | Notes | | ||
| ---------- | ----- | | ||
| CaseWhen | | | ||
| If | | | ||
|
||
## Comparison | ||
|
||
| Expression | Notes | | ||
| ------------------------- | ----- | | ||
| EqualTo (`=`) | | | ||
| EqualNullSafe (`<=>`) | | | ||
| GreaterThan (`>`) | | | ||
| GreaterThanOrEqual (`>=`) | | | ||
| LessThan (`<`) | | | ||
| LessThanOrEqual (`<=`) | | | ||
| IsNull (`IS NULL`) | | | ||
| IsNotNull (`IS NOT NULL`) | | | ||
| In (`IN`) | | | ||
|
||
## String Functions | ||
|
||
| Expression | Notes | | ||
| --------------- | ----------------------------------------------------------------------------------------------------------- | | ||
| Ascii | | | ||
| BitLength | | | ||
| Chr | | | ||
| ConcatWs | | | ||
| Contains | | | ||
| EndsWith | | | ||
| InitCap | | | ||
| Instr | | | ||
| Length | | | ||
| Like | | | ||
| Lower | | | ||
| OctetLength | | | ||
| Repeat | Negative argument for number of times to repeat causes exception | | ||
| Replace | | | ||
| Reverse | | | ||
| RLike | Disabled by default. Uses Rust regular expression engine which is not compatible with Java's regexp engine. | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have removed this and will add it back in the RLike PR after this one is merged |
||
| StartsWith | | | ||
| StringSpace | | | ||
| StringTrim | | | ||
| StringTrimBoth | | | ||
| StringTrimLeft | | | ||
| StringTrimRight | | | ||
| Substring | | | ||
| Translate | | | ||
| Upper | | | ||
|
||
## Date/Time Functions | ||
|
||
| Expression | Notes | | ||
| -------------- | ------------------------ | | ||
| DatePart | Only `year` is supported | | ||
| Extract | Only `year` is supported | | ||
| Hour | | | ||
| Minute | | | ||
| Second | | | ||
| TruncDate | | | ||
| TruncTimestamp | | | ||
| Year | | | ||
|
||
## Math Expressions | ||
|
||
| Expression | Notes | | ||
| ---------- | ------------------------------------------------------------------- | | ||
| Abs | | | ||
| Acos | | | ||
| Asin | | | ||
| Atan | | | ||
| Atan2 | | | ||
| Ceil | | | ||
| Cos | | | ||
| Exp | | | ||
| Floor | | | ||
| Log | log(0) will produce `-Infinity` unlike Spark which returns `null` | | ||
| Log2 | log2(0) will produce `-Infinity` unlike Spark which returns `null` | | ||
| Log10 | log10(0) will produce `-Infinity` unlike Spark which returns `null` | | ||
| Pow | | | ||
| Round | | | ||
| Signum | Signum does not differentiate between `0.0` and `-0.0` | | ||
| Sin | | | ||
| Sqrt | | | ||
| Tan | | | ||
|
||
## Hashing Functions | ||
|
||
| Expression | Notes | | ||
| ---------- | ----- | | ||
| Md5 | | | ||
| Hash | | | ||
| Sha2 | | | ||
| XxHash64 | | | ||
|
||
## Boolean Expressions | ||
|
||
| Expression | Notes | | ||
| ---------- | ----- | | ||
| And | | | ||
| Or | | | ||
| Not | | | ||
|
||
## Bitwise Expressions | ||
|
||
| Expression | Notes | | ||
| -------------------- | ----- | | ||
| ShiftLeft (`<<`) | | | ||
| ShiftRight (`>>`) | | | ||
| BitAnd (`&`) | | | ||
| BitOr (`\|`) | | | ||
| BitXor (`^`) | | | ||
| BitwiseNot (`~`) | | | ||
| BoolAnd (`bool_and`) | | | ||
| BoolOr (`bool_or`) | | | ||
|
||
## Aggregate Expressions | ||
|
||
| Expression | Notes | | ||
| ------------- | ----- | | ||
| Avg | | | ||
| BitAndAgg | | | ||
| BitOrAgg | | | ||
| BitXorAgg | | | ||
| Corr | | | ||
| Count | | | ||
| CovPopulation | | | ||
| CovSample | | | ||
| First | | | ||
| Last | | | ||
| Max | | | ||
| Min | | | ||
| StddevPop | | | ||
| StddevSamp | | | ||
| Sum | | | ||
| VariancePop | | | ||
| VarianceSamp | | | ||
|
||
## Other | ||
|
||
| Expression | Notes | | ||
| ----------------------- | ------------------------------------------------------------------------------- | | ||
| Cast | See compatibility guide for list of supported cast expressions and known issues | | ||
| BloomFilterMightContain | | | ||
| ScalarSubquery | | | ||
| Coalesce | | | ||
| NormalizeNaNAndZero | | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I renamed this because it was inconsistent with Spark naming