-
Notifications
You must be signed in to change notification settings - Fork 28.1k
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-9154][SQL] codegen StringFormat #7546
Conversation
Jenkins, ok to test |
Test build #1128 has finished for PR 7546 at commit
|
Test build #1131 has finished for PR 7546 at commit
|
@@ -476,7 +476,7 @@ case class StringRPad(str: Expression, len: Expression, pad: Expression) | |||
/** | |||
* Returns the input formatted according do printf-style format strings | |||
*/ | |||
case class StringFormat(children: Expression*) extends Expression with CodegenFallback { | |||
case class StringFormat(children: Expression*) extends Expression { |
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 should probably add ImplicitCastInputTypes
with a string for the first argument and AnyDataType
for remaining children.
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 do have to split the signature for this to StringFormat(string: Expression, args: Expression*)
, don't I?
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.
No, I don't think so. We just zip with children
to check the types so I think it can work either way. Just remember to subtract 1 when figuring out how many AnyDataTypes to fill in.
@@ -486,6 +486,10 @@ case class StringFormat(children: Expression*) extends Expression with CodegenFa | |||
private def format: Expression = children(0) | |||
private def args: Seq[Expression] = children.tail | |||
|
|||
override def inputTypes: Seq[AbstractDataType] = | |||
children.zipWithIndex.map(x => if (x._2 == 0) StringType else 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.
@marmbrus Is this what you proposed?
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.
This works. I think StringType :: List.fill(children.size - 1)(AnyDataType)
might be a little more clear.
Thanks! I'm going to merge to master. |
This reverts commit 7f072c3. Revert #7546 Author: Michael Armbrust <michael@databricks.com> Closes #7570 from marmbrus/revert9154 and squashes the following commits: ed2c32a [Michael Armbrust] Revert "[SPARK-9154] [SQL] codegen StringFormat"
Jira: https://issues.apache.org/jira/browse/SPARK-9154 fixes bug of #7546 marmbrus I can't reopen the other PR, because I didn't closed it. Can you trigger Jenkins? Author: Tarek Auel <tarek.auel@googlemail.com> Closes #7571 from tarekauel/SPARK-9154 and squashes the following commits: dcae272 [Tarek Auel] [SPARK-9154][SQL] build fix 1487602 [Tarek Auel] Merge remote-tracking branch 'upstream/master' into SPARK-9154 f512c5f [Tarek Auel] [SPARK-9154][SQL] build fix a943d3e [Tarek Auel] [SPARK-9154] implicit input cast, added tests for null, support for null primitives 10b4de8 [Tarek Auel] [SPARK-9154][SQL] codegen removed fallback trait cd8322b [Tarek Auel] [SPARK-9154][SQL] codegen string format 086caba [Tarek Auel] [SPARK-9154][SQL] codegen string format
Jira: https://issues.apache.org/jira/browse/SPARK-9154