You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Zheng Shao (JIRA)" <ji...@apache.org> on 2018/08/09 23:06:00 UTC
[jira] [Created] (HIVE-20358) Allow setting variable value from
Hive metastore table properties
Zheng Shao created HIVE-20358:
---------------------------------
Summary: Allow setting variable value from Hive metastore table properties
Key: HIVE-20358
URL: https://issues.apache.org/jira/browse/HIVE-20358
Project: Hive
Issue Type: New Feature
Components: Query Processor
Reporter: Zheng Shao
Hive already supports set command as well as variable substitution:
{{set start_ds=2018-08-01;}}
{{SELECT COUNT(*) FROM t WHERE ds >= '${hiveconf:start_ds}';}}
Or:
{{set start_ds='2018-08-01';}}
{{SELECT COUNT(*) FROM t WHERE ds >= ${hiveconf:start_ds};}}
This issue propose to extend the set syntax to allow running UDF and a UDF that queries metastore:
{{SET <VARIABLE_NAME> <EXPRESSION>;}}
For example:
{{set start_ds GET_TABLE_PROPERTY('mydb', 'mytable', 'last_modified_time');}}
{{set start_ds GET_PARTITION_PROPERTY('mydb', 'mytable', 'ds=2018-01-01/hr=12', 'last_modified_time');}}
This will allow query workflows like the following:
{{set last_run_time GET_TABLE_PROPERTY('mydb', 'mytable', 'last_modified_time');}}
{{INSERT INTO TABLE mytable SELECT * FROM src WHERE src.time > last_run_time;}}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)