Skip to content

Commit

Permalink
prunePartitionsByFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
yaooqinn committed Dec 22, 2020
1 parent b46659b commit 6e3e39b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import org.apache.spark.sql.AnalysisException
import org.apache.spark.sql.catalyst.analysis.Resolver
import org.apache.spark.sql.catalyst.catalog.CatalogTypes.TablePartitionSpec
import org.apache.spark.sql.catalyst.expressions.{And, AttributeReference, BoundReference, Expression, Predicate}
import org.apache.spark.sql.catalyst.util.CharVarcharUtils

object ExternalCatalogUtils {
// This duplicates default value of Hive `ConfVars.DEFAULTPARTITIONNAME`, since catalyst doesn't
Expand Down Expand Up @@ -135,7 +136,8 @@ object ExternalCatalogUtils {
if (predicates.isEmpty) {
inputPartitions
} else {
val partitionSchema = catalogTable.partitionSchema
val partitionSchema = CharVarcharUtils.replaceCharVarcharWithStringInSchema(
catalogTable.partitionSchema)
val partitionColumnNames = catalogTable.partitionColumnNames.toSet

val nonPartitionPruningPredicates = predicates.filterNot {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,7 @@ case class CatalogTablePartition(
} else {
spec(field.name)
}
val dt = CharVarcharUtils.replaceCharVarcharWithString(field.dataType)
Cast(Literal(partValue), dt, Option(timeZoneId)).eval()
Cast(Literal(partValue), field.dataType, Option(timeZoneId)).eval()
})
}
}
Expand Down

0 comments on commit 6e3e39b

Please sign in to comment.