I have a Hive SQL -
select regexp_extract(`unenriched`.`input__file__name`,'[^/]*$',0) `SRC_FILE_NM from dl.table1;
This query fails running with Spark -
INPUT__FILE__NAME is a Hive specific virtual column and it is not supported in Spark.
Solution-
Spark provides input_file_name function which should work in a similar way:
SELECT input_file_name() FROM df
but it requires Spark 2.0 or later to work correctly with Spark.
select regexp_extract(`unenriched`.`input__file__name`,'[^/]*$',0) `SRC_FILE_NM from dl.table1;
This query fails running with Spark -
spark.sql.utils.AnalysisException: u"cannot resolve 'INPUT__FILE__NAME' given input columns:
Anaylsis-INPUT__FILE__NAME is a Hive specific virtual column and it is not supported in Spark.
Solution-
Spark provides input_file_name function which should work in a similar way:
SELECT input_file_name() FROM df
but it requires Spark 2.0 or later to work correctly with Spark.
Comments
Post a Comment