This is an automated email from the ASF dual-hosted git repository.
marong pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git
The following commit(s) were added to refs/heads/main by this push:
new c85189fc5 [GLUTEN-5586] Fix multiple generate functions failure
(#5587)
c85189fc5 is described below
commit c85189fc5524ab4cc5e39188c221244b040124b1
Author: Rong Ma <[email protected]>
AuthorDate: Mon May 6 10:03:02 2024 +0800
[GLUTEN-5586] Fix multiple generate functions failure (#5587)
---
.../scala/org/apache/gluten/execution/TestOperator.scala | 15 +++++++++++++++
.../gluten/execution/GenerateExecTransformerBase.scala | 2 +-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git
a/backends-velox/src/test/scala/org/apache/gluten/execution/TestOperator.scala
b/backends-velox/src/test/scala/org/apache/gluten/execution/TestOperator.scala
index a60c853db..7dc8f1e0b 100644
---
a/backends-velox/src/test/scala/org/apache/gluten/execution/TestOperator.scala
+++
b/backends-velox/src/test/scala/org/apache/gluten/execution/TestOperator.scala
@@ -773,6 +773,21 @@ class TestOperator extends VeloxWholeStageTransformerSuite
{
|""".stripMargin)(_)
}
+ test("test multi-generate") {
+ withTable("t") {
+ sql("CREATE TABLE t (col1 array<struct<a int, b string>>, col2
array<int>) using parquet")
+ sql("INSERT INTO t VALUES (array(struct(1, 'a'), struct(2, 'b')),
array(1, 2))")
+ sql("INSERT INTO t VALUES (array(null, struct(3, 'c')), array(3, null))")
+
+ runQueryAndCompare("""SELECT c1, c2, c3 FROM t
+ |LATERAL VIEW inline(col1) as c1, c2
+ |LATERAL VIEW explode(col2) as c3
+ |""".stripMargin) {
+ checkGlutenOperatorMatch[GenerateExecTransformer]
+ }
+ }
+ }
+
test("test array functions") {
withTable("t") {
sql("CREATE TABLE t (c1 ARRAY<INT>, c2 ARRAY<INT>, c3 STRING) using
parquet")
diff --git
a/gluten-core/src/main/scala/org/apache/gluten/execution/GenerateExecTransformerBase.scala
b/gluten-core/src/main/scala/org/apache/gluten/execution/GenerateExecTransformerBase.scala
index d5978216f..5811f7b47 100644
---
a/gluten-core/src/main/scala/org/apache/gluten/execution/GenerateExecTransformerBase.scala
+++
b/gluten-core/src/main/scala/org/apache/gluten/execution/GenerateExecTransformerBase.scala
@@ -53,7 +53,7 @@ abstract class GenerateExecTransformerBase(
target =>
val childIndex = child.output.zipWithIndex
.collectFirst {
- case (attr, i) if attr.name == target.name => i
+ case (attr, i) if attr.exprId == target.exprId => i
}
.getOrElse(
throw new GlutenException(s"Can't found column ${target.name} in
child output"))
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]