Copilot commented on code in PR #13204: URL: https://github.com/apache/gluten/pull/13204#discussion_r4190257727
########## backends-velox/src/test/scala/org/apache/gluten/execution/FileSourceScanOptionsSuite.scala: ########## @@ -0,0 +1,89 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.gluten.execution + +import org.apache.spark.network.util.JavaUtils +import org.apache.spark.sql.catalyst.expressions.AttributeReference +import org.apache.spark.sql.catalyst.util.CaseInsensitiveMap +import org.apache.spark.sql.execution.datasources.{HadoopFsRelation, InMemoryFileIndex} +import org.apache.spark.sql.execution.datasources.csv.CSVFileFormat +import org.apache.spark.sql.types.{StringType, StructField, StructType} + +import org.apache.hadoop.fs.Path + +import java.nio.file.Files + +class FileSourceScanOptionsSuite extends VeloxWholeStageTransformerSuite { + override protected val resourcePath: String = "" + override protected val fileFormat: String = "csv" + + private lazy val dir = Files.createTempDirectory("csv-options").toFile + + override def afterAll(): Unit = { + try JavaUtils.deleteRecursively(dir) + finally super.afterAll() + } + + private def scan(options: Map[String, String]): FileSourceScanExecTransformer = { + val schema = StructType(Seq(StructField("a", StringType, nullable = true))) + val relation = HadoopFsRelation( + new InMemoryFileIndex(spark, Seq(new Path(dir.toURI)), Map.empty, None), + StructType(Nil), + schema, + None, + new CSVFileFormat(), + CaseInsensitiveMap(options))(spark) + val attr = AttributeReference("a", StringType)() + FileSourceScanExecTransformer(relation, None, Seq(attr), schema, Nil, None, None, Nil, None) + } + + private def scanProperties(options: Map[String, String]): Map[String, String] = + scan(options).getProperties + + test("csv sep option maps to the native field delimiter") { Review Comment: This regression affects ClickHouse native CSV execution, but this suite is in `backends-velox` and only inspects the generated property map, so it cannot catch a break between that map and the ClickHouse reader. The corresponding Spark CSV alias test is still excluded for ClickHouse (for example, `gluten-ut/spark35/src/test/scala/org/apache/gluten/utils/clickhouse/ClickHouseTestSettings.scala:162`), and repository guidance requires fix/feature coverage under `gluten-ut`. Please add a backend-aware `gluten-ut` regression that reads pipe-delimited data with `option("sep", "|")` and verifies both the result and native scan (a dedicated test may be needed if the existing alias test remains excluded for its charset assertion). -- 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]
