[jira] [Resolved] (SPARK-42702) Support parameterized CTE

2023-03-13 Thread Wenchen Fan (Jira)


 [ 
https://issues.apache.org/jira/browse/SPARK-42702?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Wenchen Fan resolved SPARK-42702.
-
  Assignee: Wenchen Fan  (was: Max Gekk)
Resolution: Fixed

> Support parameterized CTE
> -
>
> Key: SPARK-42702
> URL: https://issues.apache.org/jira/browse/SPARK-42702
> Project: Spark
>  Issue Type: New Feature
>  Components: SQL
>Affects Versions: 3.4.0
>Reporter: Max Gekk
>Assignee: Wenchen Fan
>Priority: Major
>
> Support named parameters in named common table expressions (CTE). At the 
> moment, such queries failed:
> {code:java}
> CREATE TABLE tbl(namespace STRING) USING parquet
> INSERT INTO tbl SELECT 'abc'
> WITH transitions AS (
>   SELECT * FROM tbl WHERE namespace = :namespace
> ) SELECT * FROM transitions {code}
> w/ the following error:
> {code:java}
> [UNBOUND_SQL_PARAMETER] Found the unbound parameter: `namespace`. Please, fix 
> `args` and provide a mapping of the parameter to a SQL literal.; line 3 pos 
> 38;
> 'WithCTE
> :- 'CTERelationDef 0, false
> :  +- 'SubqueryAlias transitions
> :     +- 'Project [*]
> :        +- 'Filter (namespace#3 = parameter(namespace))
> :           +- SubqueryAlias spark_catalog.default.tbl
> :              +- Relation spark_catalog.default.tbl[namespace#3] parquet
> +- 'Project [*]
>    +- 'SubqueryAlias transitions
>       +- 'CTERelationRef 0, falseorg.apache.spark.sql.AnalysisException: 
> [UNBOUND_SQL_PARAMETER] Found the unbound parameter: `namespace`. Please, fix 
> `args` and provide a mapping of the parameter to a SQL literal.; line 3 pos 
> 38;
> 'WithCTE
> :- 'CTERelationDef 0, false
> :  +- 'SubqueryAlias transitions
> :     +- 'Project [*]
> :        +- 'Filter (namespace#3 = parameter(namespace))
> :           +- SubqueryAlias spark_catalog.default.tbl
> :              +- Relation spark_catalog.default.tbl[namespace#3] parquet
> +- 'Project [*]
>    +- 'SubqueryAlias transitions
>       +- 'CTERelationRef 0, false    at 
> org.apache.spark.sql.catalyst.analysis.package$AnalysisErrorAt.failAnalysis(package.scala:52)
>     at 
> org.apache.spark.sql.catalyst.analysis.CheckAnalysis.$anonfun$checkAnalysis0$5(CheckAnalysis.scala:339)
>     at 
> org.apache.spark.sql.catalyst.analysis.CheckAnalysis.$anonfun$checkAnalysis0$5$adapted(CheckAnalysis.scala:244)
>  {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org



[jira] [Resolved] (SPARK-42702) Support parameterized CTE

2023-03-09 Thread Wenchen Fan (Jira)


 [ 
https://issues.apache.org/jira/browse/SPARK-42702?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Wenchen Fan resolved SPARK-42702.
-
Fix Version/s: 3.4.0
   Resolution: Fixed

Issue resolved by pull request 40333
[https://github.com/apache/spark/pull/40333]

> Support parameterized CTE
> -
>
> Key: SPARK-42702
> URL: https://issues.apache.org/jira/browse/SPARK-42702
> Project: Spark
>  Issue Type: New Feature
>  Components: SQL
>Affects Versions: 3.4.0
>Reporter: Max Gekk
>Assignee: Max Gekk
>Priority: Major
> Fix For: 3.4.0
>
>
> Support named parameters in named common table expressions (CTE). At the 
> moment, such queries failed:
> {code:java}
> CREATE TABLE tbl(namespace STRING) USING parquet
> INSERT INTO tbl SELECT 'abc'
> WITH transitions AS (
>   SELECT * FROM tbl WHERE namespace = :namespace
> ) SELECT * FROM transitions {code}
> w/ the following error:
> {code:java}
> [UNBOUND_SQL_PARAMETER] Found the unbound parameter: `namespace`. Please, fix 
> `args` and provide a mapping of the parameter to a SQL literal.; line 3 pos 
> 38;
> 'WithCTE
> :- 'CTERelationDef 0, false
> :  +- 'SubqueryAlias transitions
> :     +- 'Project [*]
> :        +- 'Filter (namespace#3 = parameter(namespace))
> :           +- SubqueryAlias spark_catalog.default.tbl
> :              +- Relation spark_catalog.default.tbl[namespace#3] parquet
> +- 'Project [*]
>    +- 'SubqueryAlias transitions
>       +- 'CTERelationRef 0, falseorg.apache.spark.sql.AnalysisException: 
> [UNBOUND_SQL_PARAMETER] Found the unbound parameter: `namespace`. Please, fix 
> `args` and provide a mapping of the parameter to a SQL literal.; line 3 pos 
> 38;
> 'WithCTE
> :- 'CTERelationDef 0, false
> :  +- 'SubqueryAlias transitions
> :     +- 'Project [*]
> :        +- 'Filter (namespace#3 = parameter(namespace))
> :           +- SubqueryAlias spark_catalog.default.tbl
> :              +- Relation spark_catalog.default.tbl[namespace#3] parquet
> +- 'Project [*]
>    +- 'SubqueryAlias transitions
>       +- 'CTERelationRef 0, false    at 
> org.apache.spark.sql.catalyst.analysis.package$AnalysisErrorAt.failAnalysis(package.scala:52)
>     at 
> org.apache.spark.sql.catalyst.analysis.CheckAnalysis.$anonfun$checkAnalysis0$5(CheckAnalysis.scala:339)
>     at 
> org.apache.spark.sql.catalyst.analysis.CheckAnalysis.$anonfun$checkAnalysis0$5$adapted(CheckAnalysis.scala:244)
>  {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org