2

I cannot figure out why HIVE is throwing me an error in the following script:

use <output_db>

drop table if exists <new_tbl>; 
create table <new_tbl> like <old_tbl>;

load data local inpath <directory> into table <new_tbl>;​

The exception is:

FAILED: ParseException line 4:23 mismatched input '<directory>' expecting StringLiteral near 'inpath' in load statement

Sorry if this is an elementary question. But I've copied it from similar hql statements that work and I can't find a satisfactory answer.

makansij
  • 9,303
  • 37
  • 105
  • 183
  • did you actually put the name of the path in the quotes? like ''? – madbitloman Nov 24 '15 at 22:46
  • no I did not do that – makansij Nov 24 '15 at 23:30
  • well, that is the answer for your question. It is actually in one of the examples here https://cwiki.apache.org/confluence/display/Hive/GettingStarted – madbitloman Nov 25 '15 at 06:07
  • 1
    I also gone through this where in Load statement some special character was there coz I copied from somewhere so wrote manually in Hive Shell this load statement.. And it worked.. – Nilesh Shinde Nov 23 '16 at 08:31
  • Possible duplicate of [hive command in bash script won't load file into table](https://stackoverflow.com/questions/26663858/hive-command-in-bash-script-wont-load-file-into-table) – sdikby Aug 04 '17 at 17:30

1 Answers1

2

Seems like this : load data local inpath directory into table

should be : load data local inpath 'directory' into table

Enclosed within single quotes.

Hope it helps...!!!

Mukesh S
  • 2,856
  • 17
  • 23