Support Questions
Find answers, ask questions, and share your expertise

UDF: Works on SQL QUERY but fails on CREATE WITH SELECT SAME QUERY

Highlighted

UDF: Works on SQL QUERY but fails on CREATE WITH SELECT SAME QUERY

New Contributor
 
1 REPLY 1

Re: UDF: Works on SQL QUERY but fails on CREATE WITH SELECT SAME QUERY

New Contributor

Hi,

I am using HUE to make my SQLs and upload my jar.

DELETE JAR hdfs:///user/xxxxxxx.jar;
ADD JAR hdfs:///user/xxxxxxx.jar;

LIST JAR; -- OK here!

DROP FUNCTION IF EXISTS mydb.produto_associado;
CREATE FUNCTION mydb.produto_associado AS 'xxx.xxx.xx.ProdutoAssociado';


Then i try to create a table with an SLQ and it is failling:

DROP TABLE IF EXISTS mydb.contrato_produto_associado;
CREATE TABLE IF NOT mydb.contrato_produto_associado AS
SELECT 
    compras.ch_contrato as ch_contrato,
    produto_associado(compras.ds,"/produtos_real.csv") as produto_associado
FROM mydb.compras compras;

But only the sql works!

SELECT 
    compras.ch_contrato as ch_contrato,
    produto_associado(compras.ds,"/produtos_real.csv") as produto_associado
FROM mydb.compras compras;

Hive shows me this simple error...

Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.tez.TezTask

But the adm send de log from hadoop:

2018-02-27 10:15:14,062 ERROR [Thread-76098]: exec.Task (TezTask.java:execute(220)) - Failed to execute tez graph.
java.io.IOException: Previous writer likely failed to write hdfs://xxxxx/opt/appfiles/pro_10492_/disk_1/hive/scratchdir/yyyyyyy/_tez_session_dir/06e25f0c-7aa5-47da-8c52-4ab27ce59bfc/xxxxxxx.jar. Failing because I am unlikely to write too.
	at org.apache.hadoop.hive.ql.exec.tez.DagUtils.localizeResource(DagUtils.java:985)
	at org.apache.hadoop.hive.ql.exec.tez.DagUtils.addTempResources(DagUtils.java:865)
	at org.apache.hadoop.hive.ql.exec.tez.DagUtils.localizeTempFilesFromConf(DagUtils.java:808)
	at org.apache.hadoop.hive.ql.exec.tez.TezSessionState.refreshLocalResourcesFromConf(TezSessionState.java:258)
	at org.apache.hadoop.hive.ql.exec.tez.TezTask.updateSession(TezTask.java:290)
	at org.apache.hadoop.hive.ql.exec.tez.TezTask.execute(TezTask.java:159)
	at org.apache.hadoop.hive.ql.exec.Task.executeTask(Task.java:160)
	at org.apache.hadoop.hive.ql.exec.TaskRunner.runSequential(TaskRunner.java:89)
	at org.apache.hadoop.hive.ql.exec.TaskRunner.run(TaskRunner.java:75)

Any ideas???