-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-23908][SQL][FOLLOW-UP] Rename inputs to arguments, and add argument type check. #22075
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 #94599 has finished for PR 22075 at commit
|
|
Jenkins, retest this please. |
|
Test build #94604 has finished for PR 22075 at commit
|
| override def arguments: Seq[Expression] = argument :: Nil | ||
|
|
||
| override def inputs: Seq[Expression] = input :: Nil | ||
| def argumentType: AbstractDataType |
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.
shall we define a def argumentTypes: Seq[AbstractDataType] in HigherOrderFunction and implement checkArgumentDataTypes there?
|
|
||
| override def functions: Seq[Expression] = function :: Nil | ||
|
|
||
| def expectingFunctionType: AbstractDataType = AnyDataType |
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, why don't we define it in the HigherOrderFunction?
|
Test build #94651 has finished for PR 22075 at commit
|
|
Jenkins, retest this please. |
| assert(ex2.getMessage.contains("data type mismatch: argument 1 requires array type")) | ||
|
|
||
| val ex3 = intercept[AnalysisException] { | ||
| df.selectExpr("transform(a, x -> x)") |
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.
what's the previous behavior?
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.
The previous behavior was the same. I just added to check the behavior is as expected.
| // Check argument data types of higher-order functions downwards first. | ||
| // If the arguments of the higher-order functions are resolved but the type check fails, | ||
| // the argument functions will not get resolved, but we should report the argument type | ||
| // check failure instead of claiming the function arguments are unresolved. |
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.
"function arguments" -> "argument functions"?
|
LGTM |
| case operator: LogicalPlan => | ||
| // Check argument data types of higher-order functions downwards first. | ||
| // If the arguments of the higher-order functions are resolved but the type check fails, | ||
| // the argument functions will not get resolved, but we should report the argument type |
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.
actually, I think it's clearer to say functions, instead of argument functions. Sorry for the back and forth.
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 worried that if we say only functions, we might be confused whether the "function" means the higher-order function or the function as an argument. WDYT?
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.
ah i see, makes sense.
|
Test build #94657 has finished for PR 22075 at commit
|
|
Test build #94663 has finished for PR 22075 at commit
|
|
Test build #94668 has finished for PR 22075 at commit
|
|
retest this please |
|
Test build #94674 has finished for PR 22075 at commit
|
|
Jenkins, retest this please. |
|
Test build #94679 has finished for PR 22075 at commit
|
|
thanks, merging to master! |
| s"however, '${merge.sql}' is of ${merge.dataType.catalogString} type.") | ||
| } else { | ||
| TypeCheckResult.TypeCheckSuccess | ||
| checkArgumentDataTypes() match { |
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.
just a quick question: Isn't calling of checkArgumentDataTypes extra here if checkArgumentDataTypes is called as such before checkInputDataTypes?
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 called it here again to check the whole data types when calling checkInputDataTypes(), just in case.
What changes were proposed in this pull request?
This is a follow-up pr of #21954 to address comments.
inputstoarguments.How was this patch tested?
Existing tests and some additional tests.