Member since
11-20-2019
1
Post
0
Kudos Received
0
Solutions
11-20-2019
08:48 AM
To clarify for others, I believe the reason the following doesn't work is that it was executed in a bash shell, i.e. using a typical terminal. hive --hivevar rdate=112211 -e "select 9${hivevar:rdate}9" In double quoted strings, the '$' tells bash to treat "{hivevar:rdate}" as a variable but it isn't defined so it returns an empty string before being passed in to hive due to the -e flag. i.e. "9${hivevar:rdate}9" is evaulated to "99" even before passing it into hive. In contrast within single quotes there is no substitution in bash, so '9${hivevar:rdate}9' is passed into hive as is, so the following executes as the poster expected. hive --hivevar rdate=112211 -e 'select 9${hivevar:rdate}9'
... View more