Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.hudi.functional

import org.apache.avro.Schema
import org.apache.calcite.runtime.SqlFunctions.abs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't Math.abs be sufficient?

import org.apache.hudi.HoodieBaseRelation.projectSchema
import org.apache.hudi.common.config.{HoodieMetadataConfig, HoodieStorageConfig}
import org.apache.hudi.common.model.{HoodieRecord, OverwriteNonDefaultsWithLatestAvroPayload}
Expand All @@ -31,8 +32,9 @@ import org.apache.parquet.hadoop.util.counters.BenchmarkCounter
import org.apache.spark.internal.Logging
import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.{Dataset, HoodieUnsafeUtils, Row, SaveMode}
import org.junit.jupiter.api.Assertions.{assertEquals, fail}
import org.junit.jupiter.api.Assertions.{assertEquals, assertTrue, fail}
import org.junit.jupiter.api.{Disabled, Tag, Test}

import scala.collection.JavaConverters._

@Tag("functional")
Expand Down Expand Up @@ -235,9 +237,9 @@ class TestParquetColumnProjection extends SparkClientFunctionalTestHarness with
else if (HoodieSparkUtils.isSpark2)
// TODO re-enable tests (these tests are very unstable currently)
Array(
("rider", -1),
("rider,driver", -1),
("rider,driver,tip_history", -1))
("rider", 14160),
("rider,driver", 14160),
("rider,driver,tip_history", 14160))
else
fail("Only Spark 3 and Spark 2 are currently supported")

Expand Down Expand Up @@ -326,11 +328,8 @@ class TestParquetColumnProjection extends SparkClientFunctionalTestHarness with
else targetRecordCount

assertEquals(expectedRecordCount, rows.length)
if (expectedBytesRead != -1) {
assertEquals(expectedBytesRead, bytesRead)
} else {
logWarning(s"Not matching bytes read ($bytesRead)")
}
// verify within 10% of margin.
assertTrue((abs(expectedBytesRead - bytesRead) / expectedBytesRead) < 0.1)

val readColumns = targetColumns ++ relation.mandatoryFields
val (_, projectedStructType, _) = projectSchema(Left(tableState.schema), readColumns)
Expand Down