Support Questions
Find answers, ask questions, and share your expertise

Tutorial Exercise 2 - Analysis Exception Syntax error

New Contributor

In Tutorial Exercise 2, when I run the following code I get an error 'AnalysisException : Syntax Error on line 3' and it seems to complain about the Date field 

 

 

 

CREATE EXTERNAL TABLE intermediate_access_logs (
    ip STRING,
    date STRING,   --> ERROR IS HERE
    method STRING,
    url STRING,
    http_version STRING,
    code1 STRING,
    code2 STRING,
    dash STRING,
    user_agent STRING)
ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.RegexSerDe'
WITH SERDEPROPERTIES (
    'input.regex' = '([^ ]*) - - \\[([^\\]]*)\\] "([^\ ]*) ([^\ ]*) ([^\ ]*)" (\\d*) (\\d*) "([^"]*)" "([^"]*)"',
    'output.format.string' = "%1$$s %2$$s %3$$s %4$$s %5$$s %6$$s %7$$s %8$$s %9$$s")
LOCATION '/user/hive/warehouse/original_access_logs';

 

Statestored, catalogd and impalad are all running. It's cloudera-quickstart-5-5-0-0 running on VirtualBox 5.018

 

Regs

Johnnie

 

 

2 REPLIES 2

Master Collaborator
Are you running that query in the Impala Query Editor? That port is meant
to be done in the Hive Query Editor. The table uses Hive's Java serde's to
do the ETL from raw logs to a format usable by Impala.

New Contributor

Dear Jack

in any language, there are some reserved keywords

rename the column , make it date1, hiredate, but not date