'beeline fails when hive table doesn't exists
I have test.hql file with bulk drop partition commands. as follows
ALTER TABLE <db>.<table> DROP IF EXISTS PARTITION(fi=1) PURGE;ALTER TABLE <db>.<table> DROP IF EXISTS PARTITION(fi=2) PURGE;........ so on.
I execute beeline command from java.lang.ProcessBuilder as follows
public static void main(String[] args) {
String[] commandToExecute = {"beeline", "--force=true", "-u", "url/" + "database"+ ";ssl=true" + ";" + "user=" + user + ";" + "password=" + pw, "-f", "test.hql" };
ProcessBuilder builder = new ProcessBuilder(commandToExecute);
builder.redirectError(new File("fileName"));
builder.redirectOutput(new File("fileName"));
try {
builder.start();
} catch (IOException e) {
e.printStackTrace();
}
}
Issue I am facing is if hive table doesnt exist then entire beeline command fails from that particular line. how can I skip/log the error and proceed to rest of the commands?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
