Skip to content

Instantly share code, notes, and snippets.

@orendain
Last active April 26, 2017 22:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save orendain/660d1670d1006c70d733c2b76a053640 to your computer and use it in GitHub Desktop.
Save orendain/660d1670d1006c70d733c2b76a053640 to your computer and use it in GitHub Desktop.

Questions regarding Hive SQL synax

Q1

CREATE TABLE FIREWALL_LOGS(
  time STRING,
  ip STRING,
  country STRING,
  status INT
)
CLUSTERED BY (time) into 25 buckets
STORED AS ORC
FIELDS TERMINATED BY '|'
LOCATION '/tmp/server-logs'
TBLPROPERTIES("transactional"="true");

Results in:

java.lang.Exception: org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: ParseException line 9:0 missing EOF at 'FIELDS' near ')'

Q2

CREATE TABLE FIREWALL AS STORED AS ORC SELECT * FROM FIREWALL_LOGS;

Results in:

org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: ParseException line 1:25 cannot recognize input near 'STORED' 'AS' 'ORC' in select clause
@gdeleon5
Copy link

gdeleon5 commented Apr 26, 2017

CREATE TABLE FIREWALL STORED AS ORC SELECT * FROM FIREWALL_LOGS;

should work, but doesn't. Still get parser error:
Error while compiling statement: FAILED: ParseException line 1:36 missing EOF at 'SELECT' near 'ORC' (state=42000,code=40000)

NOTE: not supported for external tables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment