You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@asterixdb.apache.org by "Michael J. Carey (JIRA)" <ji...@apache.org> on 2019/06/27 22:16:00 UTC
[jira] [Created] (ASTERIXDB-2601) Misleading/perplexing
aggregate-related error message
Michael J. Carey created ASTERIXDB-2601:
-------------------------------------------
Summary: Misleading/perplexing aggregate-related error message
Key: ASTERIXDB-2601
URL: https://issues.apache.org/jira/browse/ASTERIXDB-2601
Project: Apache AsterixDB
Issue Type: Bug
Components: *DB - AsterixDB, SQL - Translator SQL++
Affects Versions: 0.9.4.1
Reporter: Michael J. Carey
Assignee: Dmitry Lychagin
Fix For: 0.9.5
The following illegal aggregate query has a confusing error message that leaves the user having no idea what's wrong:
SELECT a.handle, SUM(a.result)
FROM [ \{"handle": "one", "result": 23},
\{"handle": "two", "result": 64},
\{"handle": "two", "result": 6},
\{"handle": "four", "result": 34},
\{"handle": "two", "result": 3} ] AS a;
The error message is:
ASX1073: Cannot resolve alias reference for undefined identifier a (in line 1, at column 8)
Note that the following query works fine, which leads to serious head-scratching by the user:
SELECT a.handle, to_string(a.result)
FROM [ \{"handle": "one", "result": 23},
\{"handle": "two", "result": 64},
\{"handle": "two", "result": 6},
\{"handle": "four", "result": 34},
\{"handle": "two", "result": 3} ] AS a;
The real problem is the inappropriate use of an aggregate function (SUM) - but the alias error gives no clue! Here is how MySQL complains about this:
Error Code: 1140. In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'a.handle';
Can we do something similar? I think the problem is that we rewrite the query internally and then something about the rewritten internal query leads to the error we currently produce.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)