Uh oh!
There was an error while loading. Please reload this page.
[SPARK-8945][SQL] Add add and subtract expressions for IntervalType - #7398
[SPARK-8945][SQL] Add add and subtract expressions for IntervalType#7398viirya wants to merge 8 commits into
Conversation
SparkQA
commented
Jul 14, 2015
Test build #37240 has finished for PR 7398 at commit
|
There was a problem hiding this comment.
this seems excessive, since it won't work for multiply or division.
rxin
commented
Jul 15, 2015
Let's revisit this patch once #7348 is merged. |
SparkQA
commented
Jul 15, 2015
Test build #37301 has finished for PR 7398 at commit
|
viirya
commented
Jul 15, 2015
A failure about modified error message. I will update soon. |
SparkQA
commented
Jul 15, 2015
Test build #37316 has finished for PR 7398 at commit
|
viirya
commented
Jul 15, 2015
There are some conflicts since #7348 is merged. I will update later. |
There was a problem hiding this comment.
Now #7348 is in, just create a TypeCollection that contains all the numeric types as well as interval type.
…ract Conflicts: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/TypeUtils.scala
There was a problem hiding this comment.
i don't think you want this -- it is super slow. Just remove this function, and define codegen in Add / Subtract, rather than relying on what BinaryArithmetic provides.
There was a problem hiding this comment.
ok. I wanted to avoid defining codegen in two operations. Update later together.
…ract Conflicts: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/ExpressionTypeCheckingSuite.scala
There was a problem hiding this comment.
just inline $decimalMethod here; don't define the function anymore.
rxin
commented
Jul 15, 2015
LGTM other than that. |
rxin
commented
Jul 15, 2015
LGTM |
SparkQA
commented
Jul 15, 2015
Test build #37330 has finished for PR 7398 at commit
|
SparkQA
commented
Jul 15, 2015
Test build #37337 has finished for PR 7398 at commit
|
SparkQA
commented
Jul 15, 2015
Test build #37342 has finished for PR 7398 at commit
|
viirya
commented
Jul 15, 2015
Looks like an unrelated failure. |
SparkQA
commented
Jul 15, 2015
Test build #37339 has finished for PR 7398 at commit
|
There was a problem hiding this comment.
can we simplify it to TypeCollection(NumericType, IntervalType)?
There was a problem hiding this comment.
Because TypeCollection also specifies precedence for types, I am not sure if it works when we use NumericType here?
There was a problem hiding this comment.
Actually we should use NumericType here.
Think about 2 + "2", before this PR, we will first cast "2" to 2.0(double is the default for numeric type), and then the result should be double 4.0. After this PR, we will first cast "2" to 2(byte is the default for your type collection), and thus make the result of type int.
There was a problem hiding this comment.
OK. Another problem that might be minor is that the casting error message will become argument 1 is expected to be of type (numeric or interval), instead of ...type (tinyint or smallint or int or bigint or float or double or decimal or interval....
Is it still informative? Because supposed that NumericType should be internal? Will users know what type is numeric meaning?
There was a problem hiding this comment.
I saw there are already use cases for directly showing numeric in error message. So I updated this too.
cloud-fan
commented
Jul 15, 2015
lgtm |
…ract Conflicts: sql/catalyst/src/main/scala/org/apache/spark/sql/types/AbstractDataType.scala
JIRA: https://issues.apache.org/jira/browse/SPARK-8945
Add add and subtract expressions for IntervalType.