Skip to content

Commit

Permalink
fix failing tests for variantagg
Browse files Browse the repository at this point in the history
  • Loading branch information
stefankandic committed Jan 23, 2025
1 parent 9957e45 commit 30b05b3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,11 @@ object ResolveDefaultStringTypes extends Rule[LogicalPlan] {
case expression if needsCast(expression) =>
expression.setTagValue(CAST_ADDED_TAG, ())
newType => {
if (expression.dataType.sameType(newType)) {
val replacedType = replaceDefaultStringType(expression.dataType, newType)
if (newType == StringType || replacedType.sameType(newType)) {
expression
} else {
Cast(expression, replaceDefaultStringType(expression.dataType, newType))
Cast(expression, replacedType)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -858,12 +858,13 @@ case class SchemaOfVariantAgg(
extends TypedImperativeAggregate[DataType]
with ExpectsInputTypes
with QueryErrorsBase
with DefaultStringProducingExpression
with UnaryLike[Expression] {
def this(child: Expression) = this(child, 0, 0)

override def inputTypes: Seq[AbstractDataType] = Seq(VariantType)

override def dataType: DataType = SQLConf.get.defaultStringType

override def nullable: Boolean = false

override def createAggregationBuffer(): DataType = NullType
Expand Down

0 comments on commit 30b05b3

Please sign in to comment.