Support Questions

Find answers, ask questions, and share your expertise

Error while compiling statement: FAILED: ParseException line 1:18 mismatched input '/' expecting StringLiteral near 'inpath' in load statement

avatar
New Contributor

I am trying to load a file from local to HDFS using HIVE.

I create the table "accidents" and the file is in my desktop: proyectobigdata/AccidentesBicicletas_2018.csv’ 

I used this command load data inpath '/users/melissavallejos/desktop/proyectobigdata/AccidentesBicicletas_2018.csv’ into table accidents but it got this error:  Error while compiling statement: FAILED: ParseException line 1:18 mismatched input '/' expecting StringLiteral near 'inpath' in load statement

 

I am really new in this platform and I am working with MAC.

 

I appreciate any advise.

 

3 REPLIES 3

avatar
Master Collaborator

Look at the quote character at the start and end of this string. 

'/users/melissavallejos/desktop/proyectobigdata/AccidentesBicicletas_2018.csv’

They are not the same. Replace the last character with single quote (') and the command should be parsed just fine.

avatar
New Contributor

Thank you! I did the change and now I got this error:

 

Error while compiling statement: FAILED: SemanticException Line 1:17 Invalid path ''/users/melissavallejos/desktop/proyectobigdata/AccidentesBicicletas_2018.csv'': No files matching path hdfs://quickstart.cloudera:8020/users/melissavallejos/desktop/proyectobigdata/AccidentesBicicletas_2018.csv

avatar
Master Collaborator

Glad you are making progress. The command you are looking for is actually 

LOAD DATA LOCAL INPATH ...

Note that you missed LOCAL keyword. Without the LOCAL keyword, hive will look for a table in hdfs, which is why you see the error "No files matching path hdfs://quickstart.cloudera:8020/users/melissava...". It's because hive is trying to look in the hdfs, instead of you local machine.