-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-21338][SQL][FOLLOW-UP] Implement isCascadingTruncateTable() method in AggregatedDialect #19286
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
| } | ||
| override def isCascadingTruncateTable(): Option[Boolean] = Some(false) | ||
| }, testH2Dialect)) | ||
| assert(agg2.isCascadingTruncateTable() === None) |
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.
Let us add test cases to enumerate all the combinations of None, true and false
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.
Added a test case for it.
|
Test build #81973 has finished for PR 19286 at commit
|
|
Test build #81965 has finished for PR 19286 at commit
|
|
retest this please. |
|
Test build #81976 has finished for PR 19286 at commit
|
|
retest this please. |
|
Test build #81985 has finished for PR 19286 at commit
|
|
@gatorsmile Does the added test look good for you? Thanks. |
|
ping @gatorsmile |
|
|
||
| val expectedCascading = Seq(Some(true), Some(true), None, Some(true), Some(false), None) | ||
|
|
||
| dialectCombination.zip(expectedCascading).foreach { case (dialects, cascading) => |
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 we combine dialectCombination and expectedCascading together? Or we can create a separate helper function?
| if (cascading.getOrElse(false)) { | ||
| cascading | ||
| } else { | ||
| if (dialects.exists(_.isCascadingTruncateTable().isEmpty)) { |
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.
combine line 51 and 52?
| // If any dialect claims cascading truncate, this dialect is also cascading truncate. | ||
| // Otherwise, if any dialect has unknown cascading truncate, this dialect is also unknown. | ||
| val cascading = dialects.flatMap(_.isCascadingTruncateTable()).reduceOption(_ || _) | ||
| if (cascading.getOrElse(false)) { |
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.
Use case-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.
Done.
|
@viirya Hey simon, thanks for catching this. Will it be little easier to follow if we wrote like this ? |
|
@dilipbiswal Thanks for the suggestion. However, it looks more complicated, IMO. |
|
@viirya No problem. The newer version you have looks clean as well. |
|
Test build #82123 has finished for PR 19286 at commit
|
|
LGTM |
|
Thanks! Merged to master |
What changes were proposed in this pull request?
The implemented
isCascadingTruncateTableinAggregatedDialectis wrong. When no dialect claims cascading, once there is an unknown cascading truncate in the dialects, we should return unknown cascading, instead of false.How was this patch tested?
Added test.