rongma1997 commented on a change in pull request #26137: [SPARK-29490][SQL] 
Reset 'WritableColumnVector' in 'RowToColumnarExec'
URL: https://github.com/apache/spark/pull/26137#discussion_r338878710
 
 

 ##########
 File path: 
sql/core/src/test/scala/org/apache/spark/sql/SparkSessionExtensionSuite.scala
 ##########
 @@ -171,6 +172,30 @@ class SparkSessionExtensionSuite extends SparkFunSuite {
     }
   }
 
+  test("reset column vectors") {
+    val session = SparkSession.builder()
+      .master("local[1]")
+      .config(COLUMN_BATCH_SIZE.key, 2)
+      .withExtensions { extensions =>
+        extensions.injectColumnar(session =>
+          MyColumarRule(PreRuleReplaceAddWithBrokenVersion(), MyPostRule())) }
+      .getOrCreate()
+
+    try {
+      assert(session.sessionState.columnarRules.contains(
+        MyColumarRule(PreRuleReplaceAddWithBrokenVersion(), MyPostRule())))
+      import session.sqlContext.implicits._
+
+      val input = Seq((100L), (200L), (300L))
+      val data = input.toDF("vals").repartition(1)
+      val df = data.selectExpr("vals + 1")
+      val result = df.collect()
+      assert(result sameElements input.map(x => Row(x + 2)))
+    } finally {
+      stop(session)
+    }
+  }
 
 Review comment:
   Hi @dongjoon-hyun , thanks for your comments.
   I put this UT here because the spark session is built with extensions which 
inject the columnar rules and it rely on the existing code in the same file. In 
fact the most part of this UT reused the code in `test("inject columnar")`.
   Should I just move this UT under the directory you mentioned ? I haven't 
find a proper file to place it yet. Is it good if I create a new test suite 
file? e.g.
   
   - 
sql/core/src/test/scala/org/apache/spark/sql/execution/columnar/InjectColumnarSuite.scala

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to