philo-he commented on code in PR #13667:
URL: https://github.com/apache/gluten/pull/13667#discussion_r4691798735
##########
backends-velox/src/test/scala/org/apache/gluten/execution/VeloxScanSuite.scala:
##########
@@ -55,6 +57,64 @@ class VeloxScanSuite extends VeloxWholeStageTransformerSuite
{
checkGlutenPlan[T](df)
}
+ Seq(true, false).foreach {
+ useV1 =>
+ test(s"existence-default scan fallback and native controls
(useV1=$useV1)") {
+ withSQLConf(
+ SQLConf.USE_V1_SOURCE_LIST.key -> (if (useV1) "parquet" else ""),
+ GlutenConfig.NATIVE_WRITER_ENABLED.key -> "false") {
Review Comment:
Nit: is `NATIVE_WRITER_ENABLED=false` needed here? This test writes the file
with `spark.range(1).write.parquet(...)`, which only stores the `id` column.
The defaulted columns come from the read schema, not from the written data, so
the file would be equivalent whether Gluten's native writer or Spark's writer
produces it.
If it is really needed, please add a short comment for it.
##########
gluten-substrait/src/main/scala/org/apache/gluten/execution/BasicScanExecTransformer.scala:
##########
@@ -123,6 +124,20 @@ trait BasicScanExecTransformer extends
LeafTransformSupport with BaseDataSource
def getInputStats: Option[InputStats] = Option.empty
+ protected def validateExistenceDefaults(readSchema: StructType):
ValidationResult = {
+ val columns = readSchema.fields
+ .zip(ResolveDefaultColumns.getExistenceDefaultValues(readSchema))
+ .collect { case (field, value) if value != null => field.name }
+ if (columns.nonEmpty) {
Review Comment:
One trade-off worth handling: `EXISTS_DEFAULT` stays on a column permanently
after `ALTER TABLE ... ADD COLUMN ... DEFAULT`, so every scan that reads that
column will fall back to Spark from now on, even after all files have been
rewritten and contain the column. Users who run these scans natively today, and
only need correct values for rows written after the column was added, would see
a large performance change.
Could we add a config (enabled by default) to turn this check off, and
document the fallback beyond `VeloxDelta.md`, since it also applies to plain
Parquet/ORC tables?
--
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]