[ 
https://issues.apache.org/jira/browse/SPARK-21212?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16063952#comment-16063952
 ] 

Shawn Lavelle edited comment on SPARK-21212 at 6/26/17 11:17 PM:
-----------------------------------------------------------------

[~srowen], I can assure you that value is a column in the table.  For example, 

{code}
select * from table where value between 1 and 5 order by value;
{code}
and
{code}
select count(*) from table where value between 1 and 5
{code}
both complete successfully.


was (Author: azeroth2b):
[~srowen], I can assure you that value is a column in the table.  For example, 

[code]
select * from table where value between 1 and 5 order by value;
[code]
and
[code]
select coun(*) from table where value between 1 and 5
[code]
both complete successfully.

> Can't use Count(*) with Order Clause
> ------------------------------------
>
>                 Key: SPARK-21212
>                 URL: https://issues.apache.org/jira/browse/SPARK-21212
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.1.0
>         Environment: Windows; external data provided through data source api
>            Reporter: Shawn Lavelle
>            Priority: Minor
>
> I don't think this should fail the query:
> {code}jdbc:hive2://user:port/> select count(*) from table where value between 
> 1498240079000 and cast(now() as bigint)*1000 order by value;
> {code}
> {code}
> Error: org.apache.spark.sql.AnalysisException: cannot resolve '`value`' given 
> input columns: [count(1)]; line 1 pos 113;
> 'Sort ['value ASC NULLS FIRST], true
> +- Aggregate [count(1) AS count(1)#718L]
>    +- Filter ((value#413L >= 1498240079000) && (value#413L <= 
> (cast(current_timestamp() as bigint) * cast(1000 as bigint))))
>       +- SubqueryAlias table
>          +- 
> Relation[field1#411L,field2#412,value#413L,field3#414,field4#415,field5#416,field6#417,field7#418,field8#419,field9#420]
>  com.redacted@16004579 (state=,code=0)
> {code}
> Arguably, the optimizer could ignore the "order by" clause, but I leave that 
> to more informed minds than my own.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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

Reply via email to