John
John

Reputation: 23

impala query failed to execute `date` command in shell script

I have below imapala query run on shell script which is throwing error.

date with back quotes `date`

impala-shell -B -i $IMPALA_CON --ssl -q  "use db_test ; select concat(substring(`date`,3,2),substring(`date`,6,2),substring(`date`,9,2)) id from db_test.date_d where `date`<=cast(current_timestamp() as string)" -o $FILE/abc.txt '--output_delimiter=,'

ERROR: ParseException: Syntax error in line 1: select concat(substring(Tue Jan 17 02:18:20 EST 2023,3,2...

Upvotes: 0

Views: 119

Answers (1)

jbapple
jbapple

Reputation: 3390

date is a shell command, and the backquotes are doing command substitution. You're getting the date substituted in without quotes around it. Try '`date`' instead of just `date` (note the single quotes around the backquotes).

Upvotes: 1

Related Questions