Vova Vysotskyi created DRILL-7643:
-------------------------------------

             Summary: Fix issues with using columns with the same name as 
reserved keyword
                 Key: DRILL-7643
                 URL: https://issues.apache.org/jira/browse/DRILL-7643
             Project: Apache Drill
          Issue Type: Bug
    Affects Versions: 1.17.0, 1.16.0
            Reporter: Vova Vysotskyi
            Assignee: Vova Vysotskyi
             Fix For: 1.18.0


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:
{code:sql}
create table dfs.tmp.t11 as (select 1 as `date`, 2 as c);
{code}
2. Run REFRESH METADATA command with specifying that interesting column:
{code:sql}
refresh table metadata columns (`date`) dfs.tmp.t11;
{code}

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

Stack trace from logs:
{noformat}
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)
{noformat}




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to