Quanlong Huang created IMPALA-11696:
---------------------------------------

             Summary: Incorrect warnings when creating text/sequence table with 
row format delimiters
                 Key: IMPALA-11696
                 URL: https://issues.apache.org/jira/browse/IMPALA-11696
             Project: IMPALA
          Issue Type: Bug
          Components: Frontend
            Reporter: Quanlong Huang
            Assignee: Quanlong Huang


IMPALA-9822 adds a warning when the customized row format delimiters in the 
CreateTable statement is ignored. However, we see the same warning when 
creating TEXT or SEQUENCE_FILE tables.
{code:sql}
[localhost:21050] default> create external table my_csv (a int, b string) ROW 
FORMAT DELIMITED FIELDS TERMINATED BY ',' stored as textfile;
Query: create external table my_csv (a int, b string) ROW FORMAT DELIMITED 
FIELDS TERMINATED BY ',' stored as textfile
+-------------------------+
| summary                 |
+-------------------------+
| Table has been created. |
+-------------------------+
WARNINGS: 'ROW FORMAT DELIMITED FIELDS TERMINATED BY ','' is ignored.
Fetched 1 row(s) in 0.11s {code}

The following code is buggy:
{code:java}
    if (getRowFormat() != null) {
      String fieldDelimiter = getRowFormat().getFieldDelimiter();
      String lineDelimiter = getRowFormat().getLineDelimiter();
      String escapeChar = getRowFormat().getEscapeChar();
      if (getFileFormat() != THdfsFileFormat.TEXT
          || getFileFormat() != THdfsFileFormat.SEQUENCE_FILE) {  // Should use 
&& instead
        if (fieldDelimiter != null) {
          analyzer.addWarning("'ROW FORMAT DELIMITED FIELDS TERMINATED BY '"
              + fieldDelimiter + "'' is ignored.");
        }
        if (lineDelimiter != null) {
          analyzer.addWarning("'ROW FORMAT DELIMITED LINES TERMINATED BY '"
              + lineDelimiter + "'' is ignored.");
        }
        if (escapeChar != null) {
          analyzer.addWarning(
              "'ROW FORMAT DELIMITED ESCAPED BY '" + escapeChar + "'' is 
ignored.");
        }
      }
    }
{code}
https://github.com/apache/impala/blob/8271bdd587d241cd5a61ccae7422bbb5fafcfaf7/fe/src/main/java/org/apache/impala/analysis/CreateTableStmt.java#L276



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to