Skip to content

Commit

Permalink
Migrate off testng assertions in TestHiveFileFormats
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Jan 11, 2024
1 parent 63a7169 commit 820be74
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@
import static org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory.javaTimestampObjectInspector;
import static org.apache.hadoop.io.SequenceFile.CompressionType.BLOCK;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.data.Offset.offset;
import static org.joda.time.DateTimeZone.UTC;
import static org.testng.Assert.assertEquals;

// Failing on multiple threads because of org.apache.hadoop.hive.ql.io.parquet.write.ParquetRecordWriterWrapper
// uses a single record writer across all threads.
Expand All @@ -222,7 +222,7 @@
public final class TestHiveFileFormats
{
private static final DateTimeZone HIVE_STORAGE_TIME_ZONE = DateTimeZone.forID("America/Bahia_Banderas");
private static final double EPSILON = 0.001;
private static final float EPSILON = 0.001f;

private static final FileFormatDataSourceStats STATS = new FileFormatDataSourceStats();
private static final ConnectorSession PARQUET_SESSION = getHiveSession(createParquetHiveConfig(false));
Expand Down Expand Up @@ -1045,10 +1045,12 @@ private static void checkPageSource(ConnectorPageSource pageSource, List<TestCol
.isEqualTo(expectedValue);
}
else if (type == REAL) {
assertEquals((float) actualValue, (float) expectedValue, EPSILON, "Wrong value for column " + testColumn.name());
assertThat((float) actualValue).describedAs("Wrong value for column %s", testColumn.name())
.isCloseTo((float) expectedValue, offset(EPSILON));
}
else if (type == DOUBLE) {
assertEquals((double) actualValue, (double) expectedValue, EPSILON, "Wrong value for column " + testColumn.name());
assertThat((double) actualValue).describedAs("Wrong value for column %s", testColumn.name())
.isCloseTo((double) expectedValue, offset((double) EPSILON));
}
else if (type == DATE) {
SqlDate expectedDate = new SqlDate(toIntExact((long) expectedValue));
Expand Down

0 comments on commit 820be74

Please sign in to comment.