forked from D-Net/dnet-hadoop
Catch Spark-sql errors and show a log with the statement that failed.
This commit is contained in:
parent
888637773c
commit
a644a6f4fe
|
@ -65,7 +65,13 @@ public class RunSQLSparkJob {
|
||||||
for (String statement : sql.split(";\\s*/\\*\\s*EOS\\s*\\*/\\s*")) {
|
for (String statement : sql.split(";\\s*/\\*\\s*EOS\\s*\\*/\\s*")) {
|
||||||
log.info("executing: {}", statement);
|
log.info("executing: {}", statement);
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
|
try {
|
||||||
spark.sql(statement).show();
|
spark.sql(statement).show();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Error executing statement: {}", statement, e);
|
||||||
|
System.err.println("Error executing statement: " + statement + "\n" + e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
log
|
log
|
||||||
.info(
|
.info(
|
||||||
"executed in {}",
|
"executed in {}",
|
||||||
|
|
Loading…
Reference in New Issue