Created 07-06-2020 09:55 PM
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.
Created 07-06-2020 10:41 PM
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.
Created 07-07-2020 08:11 PM
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
Created 07-08-2020 10:05 AM
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.