Uploaded image for project: 'Tajo'
  1. Tajo
  2. TAJO-1643

SQLParse can't parse parentheses table clause

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.12.0, 0.11.1
    • Component/s: SQL Parser
    • Labels:
      None

      Description

      SQLParser can't parse table alias in brackets as following:

      tpch> select c.*
      > from (customer as c)
      > ;
      ERROR: syntax error at or near '('
      LINE 2:5 from (customer as c)
      

      Above case, I found error logs as follows.

      Caused by: org.apache.tajo.engine.parser.SQLParseError: ERROR: syntax error at or near '('
      LINE 2:5 from (customer as c)
                    ^
      	at org.apache.tajo.engine.parser.SQLErrorListener.syntaxError(SQLErrorListener.java:36)
      	at org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:65)
      	at org.antlr.v4.runtime.Parser.notifyErrorListeners(Parser.java:473)
      	at org.apache.tajo.engine.parser.SQLErrorStrategy.reportNoViableAltException(SQLErrorStrategy.java:57)
      	at org.apache.tajo.engine.parser.SQLErrorStrategy.reportError(SQLErrorStrategy.java:35)
      	at org.apache.tajo.engine.parser.SQLParser.table_reference(SQLParser.java:10002)
      	at org.apache.tajo.engine.parser.SQLParser.table_reference_list(SQLParser.java:9925)
      	at org.apache.tajo.engine.parser.SQLParser.from_clause(SQLParser.java:9874)
      	at org.apache.tajo.engine.parser.SQLParser.table_expression(SQLParser.java:9781)
      	at org.apache.tajo.engine.parser.SQLParser.query_specification(SQLParser.java:13541)
      	at org.apache.tajo.engine.parser.SQLParser.simple_table(SQLParser.java:13251)
      	at org.apache.tajo.engine.parser.SQLParser.non_join_query_primary(SQLParser.java:13190)
      	at org.apache.tajo.engine.parser.SQLParser.non_join_query_term(SQLParser.java:13029)
      	at org.apache.tajo.engine.parser.SQLParser.non_join_query_expression(SQLParser.java:12841)
      	at org.apache.tajo.engine.parser.SQLParser.query_expression_body(SQLParser.java:12759)
      	at org.apache.tajo.engine.parser.SQLParser.query_expression(SQLParser.java:12710)
      	at org.apache.tajo.engine.parser.SQLParser.data_statement(SQLParser.java:669)
      	at org.apache.tajo.engine.parser.SQLParser.statement(SQLParser.java:422)
      	at org.apache.tajo.engine.parser.SQLParser.sql(SQLParser.java:307)
      	at org.apache.tajo.engine.parser.SQLAnalyzer.parse(SQLAnalyzer.java:65)
      

        Activity

        Hide
        githubbot ASF GitHub Bot added a comment -

        GitHub user hyunsik opened a pull request:

        https://github.com/apache/tajo/pull/834

        TAJO-1643: SQLParse can't parse table alias in in brackets.

        You can merge this pull request into a Git repository by running:

        $ git pull https://github.com/hyunsik/tajo TAJO-1643

        Alternatively you can review and apply these changes as the patch at:

        https://github.com/apache/tajo/pull/834.patch

        To close this pull request, make a commit to your master/trunk branch
        with (at least) the following in the commit message:

        This closes #834


        commit 85bc45fd1781b3c8ed38b19886c056bc6050c4a2
        Author: Hyunsik Choi <hyunsik@apache.org>
        Date: 2015-10-20T10:41:16Z

        TAJO-1643: SQLParse can't parse table alias in in brackets.


        Show
        githubbot ASF GitHub Bot added a comment - GitHub user hyunsik opened a pull request: https://github.com/apache/tajo/pull/834 TAJO-1643 : SQLParse can't parse table alias in in brackets. You can merge this pull request into a Git repository by running: $ git pull https://github.com/hyunsik/tajo TAJO-1643 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/tajo/pull/834.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #834 commit 85bc45fd1781b3c8ed38b19886c056bc6050c4a2 Author: Hyunsik Choi <hyunsik@apache.org> Date: 2015-10-20T10:41:16Z TAJO-1643 : SQLParse can't parse table alias in in brackets.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user jihoonson commented on the pull request:

        https://github.com/apache/tajo/pull/834#issuecomment-149757494

        +1 looks good to me.
        Anyway, as you already know, this is a workaround.
        I wonder that you have any plan to start to support explicit join order using parentheses in the ```from``` clause. I think that this feature will be helpful for users by allowing hint for join ordering as well as for us to estimate the efficiency of our join ordering algorithm.

        Show
        githubbot ASF GitHub Bot added a comment - Github user jihoonson commented on the pull request: https://github.com/apache/tajo/pull/834#issuecomment-149757494 +1 looks good to me. Anyway, as you already know, this is a workaround. I wonder that you have any plan to start to support explicit join order using parentheses in the ```from``` clause. I think that this feature will be helpful for users by allowing hint for join ordering as well as for us to estimate the efficiency of our join ordering algorithm.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user hyunsik commented on the pull request:

        https://github.com/apache/tajo/pull/834#issuecomment-150454996

        I totally agreed. We need to implement explicit join order too. I'll commit it shortly. Thank you !

        Show
        githubbot ASF GitHub Bot added a comment - Github user hyunsik commented on the pull request: https://github.com/apache/tajo/pull/834#issuecomment-150454996 I totally agreed. We need to implement explicit join order too. I'll commit it shortly. Thank you !
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user asfgit closed the pull request at:

        https://github.com/apache/tajo/pull/834

        Show
        githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/tajo/pull/834
        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Tajo-master-CODEGEN-build #572 (See https://builds.apache.org/job/Tajo-master-CODEGEN-build/572/)
        TAJO-1643: SQLParse can't parse table alias in in brackets. (hyunsik: rev a89b52337ef7d7c728e071766ccee6436ccde6a5)

        • tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/positive/parentheses_table_3.sql
        • CHANGES
        • tajo-sql-parser/src/main/antlr4/org/apache/tajo/parser/sql/SQLParser.g4
        • tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/positive/parentheses_table_2.sql
        • tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/positive/parentheses_table_1.sql
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Tajo-master-CODEGEN-build #572 (See https://builds.apache.org/job/Tajo-master-CODEGEN-build/572/ ) TAJO-1643 : SQLParse can't parse table alias in in brackets. (hyunsik: rev a89b52337ef7d7c728e071766ccee6436ccde6a5) tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/positive/parentheses_table_3.sql CHANGES tajo-sql-parser/src/main/antlr4/org/apache/tajo/parser/sql/SQLParser.g4 tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/positive/parentheses_table_2.sql tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/positive/parentheses_table_1.sql
        Hide
        hyunsik Hyunsik Choi added a comment -

        I just committed the patch to master and branch-0.11.1.

        Show
        hyunsik Hyunsik Choi added a comment - I just committed the patch to master and branch-0.11.1.
        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Tajo-master-build #947 (See https://builds.apache.org/job/Tajo-master-build/947/)
        TAJO-1643: SQLParse can't parse table alias in in brackets. (hyunsik: rev a89b52337ef7d7c728e071766ccee6436ccde6a5)

        • tajo-sql-parser/src/main/antlr4/org/apache/tajo/parser/sql/SQLParser.g4
        • tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/positive/parentheses_table_2.sql
        • tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/positive/parentheses_table_1.sql
        • CHANGES
        • tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/positive/parentheses_table_3.sql
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Tajo-master-build #947 (See https://builds.apache.org/job/Tajo-master-build/947/ ) TAJO-1643 : SQLParse can't parse table alias in in brackets. (hyunsik: rev a89b52337ef7d7c728e071766ccee6436ccde6a5) tajo-sql-parser/src/main/antlr4/org/apache/tajo/parser/sql/SQLParser.g4 tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/positive/parentheses_table_2.sql tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/positive/parentheses_table_1.sql CHANGES tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/positive/parentheses_table_3.sql

          People

          • Assignee:
            hyunsik Hyunsik Choi
            Reporter:
            blrunner Jaehwa Jung
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development