@@ -440,6 +440,17 @@ private[hive] class HiveMetastoreCatalog(hive: HiveContext) extends Catalog with
440440 val attributedRewrites = relation.output.zip(parquetRelation.output)
441441 (relation, parquetRelation, attributedRewrites)
442442
443+ // Write path
444+ case InsertIntoHiveTable (relation : MetastoreRelation , _, _, _)
445+ // Inserting into partitioned table is not supported in Parquet data source (yet).
446+ if ! relation.hiveQlTable.isPartitioned &&
447+ hive.convertMetastoreParquet &&
448+ hive.conf.parquetUseDataSourceApi &&
449+ relation.tableDesc.getSerdeClassName.toLowerCase.contains(" parquet" ) =>
450+ val parquetRelation = convertToParquetRelation(relation)
451+ val attributedRewrites = relation.output.zip(parquetRelation.output)
452+ (relation, parquetRelation, attributedRewrites)
453+
443454 // Read path
444455 case p @ PhysicalOperation (_, _, relation : MetastoreRelation )
445456 if hive.convertMetastoreParquet &&
@@ -464,6 +475,16 @@ private[hive] class HiveMetastoreCatalog(hive: HiveContext) extends Catalog with
464475
465476 withAlias
466477 }
478+ case InsertIntoTable (r : MetastoreRelation , partition, child, overwrite)
479+ if relationMap.contains(r) => {
480+ val parquetRelation = relationMap(r)
481+ InsertIntoTable (parquetRelation, partition, child, overwrite)
482+ }
483+ case InsertIntoHiveTable (r : MetastoreRelation , partition, child, overwrite)
484+ if relationMap.contains(r) => {
485+ val parquetRelation = relationMap(r)
486+ InsertIntoTable (parquetRelation, partition, child, overwrite)
487+ }
467488 case other => other.transformExpressions {
468489 case a : Attribute if a.resolved => attributedRewrites.getOrElse(a, a)
469490 }
0 commit comments