From e477afa0cb7e23f6982cfdcdaa736bb71c522a14 Mon Sep 17 00:00:00 2001 From: Aadil Khalifa <49197409+aadilkhalifa@users.noreply.github.com> Date: Sat, 6 Apr 2024 03:16:35 +0530 Subject: [PATCH] Added tests for additional data types in SegmentPreProcessorTest.java (#12755) --- .../index/loader/SegmentPreProcessorTest.java | 28 +++++++++++++++ .../test/resources/data/testDataMVSchema.json | 36 +++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/segment/index/loader/SegmentPreProcessorTest.java b/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/segment/index/loader/SegmentPreProcessorTest.java index ef25c785e032..3349821963a0 100644 --- a/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/segment/index/loader/SegmentPreProcessorTest.java +++ b/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/segment/index/loader/SegmentPreProcessorTest.java @@ -21,6 +21,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Sets; import java.io.File; +import java.math.BigDecimal; import java.net.URL; import java.nio.file.Files; import java.nio.file.attribute.FileTime; @@ -1387,6 +1388,33 @@ public void testColumnMinMaxValue() assertEquals(timeColumnMetadata.getMaxValue(), 1756015683); assertEquals(dimensionColumnMetadata.getMinValue(), "AKXcXcIqsqOJFsdwxZ"); assertEquals(dimensionColumnMetadata.getMaxValue(), "yQkJTLOQoOqqhkAClgC"); + dimensionColumnMetadata = segmentMetadata.getColumnMetadataFor("column14"); + assertEquals(dimensionColumnMetadata.getMaxValue(), -9223372036854775808L); + assertEquals(dimensionColumnMetadata.getMinValue(), -9223372036854775808L); + dimensionColumnMetadata = segmentMetadata.getColumnMetadataFor("column15"); + assertEquals(dimensionColumnMetadata.getMaxValue(), Float.NEGATIVE_INFINITY); + assertEquals(dimensionColumnMetadata.getMinValue(), Float.NEGATIVE_INFINITY); + dimensionColumnMetadata = segmentMetadata.getColumnMetadataFor("column16"); + assertEquals(dimensionColumnMetadata.getMaxValue(), Double.NEGATIVE_INFINITY); + assertEquals(dimensionColumnMetadata.getMinValue(), Double.NEGATIVE_INFINITY); + dimensionColumnMetadata = segmentMetadata.getColumnMetadataFor("column17"); + assertEquals(dimensionColumnMetadata.getMaxValue(), new BigDecimal("0")); + assertEquals(dimensionColumnMetadata.getMinValue(), new BigDecimal("0")); + dimensionColumnMetadata = segmentMetadata.getColumnMetadataFor("column18"); + assertEquals(dimensionColumnMetadata.getMaxValue(), 0); + assertEquals(dimensionColumnMetadata.getMinValue(), 0); + dimensionColumnMetadata = segmentMetadata.getColumnMetadataFor("column19"); + assertEquals(dimensionColumnMetadata.getMaxValue().toString(), "0"); + assertEquals(dimensionColumnMetadata.getMinValue().toString(), "0"); + dimensionColumnMetadata = segmentMetadata.getColumnMetadataFor("column20"); + assertEquals(dimensionColumnMetadata.getMaxValue(), "null"); + assertEquals(dimensionColumnMetadata.getMinValue(), "null"); + dimensionColumnMetadata = segmentMetadata.getColumnMetadataFor("column21"); + assertEquals(dimensionColumnMetadata.getMaxValue(), "null"); + assertEquals(dimensionColumnMetadata.getMinValue(), "null"); + dimensionColumnMetadata = segmentMetadata.getColumnMetadataFor("column22"); + assertEquals(dimensionColumnMetadata.getMaxValue().toString(), ""); + assertEquals(dimensionColumnMetadata.getMinValue().toString(), ""); assertEquals(metricColumnMetadata.getMinValue(), 890662862); assertEquals(metricColumnMetadata.getMaxValue(), 890662862); } diff --git a/pinot-segment-local/src/test/resources/data/testDataMVSchema.json b/pinot-segment-local/src/test/resources/data/testDataMVSchema.json index bf480a1a0f40..d9eca524deb2 100644 --- a/pinot-segment-local/src/test/resources/data/testDataMVSchema.json +++ b/pinot-segment-local/src/test/resources/data/testDataMVSchema.json @@ -47,6 +47,42 @@ "name": "column13", "dataType": "INT" }, + { + "name": "column14", + "dataType": "LONG" + }, + { + "name": "column15", + "dataType": "FLOAT" + }, + { + "name": "column16", + "dataType": "DOUBLE" + }, + { + "name": "column17", + "dataType": "BIG_DECIMAL" + }, + { + "name": "column18", + "dataType": "BOOLEAN" + }, + { + "name": "column19", + "dataType": "TIMESTAMP" + }, + { + "name": "column20", + "dataType": "STRING" + }, + { + "name": "column21", + "dataType": "JSON" + }, + { + "name": "column22", + "dataType": "BYTES" + }, { "name": "weeksSinceEpochSunday", "dataType": "INT"