[jira] [Commented] (ASTERIXDB-1560) Misleading SQL++ error message when variables are undefined
[ https://issues.apache.org/jira/browse/ASTERIXDB-1560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15421158#comment-15421158 ] ASF subversion and git services commented on ASTERIXDB-1560: Commit 8671ddf83ed402dce7465759d6399ed84993f967 in asterixdb's branch refs/heads/master from [~buyingyi] [ https://git-wip-us.apache.org/repos/asf?p=asterixdb.git;h=8671ddf ] Clean up GROUP BY and WITH clause. - fix ASTERIXDB-971, i.e., the expression to plan translator for FLWOGR without a "for"; - fix the scoping for nested WITH clause; - fix the scoping for nested GROUP BY clause; - fix default fields in group variables; - fix/unify the expression substition AST visitor; - enhance RemoveUnusedAssignAndAggregateRule to be able to remove unused GROUP BY decoration varaibles; - clearly sperate SQL++ aggregate functions and SQL-92 aggregate functions, i.e., SQL-92 aggregate sugars cannot apply to SQL++ aggregate functions; - fix PushAggregateIntoGroupbyRule for nested plan deletions; - enhance RemoveCartesianProductWithEmptyBranchRule; - add ExtractGroupByDecorVariablesRule; - add an aggregate function first-element; - fix ASTERIXDB-1560, an error message issue. Change-Id: I62fca7f937aa007d97ed87c75cef19f6aa3e5ade Reviewed-on: https://asterix-gerrit.ics.uci.edu/1050 Tested-by: JenkinsIntegration-Tests: Jenkins Reviewed-by: Till Westmann > Misleading SQL++ error message when variables are undefined > > > Key: ASTERIXDB-1560 > URL: https://issues.apache.org/jira/browse/ASTERIXDB-1560 > Project: Apache AsterixDB > Issue Type: Bug > Components: AsterixDB, Error Reporting >Reporter: Michael J. Carey >Assignee: Yingyi Bu >Priority: Minor > > This query: > SELECT u.name AS uname, m.message AS message > FROM GleambookUsers u > UNNEST GleambookMessages m > WHERE m.authorId = user.id; > Yields this error message: > Cannot resolve ambiguous alias (variable) reference for identifier user > [AlgebricksException] > The reference is undefined, not ambiguous, in this case. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (ASTERIXDB-1560) Misleading SQL++ error message when variables are undefined
[ https://issues.apache.org/jira/browse/ASTERIXDB-1560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15406529#comment-15406529 ] Yingyi Bu commented on ASTERIXDB-1560: -- >>That actually raises an orthogonal issue - perhaps we should (someday) add >>ANY as a supported typename and then you wouldn't need two separate >>mechanisms. +1 :-) > Misleading SQL++ error message when variables are undefined > > > Key: ASTERIXDB-1560 > URL: https://issues.apache.org/jira/browse/ASTERIXDB-1560 > Project: Apache AsterixDB > Issue Type: Bug > Components: AsterixDB, Error Reporting >Reporter: Michael J. Carey >Assignee: Yingyi Bu >Priority: Minor > > This query: > SELECT u.name AS uname, m.message AS message > FROM GleambookUsers u > UNNEST GleambookMessages m > WHERE m.authorId = user.id; > Yields this error message: > Cannot resolve ambiguous alias (variable) reference for identifier user > [AlgebricksException] > The reference is undefined, not ambiguous, in this case. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (ASTERIXDB-1560) Misleading SQL++ error message when variables are undefined
[ https://issues.apache.org/jira/browse/ASTERIXDB-1560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15406520#comment-15406520 ] Michael J. Carey commented on ASTERIXDB-1560: - Thx! Meanwhile, regarding the last/long comment - COOL! That actually raises an orthogonal issue - perhaps we should (someday) add ANY as a supported typename and then you wouldn't need two separate mechanisms. (We'd have a type-system-supported way of having fields with known names but variable types.) > Misleading SQL++ error message when variables are undefined > > > Key: ASTERIXDB-1560 > URL: https://issues.apache.org/jira/browse/ASTERIXDB-1560 > Project: Apache AsterixDB > Issue Type: Bug > Components: AsterixDB, Error Reporting >Reporter: Michael J. Carey >Assignee: Yingyi Bu >Priority: Minor > > This query: > SELECT u.name AS uname, m.message AS message > FROM GleambookUsers u > UNNEST GleambookMessages m > WHERE m.authorId = user.id; > Yields this error message: > Cannot resolve ambiguous alias (variable) reference for identifier user > [AlgebricksException] > The reference is undefined, not ambiguous, in this case. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (ASTERIXDB-1560) Misleading SQL++ error message when variables are undefined
[ https://issues.apache.org/jira/browse/ASTERIXDB-1560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15404894#comment-15404894 ] Yingyi Bu commented on ASTERIXDB-1560: -- That's right. (The rare, abnormal cases are that fields are generated by certain functions, that the compiler can know exactly the return type, e.g., substr, count, etc.) In addition to that, what I added recently is the concept of *bounded* "all possible field name sets" into open types. There are two cases for *open* types: CASE 1: for open types associated with a dataset, any field name is possible for the open part of a dataset record; CASE 2: however, for open types generated by a SQL-style SELECT (sub-) query, the compiler can have the knowledge of what "all possible field names" are. An example of CASE 2 is: SELECT user_name name FROM ( SELECT user.alias user_alias, user.name user_name FROM FacebookUsers user WHERE user.id = 1 ) foo; The return type of the subquery is "Open:{}", because FacebookUsers.alias is of type ANY and FacebookUsers.name is of type ANY. However, the compiler knows that the *bounded* possible field name set is {"user_alias", "user_name"} for the return type of the subquery, and hence it is still be able to accurately de-sugar the example query or error it out:-) > Misleading SQL++ error message when variables are undefined > > > Key: ASTERIXDB-1560 > URL: https://issues.apache.org/jira/browse/ASTERIXDB-1560 > Project: Apache AsterixDB > Issue Type: Bug > Components: AsterixDB, Error Reporting >Reporter: Michael J. Carey >Assignee: Yingyi Bu >Priority: Minor > > This query: > SELECT u.name AS uname, m.message AS message > FROM GleambookUsers u > UNNEST GleambookMessages m > WHERE m.authorId = user.id; > Yields this error message: > Cannot resolve ambiguous alias (variable) reference for identifier user > [AlgebricksException] > The reference is undefined, not ambiguous, in this case. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (ASTERIXDB-1560) Misleading SQL++ error message when variables are undefined
[ https://issues.apache.org/jira/browse/ASTERIXDB-1560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15404872#comment-15404872 ] Yingyi Bu commented on ASTERIXDB-1560: -- >> Maybe we could say "ambiguous or undefined"? (Just so they don't start >> combing their query for multiply-defined things?) Sure, make sense to me! > Misleading SQL++ error message when variables are undefined > > > Key: ASTERIXDB-1560 > URL: https://issues.apache.org/jira/browse/ASTERIXDB-1560 > Project: Apache AsterixDB > Issue Type: Bug > Components: AsterixDB, Error Reporting >Reporter: Michael J. Carey >Assignee: Yingyi Bu >Priority: Minor > > This query: > SELECT u.name AS uname, m.message AS message > FROM GleambookUsers u > UNNEST GleambookMessages m > WHERE m.authorId = user.id; > Yields this error message: > Cannot resolve ambiguous alias (variable) reference for identifier user > [AlgebricksException] > The reference is undefined, not ambiguous, in this case. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (ASTERIXDB-1560) Misleading SQL++ error message when variables are undefined
[ https://issues.apache.org/jira/browse/ASTERIXDB-1560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15404869#comment-15404869 ] Michael J. Carey commented on ASTERIXDB-1560: - PS: I don't forsee any of our users using closed types under normal circumstances... :-) > Misleading SQL++ error message when variables are undefined > > > Key: ASTERIXDB-1560 > URL: https://issues.apache.org/jira/browse/ASTERIXDB-1560 > Project: Apache AsterixDB > Issue Type: Bug > Components: AsterixDB, Error Reporting >Reporter: Michael J. Carey >Assignee: Yingyi Bu >Priority: Minor > > This query: > SELECT u.name AS uname, m.message AS message > FROM GleambookUsers u > UNNEST GleambookMessages m > WHERE m.authorId = user.id; > Yields this error message: > Cannot resolve ambiguous alias (variable) reference for identifier user > [AlgebricksException] > The reference is undefined, not ambiguous, in this case. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (ASTERIXDB-1560) Misleading SQL++ error message when variables are undefined
[ https://issues.apache.org/jira/browse/ASTERIXDB-1560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15404868#comment-15404868 ] Michael J. Carey commented on ASTERIXDB-1560: - All technically correct and understandable (now). But - users will be somewhat mystified and "ambiguous" will potentially lead them to look under the wrong rock for the problem. Maybe we could say "ambiguous or undefined"? (Just so they don't start combing their query for multiply-defined things?) > Misleading SQL++ error message when variables are undefined > > > Key: ASTERIXDB-1560 > URL: https://issues.apache.org/jira/browse/ASTERIXDB-1560 > Project: Apache AsterixDB > Issue Type: Bug > Components: AsterixDB, Error Reporting >Reporter: Michael J. Carey >Assignee: Yingyi Bu >Priority: Minor > > This query: > SELECT u.name AS uname, m.message AS message > FROM GleambookUsers u > UNNEST GleambookMessages m > WHERE m.authorId = user.id; > Yields this error message: > Cannot resolve ambiguous alias (variable) reference for identifier user > [AlgebricksException] > The reference is undefined, not ambiguous, in this case. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (ASTERIXDB-1560) Misleading SQL++ error message when variables are undefined
[ https://issues.apache.org/jira/browse/ASTERIXDB-1560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15404700#comment-15404700 ] Yingyi Bu commented on ASTERIXDB-1560: -- In another extreme, if you define both datasets using *closed* types, then you'll see SQL-92-compliant behaviors for implicit variable references:-) CASE1: "user" is a field of GleambookUsers but not GleambookMessages, succeed; CASE2: "user" is a field of GleambookMessages but not GleambookUsers, succeed; CASE3: "user" is a field of GleambookMessages and also a field of GleambookUsers, fail with the "ambiguous reference..." message; CASE4: "user" is not a field of GleambookMessages nor a field of GleambookUsers, fail with the "undefined identifier " message. For your query which defines both dataset using *open* types, the error message is consistent with the above CASE 3. > Misleading SQL++ error message when variables are undefined > > > Key: ASTERIXDB-1560 > URL: https://issues.apache.org/jira/browse/ASTERIXDB-1560 > Project: Apache AsterixDB > Issue Type: Bug > Components: AsterixDB, Error Reporting >Reporter: Michael J. Carey >Assignee: Yingyi Bu >Priority: Minor > > This query: > SELECT u.name AS uname, m.message AS message > FROM GleambookUsers u > UNNEST GleambookMessages m > WHERE m.authorId = user.id; > Yields this error message: > Cannot resolve ambiguous alias (variable) reference for identifier user > [AlgebricksException] > The reference is undefined, not ambiguous, in this case. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (ASTERIXDB-1560) Misleading SQL++ error message when variables are undefined
[ https://issues.apache.org/jira/browse/ASTERIXDB-1560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15404685#comment-15404685 ] Yingyi Bu commented on ASTERIXDB-1560: -- [~dtabass], here is why we get this error message: SELECT u.name AS uname, m.message AS message FROM GleambookUsers u UNNEST GleambookMessages m WHERE m.authorId = user.id; Since the symbol "user" is not defined, the compiler tries to resolve "user" as abbreviatory field accesses (since we support implicit variable references similar to SQL-92). Since the type of GleambookUsers and GleambookMessages are open, "user" could potentially be a field of records from either dataset: Possibility 1: SELECT u.name AS uname, m.message AS message FROM GleambookUsers u UNNEST GleambookMessages m WHERE m.authorId = u.user.id; Possibility 2: SELECT u.name AS uname, m.message AS message FROM GleambookUsers u UNNEST GleambookMessages m WHERE m.authorId = m.user.id; Therefore, it complains that there could ambiguous alias reference for "user", i.e.: u.user or m.user Best, Yingyi > Misleading SQL++ error message when variables are undefined > > > Key: ASTERIXDB-1560 > URL: https://issues.apache.org/jira/browse/ASTERIXDB-1560 > Project: Apache AsterixDB > Issue Type: Bug > Components: AsterixDB, Error Reporting >Reporter: Michael J. Carey >Assignee: Yingyi Bu >Priority: Minor > > This query: > SELECT u.name AS uname, m.message AS message > FROM GleambookUsers u > UNNEST GleambookMessages m > WHERE m.authorId = user.id; > Yields this error message: > Cannot resolve ambiguous alias (variable) reference for identifier user > [AlgebricksException] > The reference is undefined, not ambiguous, in this case. -- This message was sent by Atlassian JIRA (v6.3.4#6332)