You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by bogdanrdc <gi...@git.apache.org> on 2017/01/16 17:11:41 UTC
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
GitHub user bogdanrdc opened a pull request:
https://github.com/apache/spark/pull/16608
[SPARK-13721][SQL] Support outer generators in DataFrame API
## What changes were proposed in this pull request?
Added outer_explode, outer_posexplode, outer_inline functions and expressions.
Some bug fixing in GenerateExec.scala for CollectionGenerator. Previously it was not correctly handling the case of outer with empty collections, only with nulls.
## How was this patch tested?
New tests added to GeneratorFunctionSuite
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/bogdanrdc/spark SPARK-13721
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/16608.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 #16608
----
commit 62f46f6ab62e04cf2cc5958d67437d8626cef309
Author: Bogdan Raducanu <bo...@gmail.com>
Date: 2017-01-16T17:00:25Z
Added outer_explode, outer_posexplode, outer_inline
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by bogdanrdc <gi...@git.apache.org>.
Github user bogdanrdc commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96298059
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/generators.scala ---
@@ -300,7 +311,7 @@ abstract class ExplodeBase extends UnaryExpression with CollectionGenerator with
case class Explode(child: Expression) extends ExplodeBase {
override val position: Boolean = false
}
-
+class OuterExplode(child: Expression) extends GeneratorOuter(Explode(child))
--- End diff --
I made it like this so I can use it in FunctionRegistry.scala: expression[OuterExplode]("outer_explode")
Is there a way I can still make it work with GeneratorOuter(Explode(child)) ?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96323976
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/functions.scala ---
@@ -2879,6 +2888,15 @@ object functions {
def posexplode(e: Column): Column = withExpr { PosExplode(e.expr) }
/**
+ * Creates a new row for each element with position in the given array or map column.
+ * Unlike posexplode, if the array/map is null or empty then the row (0, null) is produced.
--- End diff --
update this the result.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/spark/pull/16608
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r102593931
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala ---
@@ -163,9 +163,11 @@ object FunctionRegistry {
expression[Abs]("abs"),
expression[Coalesce]("coalesce"),
expression[Explode]("explode"),
+ expressionGeneratorOuter[Explode]("explode_outer"),
--- End diff --
I am not super enthusiastic about this. We have three options here:
1. Leave as it is.
2. Remove the `outer_...` generators, and make a user use the `lateral view outer ...` instead.
3. Create separate OuterGenerator classes for each one, and provide proper documentation.
I am fine with any.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r102535020
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala ---
@@ -163,9 +163,11 @@ object FunctionRegistry {
expression[Abs]("abs"),
expression[Coalesce]("coalesce"),
expression[Explode]("explode"),
+ expressionGeneratorOuter[Explode]("explode_outer"),
--- End diff --
```
Function: explode_outer
Class: org.apache.spark.sql.catalyst.expressions.Explode
Usage: explode_outer(expr) - Separates the elements of array `expr` into multiple rows, or the elements of map `expr` into multiple rows and columns.
Extended Usage:
Examples:
> SELECT explode_outer(array(10, 20));
10
20
```
@hvanhovell `explode_outer ` is sharing the same expression description. Do we need an update on this?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #16608: [SPARK-13721][SQL] Support outer generators in DataFrame...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/16608
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/71513/
Test PASSed.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #16608: [SPARK-13721][SQL] Support outer generators in DataFrame...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:
https://github.com/apache/spark/pull/16608
**[Test build #71513 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/71513/testReport)** for PR 16608 at commit [`8a8af55`](https://github.com/apache/spark/commit/8a8af5537c050956542a6395c7db79fb28efcd10).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #16608: [SPARK-13721][SQL] Support outer generators in DataFrame...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/16608
Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/71467/
Test FAILed.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96276562
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/GenerateExec.scala ---
@@ -160,9 +160,20 @@ case class GenerateExec(
// Generate looping variables.
val index = ctx.freshName("index")
+ val numElements = ctx.freshName("numElements")
+
+ // In case of outer=true we need to make sure the loop is executed at-least once when the
+ // array/map contains no input.
+ // generateOuter is an int. it is set to 1 iff outer is true and the input is empty or null.
+ val generateOuter = ctx.freshName("generateOuter")
+ val isOuter = if (outer) {
--- End diff --
How about we generate the expressions for the `generateOuter` variable here instead? It is always `0` when `outer == false` and `$numElements == 0 ? 1 : 0` when it is true. This increases the probability that the generated code gets eliminated at compile time.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by bogdanrdc <gi...@git.apache.org>.
Github user bogdanrdc commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96323081
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/GenerateExec.scala ---
@@ -160,9 +160,20 @@ case class GenerateExec(
// Generate looping variables.
val index = ctx.freshName("index")
+ val numElements = ctx.freshName("numElements")
+
+ // In case of outer=true we need to make sure the loop is executed at-least once when the
+ // array/map contains no input.
+ // generateOuter is an int. it is set to 1 iff outer is true and the input is empty or null.
+ val generateOuter = ctx.freshName("generateOuter")
+ val isOuter = if (outer) {
--- End diff --
I simplified it by using index == -1 like you said and reverting to the old code. It was also easy to make it produce (null, null) for posexplode_outer instead of (-1, null). @rxin preferred to return null and not -1 (or even 0) for the position. So now, everything is null always.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #16608: [SPARK-13721][SQL] Support outer generators in DataFrame...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/16608
Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/71466/
Test FAILed.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by bogdanrdc <gi...@git.apache.org>.
Github user bogdanrdc commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96322655
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala ---
@@ -175,6 +175,9 @@ object FunctionRegistry {
expression[NullIf]("nullif"),
expression[Nvl]("nvl"),
expression[Nvl2]("nvl2"),
+ expression[OuterExplode]("outer_explode"),
--- End diff --
done
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #16608: [SPARK-13721][SQL] Support outer generators in DataFrame...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/16608
Merged build finished. Test PASSed.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96275937
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/generators.scala ---
@@ -369,3 +380,5 @@ case class Inline(child: Expression) extends UnaryExpression with CollectionGene
child.genCode(ctx)
}
}
+
+class OuterInline(child: Expression) extends GeneratorOuter(Inline(child))
--- End diff --
Remove this.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96276717
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/functions.scala ---
@@ -2879,6 +2888,15 @@ object functions {
def posexplode(e: Column): Column = withExpr { PosExplode(e.expr) }
/**
+ * Creates a new row for each element with position in the given array or map column.
+ * Unlike posexplode, if the array/map is null or empty then the row (0, null) is produced.
+ *
+ * @group collection_funcs
+ * @since 2.2.0
+ */
+ def outer_posexplode(e: Column): Column = withExpr { new OuterPosExplode(e.expr) }
--- End diff --
Naming: `posexplode_outer`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96324322
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala ---
@@ -508,4 +511,12 @@ object FunctionRegistry {
new ExpressionInfo(clazz.getCanonicalName, name)
}
}
+ private def expressionGeneratorOuter[T <: Generator : ClassTag]
--- End diff --
Add a new line
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r102299867
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala ---
@@ -163,9 +163,11 @@ object FunctionRegistry {
expression[Abs]("abs"),
expression[Coalesce]("coalesce"),
expression[Explode]("explode"),
+ expressionGeneratorOuter[Explode]("explode_outer"),
--- End diff --
We might need an update on `ExpressionDescription` for these three new expressions.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #16608: [SPARK-13721][SQL] Support outer generators in DataFrame...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:
https://github.com/apache/spark/pull/16608
**[Test build #71466 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/71466/testReport)** for PR 16608 at commit [`26a1a67`](https://github.com/apache/spark/commit/26a1a67751307b6053e4e85262b6b7ca029ff62b).
* This patch **fails Spark unit tests**.
* This patch merges cleanly.
* This patch adds no public classes.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #16608: [SPARK-13721][SQL] Support outer generators in DataFrame...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/16608
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/71529/
Test PASSed.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96324372
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala ---
@@ -508,4 +511,12 @@ object FunctionRegistry {
new ExpressionInfo(clazz.getCanonicalName, name)
}
}
+ private def expressionGeneratorOuter[T <: Generator : ClassTag]
+ (name: String): (String, (ExpressionInfo, FunctionBuilder)) = {
+ val regularGen = expression[T](name)
--- End diff --
Deconstruct the tuple here: `val (_, (info, generator)) = expression[T](name)`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96324395
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala ---
@@ -508,4 +511,12 @@ object FunctionRegistry {
new ExpressionInfo(clazz.getCanonicalName, name)
}
}
+ private def expressionGeneratorOuter[T <: Generator : ClassTag]
+ (name: String): (String, (ExpressionInfo, FunctionBuilder)) = {
+ val regularGen = expression[T](name)
+ val outerBuilder = (args: Seq[Expression]) => {
+ GeneratorOuter(regularGen._2._2(args).asInstanceOf[Generator])
+ }
+ (name, (expressionInfo[GeneratorOuter](name), outerBuilder))
--- End diff --
Let's use the generators info instead of the outer generator info.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #16608: [SPARK-13721][SQL] Support outer generators in DataFrame...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/16608
Can one of the admins verify this patch?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #16608: [SPARK-13721][SQL] Support outer generators in DataFrame...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:
https://github.com/apache/spark/pull/16608
**[Test build #71529 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/71529/testReport)** for PR 16608 at commit [`99742be`](https://github.com/apache/spark/commit/99742be9a9a2e5f2256e5ad24f4519f5dd84323c).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by rxin <gi...@git.apache.org>.
Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96294175
--- Diff: sql/core/src/test/scala/org/apache/spark/sql/GeneratorFunctionSuite.scala ---
@@ -86,13 +86,25 @@ class GeneratorFunctionSuite extends QueryTest with SharedSQLContext {
df.select(explode('intList)),
Row(1) :: Row(2) :: Row(3) :: Nil)
}
+ test("single outer_explode") {
--- End diff --
just add it to all the test cases - have a blank line (only one) separating them.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #16608: [SPARK-13721][SQL] Support outer generators in DataFrame...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:
https://github.com/apache/spark/pull/16608
**[Test build #71529 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/71529/testReport)** for PR 16608 at commit [`99742be`](https://github.com/apache/spark/commit/99742be9a9a2e5f2256e5ad24f4519f5dd84323c).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds the following public classes _(experimental)_:
* `case class GeneratorOuter(child: Generator) extends UnaryExpression with Generator `
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by bogdanrdc <gi...@git.apache.org>.
Github user bogdanrdc commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96298756
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala ---
@@ -175,6 +175,9 @@ object FunctionRegistry {
expression[NullIf]("nullif"),
expression[Nvl]("nvl"),
expression[Nvl2]("nvl2"),
+ expression[OuterExplode]("outer_explode"),
+ expression[OuterInline]("outer_inline"),
--- End diff --
This is to support df.selectExpr("outer_explode(array())").
Should I remove it?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #16608: [SPARK-13721][SQL] Support outer generators in DataFrame...
Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on the issue:
https://github.com/apache/spark/pull/16608
ok to test
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96275919
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/generators.scala ---
@@ -323,7 +334,7 @@ case class Explode(child: Expression) extends ExplodeBase {
case class PosExplode(child: Expression) extends ExplodeBase {
override val position = true
}
-
+class OuterPosExplode(child: Expression) extends GeneratorOuter(PosExplode(child))
--- End diff --
Remove this.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #16608: [SPARK-13721][SQL] Support outer generators in DataFrame...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/16608
Merged build finished. Test PASSed.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by rxin <gi...@git.apache.org>.
Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96294115
--- Diff: sql/core/src/test/scala/org/apache/spark/sql/GeneratorFunctionSuite.scala ---
@@ -86,13 +86,25 @@ class GeneratorFunctionSuite extends QueryTest with SharedSQLContext {
df.select(explode('intList)),
Row(1) :: Row(2) :: Row(3) :: Nil)
}
+ test("single outer_explode") {
--- End diff --
add a blank line before this
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #16608: [SPARK-13721][SQL] Support outer generators in DataFrame...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:
https://github.com/apache/spark/pull/16608
**[Test build #71467 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/71467/testReport)** for PR 16608 at commit [`36ac054`](https://github.com/apache/spark/commit/36ac05414bdf79782e3e74b0e92fdff4687ffb66).
* This patch **fails Spark unit tests**.
* This patch merges cleanly.
* This patch adds no public classes.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96323578
--- Diff: sql/hive/src/test/scala/org/apache/spark/sql/catalyst/ExpressionToSQLSuite.scala ---
@@ -102,6 +102,9 @@ class ExpressionToSQLSuite extends SQLBuilderTest with SQLTestUtils {
checkSqlGeneration("SELECT map(1, 'a', 2, 'b')")
checkSqlGeneration("SELECT named_struct('c1',1,'c2',2,'c3',3)")
checkSqlGeneration("SELECT nanvl(a, 5), nanvl(b, 10), nanvl(d, c) from t2")
+ checkSqlGeneration("SELECT outer_explode(array())")
--- End diff --
This breaks right?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #16608: [SPARK-13721][SQL] Support outer generators in DataFrame...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/16608
Merged build finished. Test FAILed.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96276812
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala ---
@@ -175,6 +175,9 @@ object FunctionRegistry {
expression[NullIf]("nullif"),
expression[Nvl]("nvl"),
expression[Nvl2]("nvl2"),
+ expression[OuterExplode]("outer_explode"),
+ expression[OuterInline]("outer_inline"),
--- End diff --
Why add this one to the function registry? It is not exposed in `functions.scala`.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by bogdanrdc <gi...@git.apache.org>.
Github user bogdanrdc commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96298581
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/generators.scala ---
@@ -204,6 +204,17 @@ case class Stack(children: Seq[Expression]) extends Generator {
}
}
+case class GeneratorOuter(child: Generator) extends UnaryExpression
+ with Generator {
--- End diff --
Couldn't make it work with Unevaluable because Generator.eval is not the same as Unevaluable.eval.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96323956
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala ---
@@ -104,7 +104,10 @@ case class Generate(
def qualifiedGeneratorOutput: Seq[Attribute] = qualifier.map { q =>
// prepend the new qualifier to the existed one
generatorOutput.map(a => a.withQualifier(Some(q)))
- }.getOrElse(generatorOutput)
+ }.getOrElse(generatorOutput).map {
--- End diff --
Nit style. Can you split this up for readability.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96276686
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/functions.scala ---
@@ -2871,6 +2871,15 @@ object functions {
def explode(e: Column): Column = withExpr { Explode(e.expr) }
/**
+ * Creates a new row for each element in the given array or map column.
+ * Unlike explode, if the array/map is null or empty then null is produced.
+ *
+ * @group collection_funcs
+ * @since 2.2.0
+ */
+ def outer_explode(e: Column): Column = withExpr { new OuterExplode(e.expr) }
--- End diff --
Naming: `explode_outer`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r102335398
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala ---
@@ -163,9 +163,11 @@ object FunctionRegistry {
expression[Abs]("abs"),
expression[Coalesce]("coalesce"),
expression[Explode]("explode"),
+ expressionGeneratorOuter[Explode]("explode_outer"),
--- End diff --
@gatorsmile it uses the expression description of the underlying expression: https://github.com/apache/spark/pull/16608/files#diff-2c0350957ac4932d3f63796eceaeae08R517
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by rxin <gi...@git.apache.org>.
Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96294261
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala ---
@@ -1621,9 +1621,11 @@ class Analyzer(
/** Extracts a [[Generator]] expression and any names assigned by aliases to their output. */
private object AliasedGenerator {
- def unapply(e: Expression): Option[(Generator, Seq[String])] = e match {
- case Alias(g: Generator, name) if g.resolved => Some((g, name :: Nil))
- case MultiAlias(g: Generator, names) if g.resolved => Some(g, names)
+ def unapply(e: Expression): Option[(Generator, Seq[String], Boolean)] = e match {
--- End diff --
document what the return value means (especially that boolean value, but also the Seq[String] that's preexisting)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #16608: [SPARK-13721][SQL] Support outer generators in DataFrame...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/16608
Merged build finished. Test FAILed.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #16608: [SPARK-13721][SQL] Support outer generators in DataFrame...
Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on the issue:
https://github.com/apache/spark/pull/16608
LGTM - merging to master.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by bogdanrdc <gi...@git.apache.org>.
Github user bogdanrdc commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96322905
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/generators.scala ---
@@ -300,7 +311,7 @@ abstract class ExplodeBase extends UnaryExpression with CollectionGenerator with
case class Explode(child: Expression) extends ExplodeBase {
override val position: Boolean = false
}
-
+class OuterExplode(child: Expression) extends GeneratorOuter(Explode(child))
--- End diff --
Reverted to GeneratorOuter(Explode()) and created a new helper method in FunctionRegistry instead.
Actually the way I made these classes wasn't working. It was returning strange results, but not failing otherwise. I guess somewhere the OuterExplode class was not caught by a match. The generated code was different.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #16608: [SPARK-13721][SQL] Support outer generators in DataFrame...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:
https://github.com/apache/spark/pull/16608
**[Test build #71458 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/71458/testReport)** for PR 16608 at commit [`62f46f6`](https://github.com/apache/spark/commit/62f46f6ab62e04cf2cc5958d67437d8626cef309).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #16608: [SPARK-13721][SQL] Support outer generators in DataFrame...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/16608
Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/71458/
Test FAILed.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96275746
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/generators.scala ---
@@ -233,11 +244,11 @@ abstract class ExplodeBase extends UnaryExpression with CollectionGenerator with
if (position) {
new StructType()
.add("pos", IntegerType, nullable = false)
- .add("key", kt, nullable = false)
+ .add("key", kt, nullable = true)
--- End diff --
What happens when this is false?
I think we should fix the output of Generate instead of doing this.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96323864
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/generators.scala ---
@@ -204,6 +204,17 @@ case class Stack(children: Seq[Expression]) extends Generator {
}
}
+case class GeneratorOuter(child: Generator) extends UnaryExpression
+ with Generator {
--- End diff --
Ok, that is fair.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96483144
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala ---
@@ -508,4 +511,13 @@ object FunctionRegistry {
new ExpressionInfo(clazz.getCanonicalName, name)
}
}
+
+ private def expressionGeneratorOuter[T <: Generator : ClassTag]
+ (name: String): (String, (ExpressionInfo, FunctionBuilder)) = {
--- End diff --
Nit: Could you follow the indentation style? https://github.com/databricks/scala-style-guide#spacing-and-indentation
```Scala
private def expressionGeneratorOuter[T <: Generator : ClassTag](
name: String): (String, (ExpressionInfo, FunctionBuilder)) = {
val (_, (info, generatorBuilder)) = expression[T](name)
...
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #16608: [SPARK-13721][SQL] Support outer generators in DataFrame...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:
https://github.com/apache/spark/pull/16608
**[Test build #71513 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/71513/testReport)** for PR 16608 at commit [`8a8af55`](https://github.com/apache/spark/commit/8a8af5537c050956542a6395c7db79fb28efcd10).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r102535917
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala ---
@@ -163,9 +163,11 @@ object FunctionRegistry {
expression[Abs]("abs"),
expression[Coalesce]("coalesce"),
expression[Explode]("explode"),
+ expressionGeneratorOuter[Explode]("explode_outer"),
--- End diff --
Why would we need an update? What is the extra information you want to convey? Do you want to add a generic line saying that an outer generator might produce nulls instead of filtering out the row?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r102536886
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala ---
@@ -163,9 +163,11 @@ object FunctionRegistry {
expression[Abs]("abs"),
expression[Coalesce]("coalesce"),
expression[Explode]("explode"),
+ expressionGeneratorOuter[Explode]("explode_outer"),
--- End diff --
Yes. Update the description and provide an example to users? Maybe hardcode the function name instead of using `_FUNC_`?
```
@ExpressionDescription(
usage = "_FUNC_(expr) - Separates the elements of array `expr` into multiple rows, or the elements of map `expr` into multiple rows and columns.",
extended = """
Examples:
> SELECT _FUNC_(array(10, 20));
10
20
""")
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by bogdanrdc <gi...@git.apache.org>.
Github user bogdanrdc commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96300006
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/generators.scala ---
@@ -233,11 +244,11 @@ abstract class ExplodeBase extends UnaryExpression with CollectionGenerator with
if (position) {
new StructType()
.add("pos", IntegerType, nullable = false)
- .add("key", kt, nullable = false)
+ .add("key", kt, nullable = true)
--- End diff --
I will see if I can fix it from Generate instead.
If it's false then outer_explode with empty map fails with this exception:
java.util.concurrent.ExecutionException: java.lang.Exception: failed to compile: org.codehaus.commons.compiler.CompileException: File 'generated.java', Line 42, Column 89: A method named "isNullAt" is not declared in any enclosing class nor any supertype, nor through a static import
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96275427
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala ---
@@ -175,6 +175,9 @@ object FunctionRegistry {
expression[NullIf]("nullif"),
expression[Nvl]("nvl"),
expression[Nvl2]("nvl2"),
+ expression[OuterExplode]("outer_explode"),
--- End diff --
Name these `..._outer`, e.g.: `explode_outer`. That makes them easier to find when someone is looking for them (same goes for naming in `functions.scala`).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96275903
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/generators.scala ---
@@ -300,7 +311,7 @@ abstract class ExplodeBase extends UnaryExpression with CollectionGenerator with
case class Explode(child: Expression) extends ExplodeBase {
override val position: Boolean = false
}
-
+class OuterExplode(child: Expression) extends GeneratorOuter(Explode(child))
--- End diff --
Remove this. Favor composition over inheritance. Just create a `GeneratorOuter(Explode(child))` whenever you need this.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #16608: [SPARK-13721][SQL] Support outer generators in DataFrame...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:
https://github.com/apache/spark/pull/16608
**[Test build #71466 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/71466/testReport)** for PR 16608 at commit [`26a1a67`](https://github.com/apache/spark/commit/26a1a67751307b6053e4e85262b6b7ca029ff62b).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #16608: [SPARK-13721][SQL] Support outer generators in DataFrame...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:
https://github.com/apache/spark/pull/16608
**[Test build #71467 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/71467/testReport)** for PR 16608 at commit [`36ac054`](https://github.com/apache/spark/commit/36ac05414bdf79782e3e74b0e92fdff4687ffb66).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by bogdanrdc <gi...@git.apache.org>.
Github user bogdanrdc commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96322755
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/generators.scala ---
@@ -233,11 +244,11 @@ abstract class ExplodeBase extends UnaryExpression with CollectionGenerator with
if (position) {
new StructType()
.add("pos", IntegerType, nullable = false)
- .add("key", kt, nullable = false)
+ .add("key", kt, nullable = true)
--- End diff --
fixed it in Generate instead. makes more sense from there too.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #16608: [SPARK-13721][SQL] Support outer generators in Da...
Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96275197
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/generators.scala ---
@@ -204,6 +204,17 @@ case class Stack(children: Seq[Expression]) extends Generator {
}
}
+case class GeneratorOuter(child: Generator) extends UnaryExpression
+ with Generator {
--- End diff --
Add the `Unevaluable` trait. Then you don't have to implement `eval()` and `doGenCode()`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #16608: [SPARK-13721][SQL] Support outer generators in DataFrame...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:
https://github.com/apache/spark/pull/16608
**[Test build #71458 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/71458/testReport)** for PR 16608 at commit [`62f46f6`](https://github.com/apache/spark/commit/62f46f6ab62e04cf2cc5958d67437d8626cef309).
* This patch **fails Spark unit tests**.
* This patch merges cleanly.
* This patch adds the following public classes _(experimental)_:
* `case class GeneratorOuter(child: Generator) extends UnaryExpression`
* `class OuterExplode(child: Expression) extends GeneratorOuter(Explode(child))`
* `class OuterPosExplode(child: Expression) extends GeneratorOuter(PosExplode(child))`
* `class OuterInline(child: Expression) extends GeneratorOuter(Inline(child))`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #16608: [SPARK-13721][SQL] Support outer generators in DataFrame...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/16608
Merged build finished. Test FAILed.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org