HyukjinKwon commented on a change in pull request #33170:
URL: https://github.com/apache/spark/pull/33170#discussion_r662870040
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/LogicalRelation.scala
##########
@@ -81,6 +81,14 @@ object LogicalRelation {
// The v1 source may return schema containing char/varchar type. We
replace char/varchar
// with "annotated" string type here as the query engine doesn't support
char/varchar yet.
val schema =
CharVarcharUtils.replaceCharVarcharWithStringInSchema(relation.schema)
- LogicalRelation(relation, schema.toAttributes, Some(table), false)
+ val attributes = schema.toAttributes
+ val output = table.stats.map(_.colStats) match {
+ case Some(colStats) =>
+ attributes
+ .map(a =>
a.withNullability(colStats.get(a.name).forall(_.nullCount.forall(_ > 0L))))
Review comment:
Hmmm .. does this mean that if a table is saved with nullable schema but
the table doesn't have nulls, here the schema becomes non-nullable when we read
it back?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]