Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-7643

Fix issues with using columns with the same name as reserved keyword

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.16.0, 1.17.0
    • Fix Version/s: 1.18.0
    • Component/s: None
    • Labels:

      Description

      Parquet refresh metadata fails when an interesting column name is the same as the reserved keyword.

      Steps to reproduce:
      1. Create a parquet table with column name date:

      create table dfs.tmp.t11 as (select 1 as `date`, 2 as c);
      

      2. Run REFRESH METADATA command with specifying that interesting column:

      refresh table metadata columns (`date`) dfs.tmp.t11;
      

      This query returns the following result:

      +-------+----------------------------------------------------------------------------------+
      |  ok   |                                     summary                                      |
      +-------+----------------------------------------------------------------------------------+
      | false | Error: mismatched input 'date' expecting {'if', 'case', 'cast', Convert, AnyValue, '!', '+', '-', '(', ''', Bool, Number, Identifier, QuotedIdentifier, String} |
      +-------+----------------------------------------------------------------------------------+
      

      Stack trace from logs:

      2020-03-16 19:38:45,539 [2190465a-567b-575b-5b05-d747908789e7:foreman] ERROR o.a.d.e.p.s.h.RefreshMetadataHandler - Failed to update metadata for table 't11'
      org.apache.drill.common.exceptions.ExpressionParsingException: mismatched input 'date' expecting {'if', 'case', 'cast', Convert, AnyValue, '!', '+', '-', '(', ''', Bool, Number, Identifier, QuotedIdentifier, String}
      	at org.apache.drill.common.parser.ErrorListener.syntaxError(ErrorListener.java:35)
      	at org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:41)
      	at org.antlr.v4.runtime.Parser.notifyErrorListeners(Parser.java:544)
      	at org.antlr.v4.runtime.DefaultErrorStrategy.reportInputMismatch(DefaultErrorStrategy.java:327)
      	at org.antlr.v4.runtime.DefaultErrorStrategy.reportError(DefaultErrorStrategy.java:139)
      	at org.apache.drill.common.expression.parser.ExprParser.expression(ExprParser.java:1704)
      	at org.apache.drill.common.expression.parser.ExprParser.parse(ExprParser.java:202)
      	at org.apache.drill.common.parser.LogicalExpressionParser.parse(LogicalExpressionParser.java:51)
      	at org.apache.drill.common.expression.SchemaPath.parseFromString(SchemaPath.java:202)
      	at org.apache.drill.exec.planner.sql.handlers.RefreshMetadataHandler.getColumnRootSegments(RefreshMetadataHandler.java:151)
      	at org.apache.drill.exec.planner.sql.handlers.RefreshMetadataHandler.getPlan(RefreshMetadataHandler.java:81)
      	at org.apache.drill.exec.planner.sql.DrillSqlWorker.getQueryPlan(DrillSqlWorker.java:283)
      	at org.apache.drill.exec.planner.sql.DrillSqlWorker.getPhysicalPlan(DrillSqlWorker.java:163)
      	at org.apache.drill.exec.planner.sql.DrillSqlWorker.convertPlan(DrillSqlWorker.java:128)
      	at org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan(DrillSqlWorker.java:93)
      	at org.apache.drill.exec.work.foreman.Foreman.runSQL(Foreman.java:590)
      	at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:275)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                volodymyr Vova Vysotskyi
                Reporter:
                volodymyr Vova Vysotskyi
                Reviewer:
                Arina Ielchiieva
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: