Updating tests as MSQ does not support earliest for some cases

This commit is contained in:
Soumyava Das 2023-06-19 10:28:04 +05:30
parent cf88e00a0a
commit a9a6fc261c
8 changed files with 9 additions and 33 deletions

View File

@ -205,7 +205,7 @@ public class SqlExpressionBenchmark
"SELECT TIME_SHIFT(MILLIS_TO_TIMESTAMP(long4), 'PT1H', 1), string2, SUM(long1 * double4) FROM foo GROUP BY 1,2 ORDER BY 3",
// 37: time shift + expr agg (group by), uniform distribution high cardinality
"SELECT TIME_SHIFT(MILLIS_TO_TIMESTAMP(long5), 'PT1H', 1), string2, SUM(long1 * double4) FROM foo GROUP BY 1,2 ORDER BY 3",
// 38: LATEST aggregator
// 38: LATEST aggregator long
"SELECT LATEST(long1) FROM foo",
// 39: LATEST aggregator double
"SELECT LATEST(double4) FROM foo",
@ -216,7 +216,7 @@ public class SqlExpressionBenchmark
// 42,43: filter numeric nulls
"SELECT SUM(long5) FROM foo WHERE long5 IS NOT NULL",
"SELECT string2, SUM(long5) FROM foo WHERE long5 IS NOT NULL GROUP BY 1",
// 44: EARLIEST aggregator
// 44: EARLIEST aggregator long
"SELECT EARLIEST(long1) FROM foo",
// 45: EARLIEST aggregator double
"SELECT EARLIEST(double4) FROM foo",

View File

@ -156,10 +156,6 @@ public class CalciteSelectQueryMSQTest extends CalciteQueryTest
}
// The numeric varieties of the EARLIEST and LATEST aggregators do not work properly.
// Attempting to use the numeric varieties of these aggregators lead to an error
// like java.lang.ClassCastException: class java.lang.Double cannot be cast
// to class org.apache.druid.collections.SerializablePair.
@Ignore
@Override
public void testQueryWithMoreThanMaxNumericInFilter()
@ -167,20 +163,6 @@ public class CalciteSelectQueryMSQTest extends CalciteQueryTest
}
// MSQ currently does not su
@Ignore
@Override
public void testEarliestVectorAggregators()
{
}
@Ignore
@Override
public void testOffHeapEarliestGroupBy()
{
}
/**
* Same query as {@link CalciteQueryTest#testArrayAggQueryOnComplexDatatypes}. ARRAY_AGG is not supported in MSQ currently.
* Once support is added, this test can be removed and msqCompatible() can be added to the one in CalciteQueryTest.

View File

@ -25,9 +25,6 @@ import org.apache.druid.segment.vector.VectorValueSelector;
import javax.annotation.Nullable;
import java.nio.ByteBuffer;
/**
* Vectorized version of on heap 'earliest' aggregator for column selectors with type LONG..
*/
public class DoubleFirstVectorAggregator extends NumericFirstVectorAggregator
{
double firstValue;

View File

@ -25,9 +25,6 @@ import org.apache.druid.segment.vector.VectorValueSelector;
import javax.annotation.Nullable;
import java.nio.ByteBuffer;
/**
* Vectorized version of on heap 'earliest' aggregator for column selectors with type LONG..
*/
public class FloatFirstVectorAggregator extends NumericFirstVectorAggregator
{
float firstValue;

View File

@ -25,9 +25,6 @@ import org.apache.druid.segment.vector.VectorValueSelector;
import javax.annotation.Nullable;
import java.nio.ByteBuffer;
/**
* Vectorized version of on heap 'earliest' aggregator for column selectors with type LONG..
*/
public class LongFirstVectorAggregator extends NumericFirstVectorAggregator
{
long firstValue;

View File

@ -79,7 +79,6 @@ public abstract class NumericFirstVectorAggregator implements VectorAggregator
}
}
// find the first non-null value
final long earliestTime = timeVector[index];
if (earliestTime < firstTime) {
firstTime = earliestTime;

View File

@ -38,7 +38,7 @@ public class StringFirstVectorAggregator implements VectorAggregator
private final BaseLongVectorValueSelector timeSelector;
private final VectorObjectSelector valueSelector;
private final int maxStringBytes;
protected long firstTime;
//protected long firstTime;
public StringFirstVectorAggregator(
BaseLongVectorValueSelector timeSelector,
@ -65,7 +65,7 @@ public class StringFirstVectorAggregator implements VectorAggregator
}
long[] times = timeSelector.getLongVector();
Object[] objectsWhichMightBeStrings = valueSelector.getObjectVector();
firstTime = buf.getLong(position);
long firstTime = buf.getLong(position);
int index;
for (int i = startRow; i < endRow; i++) {
if (times[i] > firstTime) {
@ -80,7 +80,7 @@ public class StringFirstVectorAggregator implements VectorAggregator
index
);
if (inPair != null) {
final long firstTime = buf.getLong(position);
firstTime = buf.getLong(position);
if (inPair.lhs < firstTime) {
StringFirstLastUtils.writePair(
buf,

View File

@ -1370,6 +1370,8 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
@Test
public void testOffHeapEarliestGroupBy()
{
notMsqCompatible();
testQuery(
"SELECT dim2, EARLIEST(m1) AS val1 FROM foo GROUP BY dim2",
ImmutableList.of(
@ -14745,6 +14747,8 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
@Test
public void testEarliestVectorAggregators()
{
notMsqCompatible();
testQuery(
"SELECT "
+ "EARLIEST(cnt), EARLIEST(cnt + 1), EARLIEST(m1), EARLIEST(m1+1) "