Skip to content

Commit 36519c3

Browse files
use checkNativeWrite
1 parent 9b073f5 commit 36519c3

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

backends-velox/src/test/scala/org/apache/spark/sql/execution/VeloxParquetWriteSuite.scala

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,22 +86,25 @@ class VeloxParquetWriteSuite extends VeloxWholeStageTransformerSuite with WriteU
8686
withSQLConf(SQLConf.PARQUET_WRITE_LEGACY_FORMAT.key -> legacyFormat.toString) {
8787
withTempPath {
8888
f =>
89-
val df = spark.sql("SELECT CAST(123.456 AS DECIMAL(8, 3)) AS value")
90-
df.write.format("parquet").save(f.getCanonicalPath)
89+
val path = f.getCanonicalPath
90+
val expected = spark.sql("SELECT CAST(123.456 AS DECIMAL(8, 3)) AS value")
91+
checkNativeWrite(
92+
s"INSERT OVERWRITE DIRECTORY '$path' USING PARQUET " +
93+
"SELECT CAST(123.456 AS DECIMAL(8, 3)) AS value")
9194
val parquetFiles = f.list((_, name) => name.contains("parquet"))
9295
assert(parquetFiles.nonEmpty)
9396
parquetFiles.foreach {
9497
file =>
95-
val path = new Path(f.getCanonicalPath, file)
96-
val in = HadoopInputFile.fromPath(path, spark.sessionState.newHadoopConf())
98+
val filePath = new Path(path, file)
99+
val in = HadoopInputFile.fromPath(filePath, spark.sessionState.newHadoopConf())
97100
Utils.tryWithResource(ParquetFileReader.open(in)) {
98101
reader =>
99102
val physicalType = reader.getFooter.getFileMetaData.getSchema
100103
.getFields.get(0).asPrimitiveType.getPrimitiveTypeName
101104
assert(physicalType == expectedType)
102105
}
103106
}
104-
checkAnswer(spark.read.parquet(f.getCanonicalPath), df)
107+
checkAnswer(spark.read.parquet(path), expected)
105108
}
106109
}
107110
}

0 commit comments

Comments
 (0)