-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-29774][SQL] Date and Timestamp type +/- null should be null as Postgres #26412
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
0b293db
[SPARK-29774][SQL] Date and Timestamp type +/- null should be null as…
yaooqinn f726297
Merge branch 'master' into SPARK-29774
yaooqinn e7225a3
regen golden file
yaooqinn b925517
null - dates
yaooqinn cd49411
Merge branch 'master' into SPARK-29774
yaooqinn 57b13e9
support +/-
yaooqinn eab6a83
support ×/÷
yaooqinn e8b75ba
import
yaooqinn 02b3738
childResolved required
yaooqinn e89d806
regen golden file
yaooqinn 0694e07
update comments
yaooqinn 0f5618b
fix tests
yaooqinn efab3ec
fix tests
yaooqinn 1c27be1
refine case match pattern
yaooqinn 5df6980
fix ut
yaooqinn 9817d2d
hack assert Equal
yaooqinn 9808b9c
regen g f
yaooqinn b190612
AnalysisTest
yaooqinn e544137
regen g f
yaooqinn 83705fd
fix test
yaooqinn 846802d
date add/sub only work for int/smallint/tinyint
yaooqinn 4af7edb
regen g f
yaooqinn a67be30
refine
yaooqinn 9a1affd
type coercion for subtract timestamp
yaooqinn ae70022
add and reorgnize tests in datetime.sql
yaooqinn 571225b
DateExpressionsSuite
yaooqinn 6052e5a
fix py
yaooqinn 928fd86
fix py
yaooqinn 254d2d2
Revert "fix py"
yaooqinn 5dd632c
fix py
yaooqinn c84d46e
rm unresolved binary arithmetic
yaooqinn a44948e
import
yaooqinn 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
rm unresolved binary arithmetic
- Loading branch information
commit c84d46ea6d384dcb1f442ca54abad48e59c92bb3
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -16,29 +16,19 @@ | |
| */ | ||
| package org.apache.spark.sql.catalyst.parser | ||
|
|
||
| import org.apache.spark.sql.catalyst.analysis.{AnalysisTest, UnresolvedAdd, UnresolvedDivide, UnresolvedMultiply, UnresolvedSubtract} | ||
| import org.apache.spark.sql.catalyst.expressions.{Add, Divide, Multiply, Subtract} | ||
| import org.apache.spark.sql.catalyst.analysis.AnalysisTest | ||
| import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan | ||
|
|
||
| /** | ||
| * Test various parser errors. | ||
| */ | ||
| class ErrorParserSuite extends AnalysisTest { | ||
| import CatalystSqlParser._ | ||
| import org.apache.spark.sql.catalyst.dsl.expressions._ | ||
| import org.apache.spark.sql.catalyst.dsl.plans._ | ||
| import org.apache.spark.sql.catalyst.parser.CatalystSqlParser._ | ||
|
||
|
|
||
| private def assertEqual(sqlCommand: String, plan: LogicalPlan): Unit = { | ||
| val resolvedPlan = parsePlan(sqlCommand) resolveOperatorsUp { | ||
| case p: LogicalPlan => p transformAllExpressions { | ||
| case UnresolvedAdd(l, r) => Add(l, r) | ||
| case UnresolvedSubtract(l, r) => Subtract(l, r) | ||
| case UnresolvedMultiply(l, r) => Multiply(l, r) | ||
| case UnresolvedDivide(l, r) => Divide(l, r) | ||
| case other => other | ||
| } | ||
| } | ||
| assert(resolvedPlan == plan) | ||
| assert(parsePlan(sqlCommand) == plan) | ||
| } | ||
|
|
||
| def intercept(sqlCommand: String, messages: String*): Unit = | ||
|
|
||
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -18,7 +18,7 @@ | |
| package org.apache.spark.sql.catalyst.parser | ||
|
|
||
| import org.apache.spark.sql.catalyst.{FunctionIdentifier, TableIdentifier} | ||
| import org.apache.spark.sql.catalyst.analysis.{AnalysisTest, UnresolvedAlias, UnresolvedAttribute, UnresolvedDivide, UnresolvedFunction, UnresolvedGenerator, UnresolvedInlineTable, UnresolvedRelation, UnresolvedSubqueryColumnAliases, UnresolvedTableValuedFunction} | ||
| import org.apache.spark.sql.catalyst.analysis.{AnalysisTest, UnresolvedAlias, UnresolvedAttribute, UnresolvedFunction, UnresolvedGenerator, UnresolvedInlineTable, UnresolvedRelation, UnresolvedSubqueryColumnAliases, UnresolvedTableValuedFunction} | ||
| import org.apache.spark.sql.catalyst.expressions._ | ||
| import org.apache.spark.sql.catalyst.plans._ | ||
| import org.apache.spark.sql.catalyst.plans.logical._ | ||
|
|
@@ -31,9 +31,9 @@ import org.apache.spark.sql.types.IntegerType | |
| * There is also SparkSqlParserSuite in sql/core module for parser rules defined in sql/core module. | ||
| */ | ||
| class PlanParserSuite extends AnalysisTest { | ||
| import CatalystSqlParser._ | ||
| import org.apache.spark.sql.catalyst.dsl.expressions._ | ||
| import org.apache.spark.sql.catalyst.dsl.plans._ | ||
| import org.apache.spark.sql.catalyst.parser.CatalystSqlParser._ | ||
|
||
|
|
||
| private def assertEqual(sqlCommand: String, plan: LogicalPlan): Unit = { | ||
| comparePlans(parsePlan(sqlCommand), plan, checkAnalysis = false) | ||
|
|
@@ -240,8 +240,7 @@ class PlanParserSuite extends AnalysisTest { | |
| val sql = "select * from t" | ||
| val plan = table("t").select(star()) | ||
| assertEqual(s"$sql limit 10", plan.limit(10)) | ||
| assertEqual(s"$sql limit cast(9 / 4 as int)", | ||
| plan.limit(Cast(UnresolvedDivide(9, 4), IntegerType))) | ||
| assertEqual(s"$sql limit cast(9 / 4 as int)", plan.limit(Cast(Literal(9) / 4, IntegerType))) | ||
| } | ||
|
|
||
| test("window spec") { | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.