diff --git a/backends-velox/src/main/scala/io/glutenproject/backendsapi/velox/VeloxBackend.scala b/backends-velox/src/main/scala/io/glutenproject/backendsapi/velox/VeloxBackend.scala index beee871bc0ef2..906cc4db741d5 100644 --- a/backends-velox/src/main/scala/io/glutenproject/backendsapi/velox/VeloxBackend.scala +++ b/backends-velox/src/main/scala/io/glutenproject/backendsapi/velox/VeloxBackend.scala @@ -110,6 +110,8 @@ object BackendSettings extends BackendSettingsApi { } } + override def supportNativeMetadataColumns(): Boolean = true + override def supportExpandExec(): Boolean = true override def supportSortExec(): Boolean = true diff --git a/gluten-core/src/main/scala/io/glutenproject/backendsapi/BackendSettingsApi.scala b/gluten-core/src/main/scala/io/glutenproject/backendsapi/BackendSettingsApi.scala index fcd1bbfe84533..4654dd43daffb 100644 --- a/gluten-core/src/main/scala/io/glutenproject/backendsapi/BackendSettingsApi.scala +++ b/gluten-core/src/main/scala/io/glutenproject/backendsapi/BackendSettingsApi.scala @@ -34,6 +34,7 @@ trait BackendSettingsApi { fields: Array[StructField], partTable: Boolean, paths: Seq[String]): Boolean = false + def supportNativeMetadataColumns(): Boolean = false def supportExpandExec(): Boolean = false def supportSortExec(): Boolean = false def supportSortMergeJoinExec(): Boolean = true diff --git a/gluten-core/src/main/scala/io/glutenproject/execution/FileSourceScanExecTransformer.scala b/gluten-core/src/main/scala/io/glutenproject/execution/FileSourceScanExecTransformer.scala index 2a9bd9c176ae2..f7a42dfa2046a 100644 --- a/gluten-core/src/main/scala/io/glutenproject/execution/FileSourceScanExecTransformer.scala +++ b/gluten-core/src/main/scala/io/glutenproject/execution/FileSourceScanExecTransformer.scala @@ -116,6 +116,12 @@ class FileSourceScanExecTransformer( override def hashCode(): Int = super.hashCode() override protected def doValidateInternal(): ValidationResult = { + if ( + !metadataColumns.isEmpty && !BackendsApiManager.getSettings.supportNativeMetadataColumns() + ) { + return ValidationResult.notOk(s"Unsupported metadata columns scan in native.") + } + if (hasUnsupportedColumns) { return ValidationResult.notOk(s"Unsupported columns scan in native.") }