My Oracle Support Banner

Improper Functioning of ODI 12c Spark To Hive KMs is Observed if the Target Hive Table is Partitioned (Doc ID 2367622.1)

Last updated on JUNE 16, 2022

Applies to:

Oracle Data Integrator - Version and later
Information in this document applies to any platform.


The Oracle Data Integrator (ODI) 12c Spark To Hive Knowledge Modules will fail with following error if the target Hive table is partitioned:

Cannot convert the AST object to a task: Load FILTER_AP
Caused by: oracle.odi.domain.adapter.relational.IColumn.isUsedForPartitioning()Z
  at oracle.odi.mapping.generation.spark.SparkHiveStoreCmd.getPartitionColumns(

The generated code from the Knowledge Module does not contain a partition clause. Analyzing the execution in simulation mode, it is possible to verify in the following section that the hive partitioned tables are not recognized:

Note: This is a sample code to demonstrate the issue and may vary according to each ODI project. 

# [oracle.odi.mapping.generation.spark.SparkHiveStoreCmd for table_tgt]
FLT = FLT : {'some_id' : FLT.some_id,'realm_code' :
(sqlTypeName, inferSchemaMethod) = ('DataFrame', 'createDataFrame') if
sparkVersion >= 130 else ('SchemaRDD', 'inferSchema')
if sqlTypeName not in type(FLT).__name__ :
FLT = row : Row(**row) if isinstance(row,dict) else row)
if FLT.take(1).__len__() > 0 :
FLT = getattr(hiveCtx, inferSchemaMethod)(FLT)
if sqlTypeName in type(FLT).__name__:
if sparkVersion > 141:
FLT.saveAsTable('m_name.table_tgt', mode='overwrite')
hiveCtx.sql('CREATE TABLE IF NOT EXISTS m_name.table_tgt ( some_id
BIGINT , realm_code STRING , dt STRING )')
hiveCtx.sql('INSERT OVERWRITE TABLE m_name.table_tgt \
SELECT some_id , realm_code , dt FROM HIVE_TMP_176')


To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.