Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

livy sql interpreter can not find source file

avatar
Guru

I'm trying to run a SQL query using livy interpreter as below.

%livy.sql
LOAD DATA LOCAL INPATH '/tmp/abc.csv' INTO TABLE abc

it gives this error

org.apache.spark.sql.execution.QueryExecutionException: FAILED: SemanticException Line 1:23 Invalid path ''/tmp/abc.csv'': No files matching path file:/tmp/abc.csv

But when I run the same thing with %sql as below, it works fine.

%sql
LOAD DATA LOCAL INPATH '/tmp/abc.csv' INTO TABLE abc

Any pointers on this behavior ?

1 ACCEPTED SOLUTION

avatar

@yvora Its because %livy.sql interpreter runs in the yarn-cluster mode whereas %sql interpreter runs in the yarn-client mode. Hence %sql can find the local file on the client-machine whereas %livy.sql wont be able to find.

Try putting file in HDFS and use LOAD DATA INPATH rather than LOAD DATA LOCAL INPATH. It should work

View solution in original post

1 REPLY 1

avatar

@yvora Its because %livy.sql interpreter runs in the yarn-cluster mode whereas %sql interpreter runs in the yarn-client mode. Hence %sql can find the local file on the client-machine whereas %livy.sql wont be able to find.

Try putting file in HDFS and use LOAD DATA INPATH rather than LOAD DATA LOCAL INPATH. It should work