-
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-8241][SQL] string function: concat_ws. #7504
Conversation
Test build #37749 has finished for PR 7504 at commit
|
Jenkins, retest this please. |
cc @davies |
child.eval(input) match { | ||
case s: UTF8String => Iterator(s) | ||
case arr: Seq[_] => arr.asInstanceOf[Seq[UTF8String]] | ||
case null => Iterator(null.asInstanceOf[UTF8String]) |
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.
minor: Can we just ignore the null
?
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? It won't match s. Also this thing doesn't compile if I do a wildcard match on s, e.g.
case s: _ => ...
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 mean we can return an empty Iterator
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.
that won't work for the 1st value (separator), unless we special case handle that.
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.
That make sense, thanks!
LGTM |
Test build #37761 has finished for PR 7504 at commit
|
I also changed the semantics of concat w.r.t. null back to the same behavior as Hive. That is to say, concat now returns null if any input is null.
@@ -79,7 +79,7 @@ abstract class DataType extends AbstractDataType { | |||
|
|||
override private[sql] def defaultConcreteType: DataType = this | |||
|
|||
override private[sql] def acceptsType(other: DataType): Boolean = this == other | |||
override private[sql] def acceptsType(other: DataType): Boolean = sameType(other) |
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.
cc @cloud-fan
This is changed to test sameType in order to support ArrayType(StringType)
Test build #37781 has finished for PR 7504 at commit
|
I also changed the semantics of concat w.r.t. null back to the same behavior as Hive.
That is to say, concat now returns null if any input is null.