Uh oh!
There was an error while loading. Please reload this page.
[SPARK-20754][SQL] Support TRUNC (number) - #18106
Conversation
SparkQA
commented
May 25, 2017
Test build #77361 has finished for PR 18106 at commit
|
SparkQA
commented
May 25, 2017
Test build #77370 has finished for PR 18106 at commit
|
SparkQA
commented
May 26, 2017
Test build #77394 has finished for PR 18106 at commit
|
SparkQA
commented
May 26, 2017
Test build #77399 has finished for PR 18106 at commit
|
## What changes were proposed in this pull request? apache#18106 Support TRUNC (number), We should also add function alias for `MOD `and `POSITION`. `POSITION(substr IN str) `is a synonym for `LOCATE(substr,str)`. same as MySQL: https://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_position ## How was this patch tested? unit tests Author: Yuming Wang <wgyumg@gmail.com> Closesapache#18206 from wangyum/SPARK-20754-mod&position.
Conflicts: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/misc.scala sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/MiscExpressionsSuite.scala sql/core/src/test/resources/sql-tests/inputs/datetime.sql sql/core/src/test/resources/sql-tests/inputs/operators.sql sql/core/src/test/resources/sql-tests/results/datetime.sql.out sql/core/src/test/resources/sql-tests/results/operators.sql.out
SparkQA
commented
Jun 14, 2017
Test build #78057 has finished for PR 18106 at commit
|
SparkQA
commented
Jun 15, 2017
Test build #78080 has started for PR 18106 at commit |
wangyum
commented
Jun 15, 2017
Jenkins, retest this please |
SparkQA
commented
Jun 15, 2017
Test build #78094 has finished for PR 18106 at commit
|
wangyum
commented
Jun 15, 2017
cc @gatorsmile |
## What changes were proposed in this pull request? apache#18106 Support TRUNC (number), We should also add function alias for `MOD `and `POSITION`. `POSITION(substr IN str) `is a synonym for `LOCATE(substr,str)`. same as MySQL: https://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_position ## How was this patch tested? unit tests Author: Yuming Wang <wgyumg@gmail.com> Closesapache#18206 from wangyum/SPARK-20754-mod&position.
SparkQA
commented
Jun 20, 2017
Test build #78273 has started for PR 18106 at commit |
wangyum
commented
Jun 20, 2017
Retest this please. |
SparkQA
commented
Jun 20, 2017
Test build #78325 has started for PR 18106 at commit |
shaneknapp
commented
Jun 21, 2017
test this please |
SparkQA
commented
Jun 21, 2017
Test build #78344 has started for PR 18106 at commit |
shaneknapp
commented
Jun 21, 2017
test this please |
| override def inputTypes: Seq[AbstractDataType] = | ||
| Seq(TypeCollection(DateType, DoubleType, DecimalType), | ||
| TypeCollection(StringType, IntegerType)) |
There was a problem hiding this comment.
I think this might lead to wrong input types combinations such as (DoubleType, StringType) and (DateType, IntegerType)?
There was a problem hiding this comment.
If we are going to have only trunc for truncating number and datetime. We should prevent wrong input types.
viirya
commented
Jun 21, 2017
Is there duplicated codes between trunc(number) and trunc(date)? If no, seems to me we don't necessarily let one expression to have two different features. |
viirya
commented
Jun 21, 2017
Although then we can't use just one |
SparkQA
commented
Jun 27, 2017
Test build #78693 has finished for PR 18106 at commit
|
| @since(1.5) | ||
| def trunc(date, format): | ||
| def trunc(data, truncParam): |
There was a problem hiding this comment.
I believe this definitely breaks backward compatibility for keyword-argument usage in Python.
felixcheung
commented
Jun 27, 2017
I'll add @gatorsmile since this is SQL. |
wangyum
commented
Jun 28, 2017
Jenkins, retest this please |
SparkQA
commented
Jun 28, 2017
Test build #78786 has finished for PR 18106 at commit
|
gatorsmile
commented
Jul 31, 2017
retest this please |
SparkQA
commented
Jul 31, 2017
Test build #80066 has finished for PR 18106 at commit
|
gatorsmile
commented
Aug 1, 2017
ping @wangyum |
wangyum
commented
Aug 1, 2017
I'll fix it |
SparkQA
commented
Aug 2, 2017
Test build #80150 has finished for PR 18106 at commit
|
wangyum
commented
Aug 2, 2017
Jenkins, retest this please |
| @since(1.5) | ||
| def trunc(date, format): | ||
| def trunc(data, truncParam): |
There was a problem hiding this comment.
@wangyum, would you mind revert this renaming? This breaks the compatibility if user script calls this by
trunc(..., format= ...)
trunc(date=..., format= ...)There was a problem hiding this comment.
We can work around this with kwargs if it's important to change the name.
There was a problem hiding this comment.
Yes but it brings complexity for both args and kwargs e.g., when both set, method signature in doc and etc. I wonder if it is that important.
SparkQA
commented
Aug 2, 2017
Test build #80152 has finished for PR 18106 at commit
|
SparkQA
commented
Aug 2, 2017
Test build #80159 has finished for PR 18106 at commit
|
gatorsmile
commented
Oct 27, 2017
This is close to merge. Could you resolve the conflicts? Then, I will review it. Thanks! |
felixcheung
commented
Oct 28, 2017
R has |
# Conflicts: # sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala # sql/core/src/test/resources/sql-tests/inputs/operators.sql # sql/core/src/test/resources/sql-tests/results/operators.sql.out
# Conflicts: # sql/core/src/test/resources/sql-tests/inputs/datetime.sql # sql/core/src/test/resources/sql-tests/results/datetime.sql.out
SparkQA
commented
Oct 28, 2017
Test build #83155 has finished for PR 18106 at commit
|
SparkQA
commented
Oct 28, 2017
Test build #83158 has finished for PR 18106 at commit
|
dongjoon-hyun
commented
Sep 13, 2018
@wangyum . |
wangyum
commented
Sep 14, 2018
@dongjoon-hyun Actually |
dongjoon-hyun
commented
Sep 14, 2018
+100, @wangyum . Thanks. :) |
What changes were proposed in this pull request?
Move
TruncDate()fromdatetimeExpressions.scalatomisc.scala, and add supportTRUNC(number), it's similar to Oracle TRUNC(number):The
MODandPOSITIONfunction alias will be added by follow-up PR.How was this patch tested?
unit tests