-
Notifications
You must be signed in to change notification settings - Fork 28.4k
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
[SPARK-8075][SQL] apply type check interface to more expressions #6723
Conversation
Test build #34506 has finished for PR 6723 at commit
|
6f09d05
to
305be74
Compare
*/ | ||
def checkInputDataTypes(): TypeCheckResult = TypeCheckResult.TypeCheckSuccess | ||
def checkInputDataTypes(): TypeCheckResult |
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.
Do we really want this? There are a lot of expressions that don't need type check...
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.
ok i agree with you maybe we should implement this by default to be always "success", so we don't need to define this for every expression.
Test build #34509 has finished for PR 6723 at commit
|
Test build #34508 has finished for PR 6723 at commit
|
@@ -89,6 +89,8 @@ case class UnresolvedFunction(name: String, children: Seq[Expression]) extends E | |||
throw new TreeNodeException(this, s"No function to evaluate expression. type: ${this.nodeName}") | |||
|
|||
override def toString: String = s"'$name(${children.mkString(",")})" | |||
|
|||
override def checkInputDataTypes(): TypeCheckResult = TypeCheckResult.TypeCheckSuccess |
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.
why do they need to be here?
8423bc7
to
3c3c87b
Compare
@@ -69,7 +69,7 @@ case class WindowSpecDefinition( | |||
override def children: Seq[Expression] = partitionSpec ++ orderSpec | |||
|
|||
override lazy val resolved: Boolean = | |||
childrenResolved && frameSpecification.isInstanceOf[SpecifiedWindowFrame] | |||
childrenResolved && checkInputDataTypes().isSuccess && frameSpecification.isInstanceOf[SpecifiedWindowFrame] |
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.
I'm thinking of making resolved
final, and add a overridable method like extraResolveLogic
, so that people won't forget to check types when they override resolved
.
Test build #34684 has finished for PR 6723 at commit
|
772866d
to
0faa15a
Compare
Test build #35244 has finished for PR 6723 at commit
|
findTightestCommonTypeAndPromoteToString(types) match { | ||
case Some(finalDataType) => CreateArray(children.map(Cast(_, finalDataType))) | ||
case None => a | ||
} |
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.
I checked with hive, CreateArray
should cast input to string, but with some rules like Coalesce
did. For example we should not cast boolean to string for CreateArray
.
Test build #35387 has finished for PR 6723 at commit
|
Test build #35388 has finished for PR 6723 at commit
|
Test build #35392 has finished for PR 6723 at commit
|
Test build #35637 has finished for PR 6723 at commit
|
cc @rxin |
Thanks! Merging to master. |
a follow up of #6405.
Note: It's not a big change, a lot of changing is due to I swap some code in
aggregates.scala
to make aggregate functions right below its corresponding aggregate expressions.