You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by priyankagargnitk <gi...@git.apache.org> on 2018/08/09 10:25:34 UTC
[GitHub] spark pull request #22054: [SPARK-24703][SQL]: To add support to multiply Ca...
GitHub user priyankagargnitk opened a pull request:
https://github.com/apache/spark/pull/22054
[SPARK-24703][SQL]: To add support to multiply CalendarInterval with Integral Type.
## What changes were proposed in this pull request?
This change adds capability to multiply Calender interval.
Earlier the multiplication was throwing exception as follow:
spark.sql("select interval '1' day * 3").show()
org.apache.spark.sql.AnalysisException: cannot resolve '(interval 1 days * 3)' due to data type mismatch: differing types in '(interval 1 days) * 3' (int and calendarinterval).; line 1 pos 7;
'Project [unresolvedalias((interval 1 days * 3) , None)]
+- OneRowRelation
at org.apache.spark.sql.catalyst.analysis.package.failAnalysis(package.scala:42)
at org.apache.spark.sql.catalyst.analysis.CheckAnalysis1433anonfun1433anonfun.applyOrElse(CheckAnalysis.scala:93)
at
but now, we have added this support.
## How was this patch tested?
Added test case in CalendarIntervalSuite.java, ArithmeticExpressionSuite.scala and ExpressionTypeCheckingSuite.scala
Also, tested by spark-shell by multiplying calendarinterval with Integral type.
scala> spark.sql(\"select interval '1' day\").show()
+---------------+
|interval 1 days|
+---------------+
|interval 1 days|
+---------------+
scala> spark.sql(\"select interval '1' day * 3\").show()
+---------------------+
|(interval 1 days * 3)|
+---------------------+
| interval 3 days|
+---------------------+
scala> spark.sql(\"select 3 * interval '1' day * 3\").show()
+---------------------------+
|((3 * interval 1 days) * 3)|
+---------------------------+
| interval 1 weeks ...|
+---------------------------+
scala> spark.sql("select 3 * interval '1' day * 3").collect()
res7: Array[org.apache.spark.sql.Row] = Array([interval 1 weeks 2 days])
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/priyankagargnitk/spark SPARK-24703
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/22054.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #22054
----
commit 31312c86f83fbd0aaf6d0d4a706d3469792a23df
Author: Priyanka Garg <pr...@...>
Date: 2018-08-09T10:24:27Z
[SPARK-24703][SQL]: To add support to multiply CalendarInterval with Integral Type.
## What changes were proposed in this pull request?
This change adds capability to multiply Calender interval.
Earlier the multiplication was throwing exception as follow:
spark.sql("select interval '1' day * 3").show()
org.apache.spark.sql.AnalysisException: cannot resolve '(interval 1 days * 3)' due to data type mismatch: differing types in '(interval 1 days) * 3' (int and calendarinterval).; line 1 pos 7;
'Project [unresolvedalias((interval 1 days * 3) , None)]
+- OneRowRelation
at org.apache.spark.sql.catalyst.analysis.package.failAnalysis(package.scala:42)
at org.apache.spark.sql.catalyst.analysis.CheckAnalysis1433anonfun1433anonfun.applyOrElse(CheckAnalysis.scala:93)
at
but now, we have added this support.
## How was this patch tested?
Added test case in CalendarIntervalSuite.java, ArithmeticExpressionSuite.scala and ExpressionTypeCheckingSuite.scala
Also, tested by spark-shell by multiplying calendarinterval with Integral type.
----
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #22054: [SPARK-24703][SQL]: To add support to multiply CalendarI...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/22054
Can one of the admins verify this patch?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #22054: [SPARK-24703][SQL]: To add support to multiply CalendarI...
Posted by priyankagargnitk <gi...@git.apache.org>.
Github user priyankagargnitk commented on the issue:
https://github.com/apache/spark/pull/22054
PLease review this PR.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #22054: [SPARK-24703][SQL]: To add support to multiply CalendarI...
Posted by priyankagargnitk <gi...@git.apache.org>.
Github user priyankagargnitk commented on the issue:
https://github.com/apache/spark/pull/22054
Please review this PR.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #22054: [SPARK-24703][SQL]: To add support to multiply CalendarI...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/22054
Can one of the admins verify this patch?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #22054: [SPARK-24703][SQL]: To add support to multiply CalendarI...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/22054
Can one of the admins verify this patch?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #22054: [SPARK-24703][SQL]: To add support to multiply CalendarI...
Posted by priyankagargnitk <gi...@git.apache.org>.
Github user priyankagargnitk commented on the issue:
https://github.com/apache/spark/pull/22054
PLease review this PR.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #22054: [SPARK-24703][SQL]: To add support to multiply CalendarI...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/22054
Can one of the admins verify this patch?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org