- 
                Notifications
    You must be signed in to change notification settings 
- Fork 28.9k
[SPARK-30125][SQL] Remove PostgreSQL dialect #26763
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
Conversation
| Test build #114883 has finished for PR 26763 at commit  
 | 
| cc @gatorsmile because this PR seems to be ready. | 
| Thanks Dongjoon, also cc @cloud-fan | 
        
          
                sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4
          
            Show resolved
            Hide resolved
        
      | : qualifiedName (',' qualifiedName)* | ||
| ; | ||
|  | ||
| functionName | 
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.
this is for ANSI-compliant, not pgsql dialect, we should keep it.
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.
ditto
        
          
                sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala
          
            Show resolved
            Hide resolved
        
              
          
                sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala
          
            Show resolved
            Hide resolved
        
              
          
                sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/StringUtils.scala
          
            Show resolved
            Hide resolved
        
      | Note that, we want to revert pgsql dialect, but not all pgsql compatibility features. A simple policy: if a behavior is not protected by  | 
…endent of ansi mode config" This reverts commit 23b3c4f.
This reverts commit fe1f456.
…sql.dialect.spark.ansi.enabled"" This reverts commit 40ea4a1.
…rding to SQL standard" This reverts commit d11cbf2.
This reverts commit a1213d5.
…"0", and unique prefixes as input and trim input for the boolean data type" This reverts commit 3b07a4e.
This reverts commit 6926849.
….preferIntegralDivision for PostgreSQL testing" This reverts commit 71882f1.
… SQL standard Proposed new expression `SubtractDates` which is used in `date1` - `date2`. It has the `INTERVAL` type, and returns the interval from `date1` (inclusive) and `date2` (exclusive). For example: ```sql > select date'tomorrow' - date'yesterday'; interval 2 days ``` Closes apache#26034 - To conform the SQL standard which states the result type of `date operand 1` - `date operand 2` must be the interval type. See [4.5.3 Operations involving datetimes and intervals](http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt). - Improve Spark SQL UX and allow mixing date and timestamp in subtractions. For example: `select timestamp'now' + (date'2019-10-01' - date'2019-09-15')` Before the query below returns number of days: ```sql spark-sql> select date'2019-10-05' - date'2018-09-01'; 399 ``` After it returns an interval: ```sql spark-sql> select date'2019-10-05' - date'2018-09-01'; interval 1 years 1 months 4 days ``` - by new tests in `DateExpressionsSuite` and `TypeCoercionSuite`. - by existing tests in `date.sql` Closes apache#26112 from MaxGekk/date-subtract. Authored-by: Maxim Gekk <[email protected]> Signed-off-by: Yuming Wang <[email protected]>
…f ansi mode config Fix the inconsistent behavior of build-in function SQL LEFT/RIGHT. As the comment in apache#26497 (comment), Postgre dialect should not be affected by the ANSI mode config. During reran the existing tests, only the LEFT/RIGHT build-in SQL function broke the assumption. We fix this by following https://www.postgresql.org/docs/12/sql-keywords-appendix.html: `LEFT/RIGHT reserved (can be function or type)` Yes, the Postgre dialect will not be affected by the ANSI mode config. Existing UT. Closes apache#26584 from xuanyuanking/SPARK-29951. Authored-by: Yuanjian Li <[email protected]> Signed-off-by: Wenchen Fan <[email protected]>
f7ad82e    to
    cc14274      
    Compare
  
    | @cloud-fan Thanks for the guidance, it takes me some time to reprocess all the related commits. | 
        
          
                sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                ...catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/DateExpressionsSuite.scala
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                sql/core/src/test/resources/sql-tests/inputs/postgreSQL/boolean.sql
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                sql/core/src/test/resources/sql-tests/inputs/postgreSQL/boolean.sql
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                sql/core/src/test/resources/sql-tests/inputs/postgreSQL/int2.sql
              
                Outdated
          
            Show resolved
            Hide resolved
        
      | Test build #115041 has finished for PR 26763 at commit  
 | 
| Test build #115038 has finished for PR 26763 at commit  
 | 
| Test build #115101 has finished for PR 26763 at commit  
 | 
| thanks, merging to master! | 
| Thanks Wenchen! | 
| Thank you, @xuanyuanking and @cloud-fan . Also, cc to the original authors, too. Although we removed these, we are thankful for your original contributions. Sorry again. | 
What changes were proposed in this pull request?
Reprocess all PostgreSQL dialect related PRs, listing in order:
spark.sql.dialect#25697: Combine below 2 feature tags into "spark.sql.dialect" [revert]Why are the changes needed?
As the discussion in http://apache-spark-developers-list.1001551.n3.nabble.com/DISCUSS-PostgreSQL-dialect-td28417.html, we need to remove PostgreSQL dialect form code base for several reasons:
Does this PR introduce any user-facing change?
Yes, the config
spark.sql.dialectwill be removed.How was this patch tested?
Existing UT.