You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2015/06/10 20:45:02 UTC
[jira] [Comment Edited] (CALCITE-754) Failure to resolve a column
in OVER-CLAUSE if that column is produced by a JOIN
[ https://issues.apache.org/jira/browse/CALCITE-754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14580941#comment-14580941 ]
Julian Hyde edited comment on CALCITE-754 at 6/10/15 6:44 PM:
--------------------------------------------------------------
It struck me as strange that you needed to qualify a column name when a namespace was also passed along. Then I noticed this comment in SqlWindow.isTableSorted:
{code}
// REVIEW: jhyde, 2007/11/7: This is the only use of
// findAllColumnNames. Find a better way to detect monotonicity, then
// remove that method.
{code}
Basically, we shouldn't be using SqlMoniker. Monotonicity detection should be using column name and namespace, like the rest of the validator code. A namespace represents a table, and it may map to single or multiple strings: EMP, SCHEMA.EMP, DB.SCHEMA.EMP, T1 are all examples.
That comment basically predicted this problem, so now it's time to fix it.
was (Author: julianhyde):
It struck me as strange that you needed to qualify a column name when a namespace was also passed along. Then I noticed this comment in SqlWindow.isTableSorted:
```java
// REVIEW: jhyde, 2007/11/7: This is the only use of
// findAllColumnNames. Find a better way to detect monotonicity, then
// remove that method.
```
Basically, we shouldn't be using SqlMoniker. Monotonicity detection should be using column name and namespace, like the rest of the validator code. A namespace represents a table, and it may map to single or multiple strings: EMP, SCHEMA.EMP, DB.SCHEMA.EMP, T1 are all examples.
That comment basically predicted this problem, so now it's time to fix it.
> Failure to resolve a column in OVER-CLAUSE if that column is produced by a JOIN
> -------------------------------------------------------------------------------
>
> Key: CALCITE-754
> URL: https://issues.apache.org/jira/browse/CALCITE-754
> Project: Calcite
> Issue Type: Bug
> Reporter: Sean Hsuan-Yi Chu
> Assignee: Sean Hsuan-Yi Chu
>
> A query such as :
> select sum(t1.deptno) over(partition by t1.deptno)
> from emp t1, emp t2
> would raise exception:
> org.apache.calcite.sql.validate.SqlValidatorException: Column 'EMPNO' is ambiguous.
> Calcite cannot point the column in OVER-CLAUSE to the JOINed table.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)