Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Impala - how to set a variable in a query?

How can I set a variable in an Impala query?

In SQL:

select * from users where id=(@id:=123)

In Impala:

impala-shell> ?

Impala version is v2.0.0. Any suggestions will be appreciated. Thanks!

like image 481
sellarafaeli Avatar asked Oct 15 '25 08:10

sellarafaeli


1 Answers

impala-shell> set var:id=123;select * from users where id=${VAR:id};

 

This variable can also be passed from command-line using --var

impala-shell --var id=123
impala-shell> select * from users where id=${VAR:id};
like image 147
Yilei Avatar answered Oct 18 '25 02:10

Yilei



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!