Uh oh!
There was an error while loading. Please reload this page.
[SPARK-18398][SQL] Fix nullabilities of MapObjects and ExternalMapToCatalyst. - #15840
[SPARK-18398][SQL] Fix nullabilities of MapObjects and ExternalMapToCatalyst.#15840ueshin wants to merge 11 commits into
Conversation
…bda is not nullable.
SparkQA
commented
Nov 10, 2016
Test build #68462 has finished for PR 15840 at commit
|
ueshin
commented
Nov 10, 2016
Jenkins, retest this please. |
hvanhovell
commented
Nov 10, 2016
On a whole this PR looks good. On a more general level, I would like to suggest that we should have a more generic way of preventing unneeded null-checks. |
SparkQA
commented
Nov 10, 2016
Test build #68466 has finished for PR 15840 at commit
|
kiszk
commented
Nov 10, 2016
Do we prepare a utility method like this in defgenNullableAssignment(genIsNull: boolean, isNull: boolean, lhs: String, rhs: String): String = {
if (genIsNull) {
s"""
if ($isNull) {
$lhs = null;
} else {
$lhs = rhs;
}
"""
} else {
s"$lhs = $rhs;"
}
} |
hvanhovell
commented
Nov 10, 2016
@kiszk that could be a start. However I would like to take a step back, and see which nullability checking patterns are common, and provide generic utilities for them. I also think that the proper use of |
kiszk
commented
Nov 10, 2016
@hvanhovell Thank for pointing out |
ueshin
commented
Nov 10, 2016
I found that we could use |
ueshin
commented
Nov 11, 2016
@hvanhovell@kiszk I tried to use |
SparkQA
commented
Nov 11, 2016
Test build #68509 has finished for PR 15840 at commit
|
Does this approach avoid to generate code I am curious that whether the current restriction (generate only if-then) in |
ueshin
commented
Nov 12, 2016
@kiszk I have not checked all the case yet but I think the case that we need to generate else-clause doesn't match the case we discuss here. |
kiszk
commented
Nov 12, 2016
I agree that this case is fine. |
ueshin
commented
Nov 14, 2016
I replaced nullability checking where we can use |
ueshin
commented
Nov 14, 2016
@hvanhovell The pattern basically I used to replace nullability checking here is like: valeval= child.genCode(ctx)
ev.copy(code =s"""${eval.code}
boolean ${ev.isNull} = ${eval.isNull};${ctx.javaType(dataType)}${ev.value} = ${ctx.defaultValue(dataType)}; if (!${ev.isNull}) {${ev.value} = something; }""")into: valeval= child.genCode(ctx)
ev.copy(code =s"""${eval.code}
${ctx.javaType(dataType)}${ev.value} = ${ctx.defaultValue(dataType)};"""+
ctx.nullSafeExec(child.nullable, eval.isNull)(s"""${ev.value} = something;"""), isNull = child.isNull)Some of them are modified to fit each case. Does this help you think about generic utilities? |
SparkQA
commented
Nov 14, 2016
Test build #68607 has finished for PR 15840 at commit
|
SparkQA
commented
Nov 14, 2016
Test build #68627 has finished for PR 15840 at commit
|
SparkQA
commented
Nov 14, 2016
Test build #68629 has finished for PR 15840 at commit
|
ueshin
commented
Nov 17, 2016
@hvanhovell I'd like to revert some of commits in this pr which replace null checking with |
@hvanhovell Could you review this pr again, please? I reverted some commits which replace null checking with |
hvanhovell
commented
Nov 21, 2016
LGTM - pending jenkins. Small question: is it really easier for Janino to optimize ternary operators than an if/else block? |
ueshin
commented
Nov 21, 2016
@hvanhovell Ah, good question. I checked the Janino code around I'll revert them. |
ueshin
commented
Nov 21, 2016
Finally the purpose of this pr is to fix nullabilities of |
hvanhovell
commented
Nov 21, 2016
retest this please |
SparkQA
commented
Nov 21, 2016
Test build #68931 has finished for PR 15840 at commit
|
SparkQA
commented
Nov 21, 2016
Test build #68933 has finished for PR 15840 at commit
|
SparkQA
commented
Nov 21, 2016
Test build #68934 has finished for PR 15840 at commit
|
hvanhovell
commented
Nov 21, 2016
Merging to master/2.1. Thanks! |
…atalyst. ## What changes were proposed in this pull request? The nullabilities of `MapObject` can be made more strict by relying on `inputObject.nullable` and `lambdaFunction.nullable`. Also `ExternalMapToCatalyst.dataType` can be made more strict by relying on `valueConverter.nullable`. ## How was this patch tested? Existing tests. Author: Takuya UESHIN <ueshin@happy-camper.st> Closes#15840 from ueshin/issues/SPARK-18398. (cherry picked from commit 9f262ae) Signed-off-by: Herman van Hovell <hvanhovell@databricks.com>
…atalyst. ## What changes were proposed in this pull request? The nullabilities of `MapObject` can be made more strict by relying on `inputObject.nullable` and `lambdaFunction.nullable`. Also `ExternalMapToCatalyst.dataType` can be made more strict by relying on `valueConverter.nullable`. ## How was this patch tested? Existing tests. Author: Takuya UESHIN <ueshin@happy-camper.st> Closesapache#15840 from ueshin/issues/SPARK-18398.
What changes were proposed in this pull request?
The nullabilities of
MapObjectcan be made more strict by relying oninputObject.nullableandlambdaFunction.nullable.Also
ExternalMapToCatalyst.dataTypecan be made more strict by relying onvalueConverter.nullable.How was this patch tested?
Existing tests.