Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
cloud-fan committed Nov 23, 2020
1 parent e538a1a commit d93e832
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package org.apache.spark.sql.execution.datasources.v2
import scala.collection.mutable

import org.apache.spark.sql.catalyst.expressions.{AttributeReference, AttributeSet, Expression, NamedExpression, PredicateHelper, SchemaPruning}
import org.apache.spark.sql.catalyst.util.CharVarcharUtils
import org.apache.spark.sql.connector.read.{Scan, ScanBuilder, SupportsPushDownFilters, SupportsPushDownRequiredColumns}
import org.apache.spark.sql.execution.datasources.DataSourceStrategy
import org.apache.spark.sql.internal.SQLConf
Expand Down Expand Up @@ -110,7 +111,8 @@ object PushDownUtils extends PredicateHelper {
schema: StructType,
relation: DataSourceV2Relation): Seq[AttributeReference] = {
val nameToAttr = relation.output.map(_.name).zip(relation.output).toMap
schema.toAttributes.map {
val cleaned = CharVarcharUtils.replaceCharVarcharWithString(schema).asInstanceOf[StructType]
cleaned.toAttributes.map {
// we have to keep the attribute id during transformation
a => a.withExprId(nameToAttr(a.name).exprId)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import org.apache.spark.sql.execution.datasources.CreateTable
import org.apache.spark.sql.execution.datasources.v2.DataSourceV2Relation
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.sources.SimpleScanSource
import org.apache.spark.sql.types.{CharType, DoubleType, IntegerType, LongType, MetadataBuilder, StringType, StructField, StructType}
import org.apache.spark.sql.types.{CharType, DoubleType, IntegerType, LongType, StringType, StructField, StructType}

class PlanResolutionSuite extends AnalysisTest {
import CatalystSqlParser._
Expand Down

0 comments on commit d93e832

Please sign in to comment.