Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-3744

Pattern making in "show ... like ..." behaves differently from Hive

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • Impala 2.6.0
    • None
    • Frontend

    Description

      In impala:

      [localhost:21000] > show tables;
      Query: show tables
      +------+
      | name |
      +------+
      | a    |
      | aa   |
      | aaa  |
      +------+
      Fetched 3 row(s) in 0.01s
      [localhost:21000] > show tables like "a";
      Query: show tables like "a"
      +------+
      | name |
      +------+
      | a    |
      +------+
      Fetched 1 row(s) in 0.01s
      [localhost:21000] > show tables like "a_";
      Query: show tables like "a_"
      
      Fetched 0 row(s) in 0.01s
      [localhost:21000] > show tables like "a%";                                                                                                                                                                                                                                                 
      Query: show tables like "a%"
      
      Fetched 0 row(s) in 0.00s
      [localhost:21000] > show tables like "a.";                                                                                                                                                                                                                                                 
      Query: show tables like "a."
      
      Fetched 0 row(s) in 0.00s
      [localhost:21000] > show tables like "a*";
      Query: show tables like "a*"
      +------+
      | name |
      +------+
      | a    |
      | aa   |
      | aaa  |
      +------+
      Fetched 3 row(s) in 0.01s
      

      In Hive:

      hive> show tables;
      OK
      a
      aa
      aaa
      Time taken: 0.013 seconds, Fetched: 3 row(s)
      hive> show tables like "a";
      OK
      a
      Time taken: 0.012 seconds, Fetched: 1 row(s)
      hive> show tables like "a_";
      OK
      aa
      Time taken: 0.014 seconds, Fetched: 1 row(s)
      hive> show tables like "a%";
      OK
      a
      aa
      aaa
      Time taken: 0.014 seconds, Fetched: 3 row(s)
      hive> show tables like "a.";
      OK
      aa
      Time taken: 0.011 seconds, Fetched: 1 row(s)
      hive> show tables like "a*";
      OK
      a
      aa
      aaa
      Time taken: 0.015 seconds, Fetched: 3 row(s)
      

      The problem seems to be http://github.mtv.cloudera.com/CDH/Impala/blob/cdh5-trunk/fe/src/main/java/com/cloudera/impala/util/PatternMatcher.java

      It is very confusing to have two pattern matcher.. we use Hive pattern matcher in this case, but it escapes ".", which is a bit surprising.

      Solution is to only use JdbcPatternMatcher, but this may break our API.

      Attachments

        Activity

          People

            Unassigned Unassigned
            HuaisiXu Huaisi Xu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: