alexeykudinkin commented on a change in pull request #4026:
URL: https://github.com/apache/hudi/pull/4026#discussion_r756346322
##########
File path:
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/functional/TestTableLayoutOptimization.scala
##########
@@ -83,30 +87,41 @@ class TestOptimizeTable extends HoodieClientTestBase {
.option("hoodie.clustering.plan.strategy.target.file.max.bytes",
"1073741824")
.option("hoodie.clustering.plan.strategy.small.file.limit", "629145600")
.option("hoodie.clustering.plan.strategy.max.bytes.per.group",
Long.MaxValue.toString)
- .option("hoodie.clustering.plan.strategy.target.file.max.bytes",
String.valueOf(64 *1024 * 1024L))
+ .option("hoodie.clustering.plan.strategy.target.file.max.bytes",
String.valueOf(64 * 1024 * 1024L))
.option(HoodieClusteringConfig.LAYOUT_OPTIMIZE_ENABLE.key, "true")
.option(HoodieClusteringConfig.PLAN_STRATEGY_SORT_COLUMNS.key,
"begin_lat, begin_lon")
.mode(SaveMode.Overwrite)
.save(basePath)
- assertEquals(1000, spark.read.format("hudi").load(basePath).count())
- // use unsorted col as filter.
- assertEquals(spark.read
- .format("hudi").load(basePath).where("end_lat >= 0 and rider != '1' and
weight > 0.0").count(),
- spark.read.option(DataSourceReadOptions.ENABLE_DATA_SKIPPING.key(),
"true")
- .format("hudi").load(basePath).where("end_lat >= 0 and rider != '1'
and weight > 0.0").count())
- // use sorted col as filter.
- assertEquals(spark.read.format("hudi").load(basePath)
- .where("begin_lat >= 0.49 and begin_lat < 0.51 and begin_lon >= 0.49 and
begin_lon < 0.51").count(),
- spark.read.option(DataSourceReadOptions.ENABLE_DATA_SKIPPING.key(),
"true")
- .format("hudi").load(basePath)
- .where("begin_lat >= 0.49 and begin_lat < 0.51 and begin_lon >= 0.49
and begin_lon < 0.51").count())
- // use sorted cols and unsorted cols as filter
- assertEquals(spark.read.format("hudi").load(basePath)
- .where("begin_lat >= 0.49 and begin_lat < 0.51 and end_lat >
0.56").count(),
- spark.read.option(DataSourceReadOptions.ENABLE_DATA_SKIPPING.key(),
"true")
- .format("hudi").load(basePath)
- .where("begin_lat >= 0.49 and begin_lat < 0.51 and end_lat >
0.56").count())
+ val readDf =
+ spark.read
+ .format("hudi")
+ .load(basePath)
+
+ val readDfSkip =
+ spark.read
+ .option(DataSourceReadOptions.ENABLE_DATA_SKIPPING.key(), "true")
+ .format("hudi")
+ .load(basePath)
+
+ assertEquals(targetRecordsCount, readDf.count())
+ assertEquals(targetRecordsCount, readDfSkip.count())
+
+ readDf.createOrReplaceTempView("hudi_snapshot_raw")
+ readDfSkip.createOrReplaceTempView("hudi_snapshot_skipping")
+
+ def select(tableName: String) =
+ spark.sql(s"SELECT * FROM $tableName WHERE begin_lat >= 0.49 AND
begin_lat < 0.51 AND begin_lon >= 0.49 AND begin_lon < 0.51")
+
+ assertRowsMatch(
+ select("hudi_snapshot_raw"),
+ select("hudi_snapshot_skipping")
+ )
+ }
+
+ def assertRowsMatch(one: DataFrame, other: DataFrame) = {
Review comment:
I did not find any of that last time, didn't find it this time either,
where would you suggest to place it?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]