This is an automated email from the ASF dual-hosted git repository.

comphead pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new 2aff98e002 Added documentation for the Spaceship Operator (<=>) 
(#14214)
2aff98e002 is described below

commit 2aff98e002ce6d48008b8bbe2b38ee644a6d5c20
Author: Spaarsh <67336892+spaa...@users.noreply.github.com>
AuthorDate: Tue Jan 21 22:23:51 2025 +0530

    Added documentation for the Spaceship Operator (<=>) (#14214)
    
    * Added documentation for the Spaceship Operator (<=>)
    
    * Fix Prettier formatting issues
    
    * Added Spaceship Operator (<=>) to the list of Comparision Operators
    
    * Update docs/source/user-guide/sql/operators.md
    
    Co-authored-by: Oleks V <comph...@users.noreply.github.com>
    
    * Update docs/source/user-guide/sql/operators.md
    
    Co-authored-by: Oleks V <comph...@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Oleks V <comph...@users.noreply.github.com>
---
 docs/source/user-guide/sql/operators.md | 43 +++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/docs/source/user-guide/sql/operators.md 
b/docs/source/user-guide/sql/operators.md
index b0263ebe98..51f1a26d0b 100644
--- a/docs/source/user-guide/sql/operators.md
+++ b/docs/source/user-guide/sql/operators.md
@@ -110,6 +110,7 @@ Modulo (remainder)
 - [<= (less than or equal to)](#op_le)
 - [> (greater than)](#op_gt)
 - [>= (greater than or equal to)](#op_ge)
+- [<=> (three-way comparison, alias for IS NOT DISTINCT FROM)](#op_spaceship)
 - [IS DISTINCT FROM](#is-distinct-from)
 - [IS NOT DISTINCT FROM](#is-not-distinct-from)
 - [~ (regex match)](#op_re_match)
@@ -207,6 +208,48 @@ Greater Than or Equal To
 +----------------------+
 ```
 
+(op_spaceship)=
+
+### `<=>`
+
+Three-way comparison operator. A NULL-safe operator that returns true if both 
operands are equal or both are NULL, false otherwise.
+
+```sql
+> SELECT NULL <=> NULL;
++--------------------------------+
+| NULL IS NOT DISTINCT FROM NULL |
++--------------------------------+
+| true                           |
++--------------------------------+
+```
+
+```sql
+> SELECT 1 <=> NULL;
++------------------------------------+
+| Int64(1) IS NOT DISTINCT FROM NULL |
++------------------------------------+
+| false                              |
++------------------------------------+
+```
+
+```sql
+> SELECT 1 <=> 2;
++----------------------------------------+
+| Int64(1) IS NOT DISTINCT FROM Int64(2) |
++----------------------------------------+
+| false                                  |
++----------------------------------------+
+```
+
+```sql
+> SELECT 1 <=> 1;
++----------------------------------------+
+| Int64(1) IS NOT DISTINCT FROM Int64(1) |
++----------------------------------------+
+| true                                   |
++----------------------------------------+
+```
+
 ### `IS DISTINCT FROM`
 
 Guarantees the result of a comparison is `true` or `false` and not an empty set


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@datafusion.apache.org
For additional commands, e-mail: commits-h...@datafusion.apache.org

Reply via email to