File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
sql/core/src/main/scala/org/apache/spark/sql/execution Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 1717
1818package org .apache .spark .sql .execution
1919
20+ import java .util .Locale
21+
2022import org .apache .spark .sql .AnalysisException
2123import org .apache .spark .sql .catalyst .InternalRow
2224import org .apache .spark .sql .catalyst .catalog .{HiveTableRelation , SessionCatalog }
@@ -81,9 +83,9 @@ case class OptimizeMetadataOnlyQuery(catalog: SessionCatalog) extends Rule[Logic
8183 private def getPartitionAttrs (
8284 partitionColumnNames : Seq [String ],
8385 relation : LogicalPlan ): Seq [Attribute ] = {
84- val attrMap = relation.output.map(_.name).zip(relation.output).toMap
86+ val attrMap = relation.output.map(_.name.toLowerCase( Locale . ROOT ) ).zip(relation.output).toMap
8587 partitionColumnNames.map { colName =>
86- attrMap.getOrElse(colName,
88+ attrMap.getOrElse(colName.toLowerCase( Locale . ROOT ) ,
8789 throw new AnalysisException (s " Unable to find the column ` $colName` " +
8890 s " given [ ${relation.output.map(_.name).mkString(" , " )}] " )
8991 )
Original file line number Diff line number Diff line change @@ -67,6 +67,9 @@ case class HadoopFsRelation(
6767 }
6868 }
6969
70+ // When data schema and partition schema have the overlapped columns, the output
71+ // schema respects the order of data schema for the overlapped columns, but respect
72+ // the data types of partition schema
7073 val schema : StructType = {
7174 StructType (dataSchema.map(f => overlappedPartCols.getOrElse(getColName(f), f)) ++
7275 partitionSchema.filterNot(f => overlappedPartCols.contains(getColName(f))))
You can’t perform that action at this time.
0 commit comments