You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/01/27 13:26:53 UTC
[GitHub] [spark] AngersZhuuuu opened a new pull request #35342: [SPARK-38043][SQL] Refactor FileBasedDataSourceSuite and add DataSourceSuite for each data source
AngersZhuuuu opened a new pull request #35342:
URL: https://github.com/apache/spark/pull/35342
### What changes were proposed in this pull request?
Current test framework for file based data source is complex and mess,
this pr we aim to convert FileBasedDataSourceSuite to a base suite, and implement it for each datasources.
Later I will review some existing unit tests to integrate into this new testing framework
### Why are the changes needed?
Refactor code
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Existed UT
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] HyukjinKwon commented on a change in pull request #35342: [SPARK-38043][SQL] Refactor FileBasedDataSourceSuite and add DataSourceSuite for each data source
Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on a change in pull request #35342:
URL: https://github.com/apache/spark/pull/35342#discussion_r795111986
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/text/TextDataSourceSuite.scala
##########
@@ -0,0 +1,101 @@
+/*
+ * 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.spark.sql.execution.datasources.text
+
+import java.io.File
+
+import org.apache.spark.sql.{AnalysisException, FileBasedDataSourceSuiteBase}
+import org.apache.spark.sql.types.{BooleanType, DoubleType, IntegerType, StructField, StructType}
+
+class TextDataSourceSuite extends FileBasedDataSourceSuiteBase {
+ import testImplicits._
+
+ override protected def format: String = "text"
+
+ override def excluded: Seq[String] =
Review comment:
I think this kind of generalization would be confusing ...
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] HyukjinKwon commented on a change in pull request #35342: [SPARK-38043][SQL] Refactor FileBasedDataSourceSuite and add DataSourceSuite for each data source
Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on a change in pull request #35342:
URL: https://github.com/apache/spark/pull/35342#discussion_r795112209
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/FileBasedDataSourceSuiteBase.scala
##########
@@ -0,0 +1,626 @@
+/*
+ * 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.spark.sql
+
+import java.io.{File, FileNotFoundException}
+import java.net.URI
+import java.util.Locale
+
+import org.apache.hadoop.conf.Configuration
+import org.apache.hadoop.fs.{LocalFileSystem, Path}
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.TestingUDT.{IntervalUDT, NullData, NullUDT}
+import org.apache.spark.sql.catalyst.expressions.AttributeReference
+import org.apache.spark.sql.catalyst.expressions.IntegralLiteralTestUtils.{negativeInt, positiveInt}
+import org.apache.spark.sql.catalyst.plans.logical.Filter
+import org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanHelper
+import org.apache.spark.sql.execution.datasources.FilePartition
+import org.apache.spark.sql.execution.datasources.v2.{BatchScanExec, FileScan}
+import org.apache.spark.sql.execution.datasources.v2.orc.OrcScan
+import org.apache.spark.sql.execution.datasources.v2.parquet.ParquetScan
+import org.apache.spark.sql.functions._
+import org.apache.spark.sql.internal.SQLConf
+import org.apache.spark.sql.test.SharedSparkSession
+import org.apache.spark.sql.types._
+
+abstract class FileBasedDataSourceSuiteBase extends QueryTest
+ with SharedSparkSession
+ with AdaptiveSparkPlanHelper {
+ import testImplicits._
+
+ protected def format: String
+
+ // subclasses can override this to exclude certain tests by name
+ // useful when inheriting a test suite but do not want to run all tests in it
+ def excluded: Seq[String] = Seq.empty
+
+ override def beforeAll(): Unit = {
+ super.beforeAll()
+ spark.sessionState.conf.setConf(SQLConf.ORC_IMPLEMENTATION, "native")
+ tests.foreach { case (name, testCode) =>
+ if (!excluded.contains(name)) {
+ test(name) {
+ testCode
+ }
+ }
+ }
+ }
+
+ override def afterAll(): Unit = {
+ try {
+ spark.sessionState.conf.unsetConf(SQLConf.ORC_IMPLEMENTATION)
+ } finally {
+ super.afterAll()
+ }
+ }
+
+ private val nameWithSpecialChars = "sp&cial%c hars"
+
+ lazy val tests: Map[String, () => Any] = Map(
Review comment:
This would be confusing too since we have to define a test case different from a usual way.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org