Copilot commented on code in PR #12884:
URL: https://github.com/apache/gluten/pull/12884#discussion_r3853983529
##########
gluten-paimon/src-paimon/main/scala/org/apache/gluten/execution/PaimonScanTransformer.scala:
##########
@@ -83,7 +84,13 @@ case class PaimonScanTransformer(
throw new GlutenNotSupportException("Only support PaimonScan.")
}
- override def getDataSchema: StructType = new StructType()
+ override def getDataSchema: StructType = scan match {
+ case paimonScan: PaimonScan =>
+ val partitionKeys = paimonScan.table.partitionKeys()
+ StructType(paimonScan.table.schema().filterNot(field =>
partitionKeys.contains(field.name)))
+ case _ =>
+ throw new GlutenNotSupportException("Only support PaimonScan.")
+ }
Review Comment:
getDataSchema builds a StructType from paimonScan.table.schema(), but Paimon
Table#schema() is a Paimon TableSchema (not a Spark StructType). As written,
this is very likely to not compile or to produce an incorrect schema. It should
derive the data schema from Spark’s readSchema (which is already a StructType)
and then drop partition columns.
--
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]