0

I am trying to load table from HDFS file using beeline. I have written shell script for it which takes StagingSchema.hql file as input and loads table.

load data  inpath ${hivevar:dataLocation} into table ${hivevar:sourceTable};

Inside Shell script

HIVE_DATA_LOCATION="hdfs:///app/data/empRecord.csv"

beeline -u $BEELINE_JDBC_URL -n $BEELINE_USERNAME -p $BEELINE_PASSWORD --hivevar sourceTable=$SOURCE_TABLE --hivevar dataLocation=$HIVE_DATA_LOCATION --silent=true -f StagingSchema.hql

While running above script , i am getting below exception

    WARNING: Use "yarn jar" to launch YARN applications.

Error: Error while compiling statement: FAILED: ParseException line 1:23 mismatched input 'hdfs' expecting StringLiteral near 'inpath' in load statement (state=42000,code=40000)

Any pointers on this?

Shashi
  • 2,686
  • 7
  • 35
  • 67
  • 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

0

Can you try covering inpath within single quotes in the load statement,

load data inpath '${hivevar:dataLocation}' into table ${hivevar:sourceTable};

Despicable me
  • 548
  • 1
  • 9
  • 24