-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-32743][SQL] Add distinct info at UnresolvedFunction toString #29586
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
|
@maropu sorry for the late pr. |
| override def toString: String = s"'$name(${children.mkString(", ")})" | ||
| override def toString: String = { | ||
| val distinct = if (isDistinct) "distinct " else "" | ||
| s"'$name($distinct${children.mkString(", ")})" |
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.
We need to handle filter, too?
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.
filter as a child already exists.
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. But, its better to reformat the output, 'Project [unresolvedalias('sum('c1), None)] into 'Project [unresolvedalias('sum('c1))] because None looks ambigous for users.
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 none is introduced by unresolvedalias, shall we reformat it in this pr ?
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.
Seems we can check none in Expression.flatArguments to avoid these case.
protected def flatArguments: Iterator[Any] = stringArgs.flatMap {
case t: Iterable[_] => t
case single => single :: Nil
case None => Nil
}
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.
Oh, ok. Yea, can you? NVM, on second thought, the current one looks okay.
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.
Does this like ok ? please tell me if need to do anything else.
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.
Could you add tests somewhere?
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.
How about add test in explain.sql ? like this
-- distinct func
EXPLAIN EXTENDED
SELECT sum(distinct val)
FROM explain_temp1
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.
sgtm
|
Test build #128056 has finished for PR 29586 at commit
|
|
Test build #128373 has finished for PR 29586 at commit
|
|
Test build #128379 has finished for PR 29586 at commit
|
|
Test build #128392 has finished for PR 29586 at commit
|
|
Test build #128402 has finished for PR 29586 at commit
|
|
Test build #128411 has finished for PR 29586 at commit
|
|
Test build #128726 has finished for PR 29586 at commit
|
|
Test build #128733 has finished for PR 29586 at commit
|
|
Test build #128741 has finished for PR 29586 at commit
|
|
retest this please |
|
cc: @HyukjinKwon @viirya |
|
Kubernetes integration test starting |
|
Kubernetes integration test status success |
|
@ulysses-you could you fix the test failures? |
|
retest this please |
|
Test build #129337 has finished for PR 29586 at commit
|
|
Kubernetes integration test starting |
|
Kubernetes integration test status success |
|
thanks @maropu, can you trigger an another test ? I'm not sure if it is a related test failure. |
You cannot do so? |
|
retest this please |
|
Kubernetes integration test starting |
|
Kubernetes integration test status success |
|
Test build #129453 has finished for PR 29586 at commit
|
|
The test failure looks valid. |
|
Kubernetes integration test starting |
|
Kubernetes integration test status success |
|
Test build #129555 has finished for PR 29586 at commit
|
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #129556 has finished for PR 29586 at commit
|
|
Thanks! Merged to master. |
|
thanks for merging ! |
### What changes were proposed in this pull request?
Add distinct info at `UnresolvedFunction.toString`.
### Why are the changes needed?
Make `UnresolvedFunction` info complete.
```
create table test (c1 int, c2 int);
explain extended select sum(distinct c1) from test;
-- before this pr
== Parsed Logical Plan ==
'Project [unresolvedalias('sum('c1), None)]
+- 'UnresolvedRelation [test]
-- after this pr
== Parsed Logical Plan ==
'Project [unresolvedalias('sum(distinct 'c1), None)]
+- 'UnresolvedRelation [test]
```
### Does this PR introduce _any_ user-facing change?
Yes, get distinct info during sql parse.
### How was this patch tested?
manual test.
Closes apache#29586 from ulysses-you/SPARK-32743.
Authored-by: ulysses <[email protected]>
Signed-off-by: Takeshi Yamamuro <[email protected]>
(cherry picked from commit a907729)
# Conflicts:
# sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/unresolved.scala
# sql/core/src/test/resources/sql-tests/results/explain-aqe.sql.out
# sql/core/src/test/resources/sql-tests/results/explain.sql.out
What changes were proposed in this pull request?
Add distinct info at
UnresolvedFunction.toString.Why are the changes needed?
Make
UnresolvedFunctioninfo complete.Does this PR introduce any user-facing change?
Yes, get distinct info during sql parse.
How was this patch tested?
manual test.