@@ -22,20 +22,17 @@ package org.apache.spark.sql.comet
2222import java .io .{File , RandomAccessFile }
2323import java .nio .charset .StandardCharsets
2424import java .util .Base64
25-
2625import org .junit .runner .RunWith
2726import org .scalactic .source .Position
2827import org .scalatest .Tag
2928import org .scalatestplus .junit .JUnitRunner
30-
3129import org .apache .parquet .crypto .DecryptionPropertiesFactory
3230import org .apache .parquet .crypto .keytools .{KeyToolkit , PropertiesDrivenCryptoFactory }
3331import org .apache .parquet .crypto .keytools .mocks .InMemoryKMS
3432import org .apache .spark .{DebugFilesystem , SparkConf }
35- import org .apache .spark .sql .{CometTestBase , SQLContext }
33+ import org .apache .spark .sql .{CometTestBase , SQLContext , functions }
3634import org .apache .spark .sql .internal .SQLConf
3735import org .apache .spark .sql .test .SQLTestUtils
38-
3936import org .apache .comet .{CometConf , IntegrationTestSuite }
4037import org .apache .comet .CometConf .{SCAN_NATIVE_COMET , SCAN_NATIVE_DATAFUSION , SCAN_NATIVE_ICEBERG_COMPAT }
4138
@@ -394,11 +391,16 @@ class ParquetEncryptionITCase extends CometTestBase with SQLTestUtils {
394391 val parquetDF2 = spark.read.parquet(parquetDir2)
395392
396393 val unionDF = parquetDF1.union(parquetDF2)
394+ // Since the union has its own executeColumnar, problems would not surface if it is the last operator
395+ // If we add another comet aggregate after the union, we see the need for the
396+ // foreachUntilCometInput() in operator.scala
397+ // as we would error on multiple native scan execs despite no longer being in the same plan at all
398+ val aggDf = unionDF.agg(functions.sum(" id" ))
397399
398400 if (CometConf .COMET_ENABLED .get(conf)) {
399- checkSparkAnswerAndOperator(unionDF )
401+ checkSparkAnswerAndOperator(aggDf )
400402 } else {
401- checkSparkAnswer(unionDF )
403+ checkSparkAnswer(aggDf )
402404 }
403405 }
404406 }
0 commit comments