While the documentation specifies how one can substitute a variable, it does not seam to support lists.
I have a query that needs to run for each day of a month, so I want to do something like this:
for day in days:
ALTER TABLE foo ADD PARTITION(${day=hiveconf:day});
Is there a way to do this without! using some kind of scripting language like python/bash.
I have a python implementation, but it need to start a new hive process for each query. Besides being ugly, this has bad performance for small queries because of the hive start-up-time.
There’s not really a great way to do this, and I’m pretty certain there’s no way at all to do it without a secondary scripting language. But it’s not too painful in something like bash:
Same strategy could be used in python: have the script generate all of the commands you want to execute, writing them to the same file. Then just execute that file.