Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,12 @@ class ToLogicalPlan(spark: SparkSession) extends DefaultRelVisitor[LogicalPlan]
throw new UnsupportedOperationException("ConsistentField not currently supported")
}

val output = projections.head
// An output column is nullable if any of the projections can assign null to it
val types = projections.transpose.map(p => (p.head.dataType, p.exists(_.nullable)))

val output = types
.zip(names)
.map { case (t, name) => StructField(name, t.dataType, t.nullable) }
.map { case (t, name) => StructField(name, t._1, t._2) }
.map(f => AttributeReference(f.name, f.dataType, f.nullable, f.metadata)())

Expand(projections, output, child)
Expand Down
2 changes: 1 addition & 1 deletion spark/src/test/scala/io/substrait/spark/TPCDSPlan.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class TPCDSPlan extends TPCDSBase with SubstraitPlanTestBase {

// spotless:off
val successfulSQL: Set[String] = Set("q1", "q3", "q4", "q7",
"q11", "q13", "q14b", "q15", "q16", "q18", "q19",
"q11", "q13", "q14a", "q14b", "q15", "q16", "q18", "q19",
"q21", "q22", "q23a", "q23b", "q24a", "q24b", "q25", "q26", "q28", "q29",
"q30", "q31", "q32", "q33", "q37", "q38",
"q40", "q41", "q42", "q43", "q46", "q48",
Expand Down