[jira] [Updated] (SPARK-30130) Hardcoded numeric values in common table expressions which utilize GROUP BY are interpreted as ordinal positions

2019-12-10 Thread Matt Boegner (Jira)


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

Matt Boegner updated SPARK-30130:
-
Description: 
Hardcoded numeric values in common table expressions which utilize GROUP BY are 
interpreted as ordinal positions.
{code:java}
val df = spark.sql("""
 with a as (select 0 as test, count(*) group by test)
 select * from a
 """)
 df.show(){code}
This results in an error message like {color:#e01e5a}GROUP BY position 0 is not 
in select list (valid range is [1, 2]){color} .

 

However, this error does not appear in a traditional subselect format. For 
example, this query executes correctly:
{code:java}
val df = spark.sql("""
 select * from (select 0 as test, count(*) group by test) a
 """)
 df.show(){code}
 

  was:
Hardcoded numeric values in common table expressions which utilize GROUP BY are 
interpreted as ordinal positions. 
{code:java}
val df = spark.sql("""
 with a as (select 0 as test, count group by test)
 select * from a
 """)
 df.show(){code}

 This results in an error message like {color:#e01e5a}GROUP BY position 0 is 
not in select list (valid range is [1, 2]){color} .

 

However, this error does not appear in a traditional subselect format. For 
example, this query executes correctly:
{code:java}
val df = spark.sql("""
 select * from (select 0 as test, count group by test) a
 """)
 df.show(){code}

  


> Hardcoded numeric values in common table expressions which utilize GROUP BY 
> are interpreted as ordinal positions
> 
>
> Key: SPARK-30130
> URL: https://issues.apache.org/jira/browse/SPARK-30130
> Project: Spark
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 2.4.4
>Reporter: Matt Boegner
>Priority: Minor
>
> Hardcoded numeric values in common table expressions which utilize GROUP BY 
> are interpreted as ordinal positions.
> {code:java}
> val df = spark.sql("""
>  with a as (select 0 as test, count(*) group by test)
>  select * from a
>  """)
>  df.show(){code}
> This results in an error message like {color:#e01e5a}GROUP BY position 0 is 
> not in select list (valid range is [1, 2]){color} .
>  
> However, this error does not appear in a traditional subselect format. For 
> example, this query executes correctly:
> {code:java}
> val df = spark.sql("""
>  select * from (select 0 as test, count(*) group by test) a
>  """)
>  df.show(){code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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



[jira] [Updated] (SPARK-30130) Hardcoded numeric values in common table expressions which utilize GROUP BY are interpreted as ordinal positions

2019-12-04 Thread Matt Boegner (Jira)


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

Matt Boegner updated SPARK-30130:
-
Description: 
Hardcoded numeric values in common table expressions which utilize GROUP BY are 
interpreted as ordinal positions. 
{code:java}
val df = spark.sql("""
 with a as (select 0 as test, count group by test)
 select * from a
 """)
 df.show(){code}

 This results in an error message like {color:#e01e5a}GROUP BY position 0 is 
not in select list (valid range is [1, 2]){color} .

 

However, this error does not appear in a traditional subselect format. For 
example, this query executes correctly:
{code:java}
val df = spark.sql("""
 select * from (select 0 as test, count group by test) a
 """)
 df.show(){code}

  

  was:
Hardcoded numeric values in common table expressions which utilize GROUP BY are 
interpreted as ordinal positions. 
val df = spark.sql("""
with a as (select 0 as test, count(*) group by test)
select * from a
""")
df.show()
This results in an error message like {color:#e01e5a}GROUP BY position 0 is not 
in select list (valid range is [1, 2]){color} .

 

However, this error does not appear in a traditional subselect format. For 
example, this query executes correctly:
val df = spark.sql("""
select * from (select 0 as test, count(*) group by test) a
""")
df.show()
 


> Hardcoded numeric values in common table expressions which utilize GROUP BY 
> are interpreted as ordinal positions
> 
>
> Key: SPARK-30130
> URL: https://issues.apache.org/jira/browse/SPARK-30130
> Project: Spark
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 2.4.4
>Reporter: Matt Boegner
>Priority: Minor
>
> Hardcoded numeric values in common table expressions which utilize GROUP BY 
> are interpreted as ordinal positions. 
> {code:java}
> val df = spark.sql("""
>  with a as (select 0 as test, count group by test)
>  select * from a
>  """)
>  df.show(){code}
>  This results in an error message like {color:#e01e5a}GROUP BY position 0 is 
> not in select list (valid range is [1, 2]){color} .
>  
> However, this error does not appear in a traditional subselect format. For 
> example, this query executes correctly:
> {code:java}
> val df = spark.sql("""
>  select * from (select 0 as test, count group by test) a
>  """)
>  df.show(){code}
>   



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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