Spaarsh commented on issue #14203:
URL: https://github.com/apache/datafusion/issues/14203#issuecomment-2603032819

   This is what I have added to the documentation. For all the existing 
operators, single examples sufficed since they followed a "one-way" comparison. 
While the spaceship operator is a three-way comparation. If this seems 
excessive, please let me know!
   
   ---
   
   (op_spaceship)=
   
   ### `<=>`
   
   Three-way comparision 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                                   |
   +----------------------------------------+
   ```
   ---
   
   I would also like to suggest that for the sake of clarity, we ensure that 
the description of the Spaceship operator is the similar to that of ```IS 
DISTINCT FROM```. The documentation for ```IS DISTINCT FROM`` says this in the 
description:
   ```Guarantees the result of a comparison is `true` or `false` and not an 
empty set```
   
   So the description for the Spaceship Operator becomes:
   ```Three-way comparison operator. Guarantees the result of a comparison is 
`true` or `false` and not an empty set.```
   
   But I feel this explanation to be lacking. Hence my suggestion is to change 
the description of ```IS DISTINCT FROM`` to the one I have chosen for the 
Spaceship operator. Hence, the description for ```IS DISTINCT FROM``` would 
become:
   ```A NULL-safe operator that returns false if both operands are equal or 
both are NULL, true otherwise.```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to