[jira] [Commented] (PHOENIX-6445) Wrong query plans with functions

2021-04-15 Thread Lars Hofhansl (Jira)


[ 
https://issues.apache.org/jira/browse/PHOENIX-6445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17322460#comment-17322460
 ] 

Lars Hofhansl commented on PHOENIX-6445:


Four. This should be a valid query:
{code}
> explain select count(*), phoenix_row_timestamp() from test group by 
> phoenix_row_timestamp();
Error: ERROR 1018 (42Y27): Aggregate may not contain columns not in GROUP BY.  
PHOENIX_ROW_TIMESTAMP() (state=42Y27,code=1018)
java.sql.SQLException: ERROR 1018 (42Y27): Aggregate may not contain columns 
not in GROUP BY.  PHOENIX_ROW_TIMESTAMP()
at 
org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:606)
at 
org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:217)
at 
org.apache.phoenix.compile.ExpressionCompiler.throwNonAggExpressionInAggException(ExpressionCompiler.java:1090)
at 
org.apache.phoenix.compile.ProjectionCompiler.compile(ProjectionCompiler.java:434)
at 
org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(QueryCompiler.java:755)
{code}

> Wrong query plans with functions
> 
>
> Key: PHOENIX-6445
> URL: https://issues.apache.org/jira/browse/PHOENIX-6445
> Project: Phoenix
>  Issue Type: Wish
>Reporter: Lars Hofhansl
>Priority: Major
>
> Phoenix seems to sometimes create incorrect query plans when functions are 
> used.
> I'll post these in the comments.



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


[jira] [Commented] (PHOENIX-6445) Wrong query plans with functions

2021-04-14 Thread Lars Hofhansl (Jira)


[ 
https://issues.apache.org/jira/browse/PHOENIX-6445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17321840#comment-17321840
 ] 

Lars Hofhansl commented on PHOENIX-6445:


Three. Final count is missing.
{code}
> explain select count(*) from (select * from test group by rand());
+--+
|  PLAN 
   |
+--+
| CLIENT 10-CHUNK 2578465 ROWS 314572800 BYTES PARALLEL 1-WAY FULL SCAN OVER 
TEST  |
| SERVER FILTER BY FIRST KEY ONLY   
   |
+--+
2 rows selected (0.03 seconds)
{code}

> Wrong query plans with functions
> 
>
> Key: PHOENIX-6445
> URL: https://issues.apache.org/jira/browse/PHOENIX-6445
> Project: Phoenix
>  Issue Type: Wish
>Reporter: Lars Hofhansl
>Priority: Major
>
> Phoenix seems to sometimes create incorrect query plans when functions are 
> used.
> I'll post these in the comments.



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


[jira] [Commented] (PHOENIX-6445) Wrong query plans with functions

2021-04-14 Thread Lars Hofhansl (Jira)


[ 
https://issues.apache.org/jira/browse/PHOENIX-6445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17321839#comment-17321839
 ] 

Lars Hofhansl commented on PHOENIX-6445:


Two. This should be an invalid query.
{code}
> explain select v1 from test group by rand();
+--+
|   PLAN
   |
+--+
| CLIENT 10-CHUNK 7315646 ROWS 314572800 BYTES PARALLEL 10-WAY ROUND ROBIN 
RANGE S |
| SERVER FILTER BY FIRST KEY ONLY   
   |
+--+
2 rows selected (0.151 seconds)
{code}


> Wrong query plans with functions
> 
>
> Key: PHOENIX-6445
> URL: https://issues.apache.org/jira/browse/PHOENIX-6445
> Project: Phoenix
>  Issue Type: Wish
>Reporter: Lars Hofhansl
>Priority: Major
>
> Phoenix seems to sometimes create incorrect query plans when functions are 
> used.
> I'll post these in the comments.



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


[jira] [Commented] (PHOENIX-6445) Wrong query plans with functions

2021-04-14 Thread Lars Hofhansl (Jira)


[ 
https://issues.apache.org/jira/browse/PHOENIX-6445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17321838#comment-17321838
 ] 

Lars Hofhansl commented on PHOENIX-6445:


Example one. The group by is missing.

{code}
> explain select /*+ NO_INDEX */ count(distinct(phoenix_row_timestamp())) from 
> test1;
+--+
|   PLAN
   |
+--+
| CLIENT 10-CHUNK 2578465 ROWS 314572800 BYTES PARALLEL 10-WAY FULL SCAN OVER 
TEST |
| SERVER FILTER BY FIRST KEY ONLY   
   |
| SERVER AGGREGATE INTO SINGLE ROW  
   |
+--+
3 rows selected (0.03 seconds)
{code}


> Wrong query plans with functions
> 
>
> Key: PHOENIX-6445
> URL: https://issues.apache.org/jira/browse/PHOENIX-6445
> Project: Phoenix
>  Issue Type: Wish
>Reporter: Lars Hofhansl
>Priority: Major
>
> Phoenix seems to sometimes create incorrect query plans when functions are 
> used.
> I'll post these in the comments.



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