Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 0.9.0
    • Fix Version/s: None
    • Component/s: CLI
    • Labels:
    • Environment:

      OS: Ubuntu
      Hive version: hive-0.7.1-cdh3u2
      Hadoop : hadoop-0.20.2

      Description

      When i try to execute select *(followed by any alphanumeric character) from table , query is throwing some issues. It display the result for select *

      It doesnot happen when only numbers follow the *

      1. select_syntax.q.out
        0.1 kB
        Ajesh Kumar
      2. select_syntax.q
        0.0 kB
        Ajesh Kumar
      3. HIVE-3141.2.patch.txt
        1 kB
        Ajesh Kumar
      4. Hive_bug_3141_resolution.pdf
        82 kB
        Ajesh Kumar

        Activity

        ASK created issue -
        ASK made changes -
        Field Original Value New Value
        Status Open [ 1 ] Patch Available [ 10002 ]
        ASK made changes -
        Status Patch Available [ 10002 ] Open [ 1 ]
        ASK made changes -
        Environment
        OS: Ubuntu
        Hive version: hive-0.7.1-cdh3u2
        Hadoop : hadoop-0.20.2

        OS: Ubuntu
        Hive version: hive-0.7.1-cdh3u2
        Hadoop : hadoop-0.20.2

        Description When i use ' select *(followed by any alphan-numeric character) frm table '. the query is working.
        eg. select *fdkfj3434 from stocks.

        It doesnot happen when only numbers follow the *
        When i use ' select *(followed by any alphan-numeric character) frm table , query is throwing some issues. It display the result for select *

        It doesnot happen when only numbers follow the *
        Rohith made changes -
        Component/s Tests [ 12317406 ]
        Component/s CLI [ 12313604 ]
        Rohith made changes -
        Component/s CLI [ 12313604 ]
        Component/s Tests [ 12317406 ]
        ASK made changes -
        Priority Major [ 3 ] Minor [ 4 ]
        Description When i use ' select *(followed by any alphan-numeric character) frm table , query is throwing some issues. It display the result for select *

        It doesnot happen when only numbers follow the *
        When i try to execute select *(followed by any alphanumeric character) from table , query is throwing some issues. It display the result for select *

        It doesnot happen when only numbers follow the *
        Hide
        Navis added a comment -

        It accepts regex expressions..

        select `.*(your-alphanumerics)` from table;

        Show
        Navis added a comment - It accepts regex expressions.. select `.*(your-alphanumerics)` from table;
        Hide
        Ajesh Kumar added a comment -

        we can provide extra verification for the syntax of select statement to address the issue raised. This would provide an appropriate error message to the user if the syntax is wrong. I have made a change in my local source code which accomplishes this proposed solution . I have attached a screen shot "Hive_bug_3141_resolution.pdf" for reference.

        Show
        Ajesh Kumar added a comment - we can provide extra verification for the syntax of select statement to address the issue raised. This would provide an appropriate error message to the user if the syntax is wrong. I have made a change in my local source code which accomplishes this proposed solution . I have attached a screen shot "Hive_bug_3141_resolution.pdf" for reference.
        Ajesh Kumar made changes -
        Attachment Hive_bug_3141_resolution.pdf [ 12538348 ]
        Hide
        Ajesh Kumar added a comment -

        Made change in CliDriver.java to make a check on the syntax of select statement.Please do a code review.
        The attached screen shot "Hive_bug_3141_resolution.pdf" shows how the select query works after the patch done in my local.

        Show
        Ajesh Kumar added a comment - Made change in CliDriver.java to make a check on the syntax of select statement.Please do a code review. The attached screen shot "Hive_bug_3141_resolution.pdf" shows how the select query works after the patch done in my local.
        Ajesh Kumar made changes -
        Attachment HIVE-3141.1.patch.txt [ 12539571 ]
        Hide
        Ajesh Kumar added a comment -

        Made change in CliDriver.java to make an extra check on the syntax of select statement.
        The attached screen shot "Hive_bug_3141_resolution.pdf" shows how the select query works after the patch done in my local

        Show
        Ajesh Kumar added a comment - Made change in CliDriver.java to make an extra check on the syntax of select statement. The attached screen shot "Hive_bug_3141_resolution.pdf" shows how the select query works after the patch done in my local
        Ajesh Kumar made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Affects Version/s 0.9.0 [ 12317742 ]
        Labels patch
        Hide
        Namit Jain added a comment -

        Can you add negative test for the scenarios you mentioned ?

        Show
        Namit Jain added a comment - Can you add negative test for the scenarios you mentioned ?
        Namit Jain made changes -
        Status Patch Available [ 10002 ] Open [ 1 ]
        Hide
        Ajesh Kumar added a comment -

        Hi Namit,
        Both positive and negative tests are included in the attachment "Hive_bug_3141_resolution.pdf". Please let me know if I am missing any specific scenario?
        thanks

        Show
        Ajesh Kumar added a comment - Hi Namit, Both positive and negative tests are included in the attachment "Hive_bug_3141_resolution.pdf". Please let me know if I am missing any specific scenario? thanks
        Hide
        Namit Jain added a comment -

        @Ajesh, can you add some tests in ql/src/test/queries/clientnegative

        Look at the various .q files present there.

        More details at
        https://cwiki.apache.org/Hive/developerguide.html#DeveloperGuide-Unittestsanddebugging

        Show
        Namit Jain added a comment - @Ajesh, can you add some tests in ql/src/test/queries/clientnegative Look at the various .q files present there. More details at https://cwiki.apache.org/Hive/developerguide.html#DeveloperGuide-Unittestsanddebugging
        Hide
        Ajesh Kumar added a comment -

        Adding q file and q.out file for negative test.

        Show
        Ajesh Kumar added a comment - Adding q file and q.out file for negative test.
        Ajesh Kumar made changes -
        Attachment select_syntax.q [ 12539998 ]
        Attachment select_syntax.q.out [ 12539999 ]
        Hide
        Ajesh Kumar added a comment -

        Adding q file and q.out file for negative test

        Show
        Ajesh Kumar added a comment - Adding q file and q.out file for negative test
        Ajesh Kumar made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Hide
        Namit Jain added a comment -

        Ajesh, can you provide a single patch containing all the changes.
        And can you use https://cwiki.apache.org/Hive/phabricatorcodereview.html to create a review ?
        It is very easy to review.

        Show
        Namit Jain added a comment - Ajesh, can you provide a single patch containing all the changes. And can you use https://cwiki.apache.org/Hive/phabricatorcodereview.html to create a review ? It is very easy to review.
        Namit Jain made changes -
        Status Patch Available [ 10002 ] Open [ 1 ]
        Hide
        Ajesh Kumar added a comment -

        Adding all changes in a single patch file. HIVE-3141.2.patch.txt

        Show
        Ajesh Kumar added a comment - Adding all changes in a single patch file. HIVE-3141 .2.patch.txt
        Ajesh Kumar made changes -
        Attachment HIVE-3141.2.patch.txt [ 12543595 ]
        Hide
        Ajesh Kumar added a comment -

        Hi Namit,
        I have added all the changes in a single patch file, HIVE-3141.2.patch.txt.
        Please do a review. Because of some software installation limitations, I am not able to install the required software for using Phabricator.So I am not able to create a review for the patch.

        Show
        Ajesh Kumar added a comment - Hi Namit, I have added all the changes in a single patch file, HIVE-3141 .2.patch.txt. Please do a review. Because of some software installation limitations, I am not able to install the required software for using Phabricator.So I am not able to create a review for the patch.
        Ajesh Kumar made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Hide
        Carl Steinbach added a comment -

        @Ajesh: Can you please try using the reviews.apache.org site instead? This site does not require you to install any client-side components. Thanks.

        Show
        Carl Steinbach added a comment - @Ajesh: Can you please try using the reviews.apache.org site instead? This site does not require you to install any client-side components. Thanks.
        Hide
        Ajesh Kumar added a comment -

        Thanks Carl
        I have added review request in reviews.apache.org.
        Please find the link for the same https://reviews.apache.org/r/6919/

        Show
        Ajesh Kumar added a comment - Thanks Carl I have added review request in reviews.apache.org. Please find the link for the same https://reviews.apache.org/r/6919/
        Ajesh Kumar made changes -
        Attachment HIVE-3141.1.patch.txt [ 12539571 ]
        Hide
        Carl Steinbach added a comment -

        Syntax checks like this don't belong in CliDriver because other clients (e.g. Thrift) bypass this logic. We should either modify the grammar to find problems like this, or else do the same check in the SemanticAnalyzer.

        Show
        Carl Steinbach added a comment - Syntax checks like this don't belong in CliDriver because other clients (e.g. Thrift) bypass this logic. We should either modify the grammar to find problems like this, or else do the same check in the SemanticAnalyzer.
        Carl Steinbach made changes -
        Status Patch Available [ 10002 ] Open [ 1 ]
        Hide
        Ajesh Kumar added a comment -

        Parsing is done in org.apache.hadoop.hive.ql.parse.HiveParser.java. But source code for this file is not available in hadoop distribution.

        Another option is to modify parse() method in ParseDriver.java to add extra verification for the syntax .All the services like cli,hiveserver uses this method for parsing. Let me know your comments.

        Show
        Ajesh Kumar added a comment - Parsing is done in org.apache.hadoop.hive.ql.parse.HiveParser.java. But source code for this file is not available in hadoop distribution. Another option is to modify parse() method in ParseDriver.java to add extra verification for the syntax .All the services like cli,hiveserver uses this method for parsing. Let me know your comments.
        Hide
        Carl Steinbach added a comment -

        HiveParser.java is autogenerated by ANTLR using the Hive grammar file located here:

        ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g

        Another option is to modify parse() method in ParseDriver.java to add extra verification for the syntax .All the services like cli,hiveserver uses this method for parsing. Let me know your comments.

        The right place for this check is probably somewhere in the SemanticAnalyzer class. Please take a look at this, and in particular pay attention to the places where SemanticExceptions are thrown.

        Show
        Carl Steinbach added a comment - HiveParser.java is autogenerated by ANTLR using the Hive grammar file located here: ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g Another option is to modify parse() method in ParseDriver.java to add extra verification for the syntax .All the services like cli,hiveserver uses this method for parsing. Let me know your comments. The right place for this check is probably somewhere in the SemanticAnalyzer class. Please take a look at this, and in particular pay attention to the places where SemanticExceptions are thrown.
        Hide
        Ajesh Kumar added a comment -

        Hi Carl,
        when we execute 'select' query , it is not invoking SemanticAnalyzer.class.
        Let me know if I am missing something in my analysis.

        Show
        Ajesh Kumar added a comment - Hi Carl, when we execute 'select' query , it is not invoking SemanticAnalyzer.class. Let me know if I am missing something in my analysis.
        Namit Jain made changes -
        Assignee Ajesh Kumar [ ajeshpg ]
        Hide
        Ajesh Kumar added a comment -

        Hi Carl
        when we execute 'select' query , it is not invoking SemanticAnalyzer.class. Let me know if I can go ahead with modifying parse() method in ParseDriver.java.

        Show
        Ajesh Kumar added a comment - Hi Carl when we execute 'select' query , it is not invoking SemanticAnalyzer.class. Let me know if I can go ahead with modifying parse() method in ParseDriver.java.

          People

          • Assignee:
            Ajesh Kumar
            Reporter:
            ASK
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:

              Development