beliefer opened a new pull request #25074: [SPARK-27924][SQL] Support ANSI SQL 
Boolean-Predicate syntax 
URL: https://github.com/apache/spark/pull/25074
 
 
   ## What changes were proposed in this pull request?
   
   This PR aims to support ANSI SQL `Boolean-Predicate` syntax.
   ```sql
   expression IS [NOT] TRUE
   expression IS [NOT] FALSE
   expression IS [NOT] UNKNOWN
   ```
   
   There are some mainstream database support this syntax.
   - **PostgreSQL:**  
https://www.postgresql.org/docs/9.1/functions-comparison.html
   - **Hive:** https://issues.apache.org/jira/browse/HIVE-13583
   - **Redshift:** 
https://docs.aws.amazon.com/redshift/latest/dg/r_Boolean_type.html
   - **Vertica:** 
https://www.vertica.com/docs/9.2.x/HTML/Content/Authoring/SQLReferenceManual/LanguageElements/Predicates/Boolean-predicate.htm
   
   For example:
   ```sql
   spark-sql> select null is true;
   false
   
   spark-sql> select null is not true;
   true
   
   spark-sql> select false is true;
   false
   
   spark-sql> select false is not true;
   true
   
   spark-sql> select true is true;
   true
   
   spark-sql> select true is not true;
   false
   
   spark-sql> select null is false;
   false
   
   spark-sql> select null is not false;
   true
   
   spark-sql> select false is false;
   true
   
   spark-sql> select false is not false;
   false
   
   spark-sql> select true is false;
   false
   
   spark-sql> select true is not false;
   true
   
   spark-sql> select null is unknown;
   true
   
   spark-sql> select null is not unknown;
   false
   
   spark-sql> select false is unknown;
   false
   
   spark-sql> select false is not unknown;
   true
   
   spark-sql> select true is unknown;
   false
   
   spark-sql> select true is not unknown;
   true
   ```
   **Note**: A null input is treated as the logical value "unknown".
   
   ## How was this patch tested?
   
   Pass the Jenkins with the newly added test cases.
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to