Coming from Teradata, I would usually create a volatile table with some variables that I would use throughout my code.
E.g.,
create volatile table var as (
select 'filter_value' as var_field
) with data on commit preserve rows;
Then I would use that table in a SELECT WHERE clause:
select * from table
where some_field = (select var_field from var);
I am trying to do something similar in HUE (Impala editor) however getting an error:
create table var as
select 'filter_value' as var_field
select * from table
where some_field = (select var_field from var)
AnalysisException: Syntax error in line 5:undefined: from table-name-hidden ^ Encountered: FROM Expected: CASE, CAST, DEFAULT, EXISTS, FALSE, IF, INTERVAL, NOT, NULL, REPLACE, TRUNCATE, TRUE, IDENTIFIER CAUSED BY: Exception: Syntax error
Does anyone know how to do this or replicate this feature in Hue?
It's convenient not having to define my variables throughout the whole code and keep them all at the top in one table.