0

I recently have started to use Beelines CLI to interface with a hive server. The problem is that create file command is failing for me.

I have tried the following:

add FILE[S] 'example.txt';

Which returns this error:

Error: Error while processing statement: null (state=,code=1)
Matt
  • 113
  • 1
  • 1
  • 5
  • maybe you misunderstood what `ADD FILE` does? https://cwiki.apache.org/confluence/display/Hive/HiveServer2+Clients#HiveServer2Clients-BeelineHiveCommands – mazaneicha Feb 27 '20 at 23:20

1 Answers1

0

You should remove the quotes from the path. i.e.

beeline> add file example.txt;

Also be sure that you are only adding files to the server hive is running on.

Fraser
  • 15,275
  • 8
  • 53
  • 104
  • add file example.txt; returns: Error: Error while processing statement: example.txt does not exist (state=,code=1) I am simply running the command immediately after connecting to beeline. – Matt Feb 27 '20 at 16:09
  • Then you need to correctly add the path to a file that actually exists...are you trying to add a file remotely? Where is "example.txt" located? Maybe see: https://stackoverflow.com/questions/42496672/adding-local-files-in-beeline-hive – Fraser Feb 27 '20 at 16:16
  • The file does not exist, that's why I'm trying to create it. Path is just located wherever I currently am. – Matt Feb 27 '20 at 16:22
  • Then that is your problem - you are trying to "add" an existing file not "create" a new one on a remote host. Try: `hdfs fs -put /somepath/example.txt` then `add file hdfs:/somepath/example.txt`. You can only add locally accessible files. – Fraser Feb 28 '20 at 12:08