Skip to content

Commit

Permalink
[VL] Add InsertIntoHadoopFsRelationCommand test case for csv format (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
liujiayi771 authored May 11, 2024
1 parent d931006 commit 34ea806
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,23 @@ class TestOperator extends VeloxWholeStageTransformerSuite {
}
}

test("insert into select from csv") {
withTable("insert_csv_t") {
val filePath = rootPath + "/datasource/csv/student.csv"
val df = spark.read
.format("csv")
.option("header", "true")
.load(filePath)
df.createOrReplaceTempView("student")
spark.sql("create table insert_csv_t(Name string, Language string) using parquet;")
runQueryAndCompare("""
|insert into insert_csv_t select * from student;
|""".stripMargin) {
checkGlutenOperatorMatch[ArrowFileSourceScanExec]
}
}
}

test("test OneRowRelation") {
val df = sql("SELECT 1")
checkAnswer(df, Row(1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import org.apache.gluten.utils.{Arm, FallbackUtil}
import org.apache.spark.SparkConf
import org.apache.spark.internal.Logging
import org.apache.spark.sql.{DataFrame, GlutenQueryTest, Row}
import org.apache.spark.sql.execution.SparkPlan
import org.apache.spark.sql.execution.{CommandResultExec, SparkPlan}
import org.apache.spark.sql.execution.adaptive.{AdaptiveSparkPlanExec, AdaptiveSparkPlanHelper, ShuffleQueryStageExec}
import org.apache.spark.sql.test.SharedSparkSession
import org.apache.spark.sql.types.DoubleType
Expand Down Expand Up @@ -222,6 +222,8 @@ abstract class WholeStageTransformerSuite
df.queryExecution.executedPlan match {
case exec: AdaptiveSparkPlanExec =>
getChildrenPlan(Seq(exec.executedPlan))
case cmd: CommandResultExec =>
getChildrenPlan(Seq(cmd.commandPhysicalPlan))
case plan =>
getChildrenPlan(Seq(plan))
}
Expand Down

0 comments on commit 34ea806

Please sign in to comment.