Windowed min aggregates null-s as 0 (#15371)

This commit is contained in:
Zoltan Haindrich 2023-12-08 10:41:16 +01:00 committed by GitHub
parent 1eafe983ec
commit c353ccfdef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 235 additions and 118 deletions

View File

@ -43,7 +43,7 @@ import org.apache.druid.query.monomorphicprocessing.RuntimeShapeInspector;
import org.apache.druid.segment.ColumnSelectorFactory;
import org.apache.druid.segment.ColumnValueSelector;
import org.apache.druid.segment.DimensionSelector;
import org.apache.druid.segment.ObjectColumnSelector;
import org.apache.druid.segment.ObjectBasedColumnSelector;
import org.apache.druid.segment.column.ColumnCapabilities;
import javax.annotation.Nullable;
@ -471,9 +471,9 @@ public class ParallelCombiner<KeyType>
}
@Override
public ColumnValueSelector makeColumnValueSelector(String columnName)
public ColumnValueSelector<Object> makeColumnValueSelector(String columnName)
{
return new ObjectColumnSelector()
return new ObjectBasedColumnSelector<Object>()
{
@Override
public void inspectRuntimeShape(RuntimeShapeInspector inspector)
@ -482,7 +482,7 @@ public class ParallelCombiner<KeyType>
}
@Override
public Class classOfObject()
public Class<Object> classOfObject()
{
return Object.class;
}

View File

@ -31,7 +31,7 @@ import org.apache.druid.query.rowsandcols.column.ObjectArrayColumn;
import org.apache.druid.segment.ColumnSelectorFactory;
import org.apache.druid.segment.ColumnValueSelector;
import org.apache.druid.segment.DimensionSelector;
import org.apache.druid.segment.ObjectColumnSelector;
import org.apache.druid.segment.ObjectBasedColumnSelector;
import org.apache.druid.segment.column.ColumnCapabilities;
import org.apache.druid.segment.column.ColumnCapabilitiesImpl;
@ -551,7 +551,7 @@ public class DefaultFramedOnHeapAggregatable implements FramedOnHeapAggregatable
@Nonnull
public ColumnValueSelector makeColumnValueSelector(@Nonnull String columnName)
{
return new ObjectColumnSelector()
return new ObjectBasedColumnSelector()
{
@Override
public void inspectRuntimeShape(RuntimeShapeInspector inspector)

View File

@ -0,0 +1,78 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.druid.segment;
import org.apache.druid.error.DruidException;
/**
* Object based column selector.
*
* This abstract class provides a {@link ColumnValueSelector} based on the methods of {@link BaseObjectColumnValueSelector}.
*/
public abstract class ObjectBasedColumnSelector<T> implements ColumnValueSelector<T>
{
private static final String COLUMN_IS_NULL_ERROR_MESSAGE = "Invalid usage pattern: method returning primitive called - but the column is null";
@Override
public final float getFloat()
{
T value = getObject();
if (value == null) {
throw DruidException.defensive(COLUMN_IS_NULL_ERROR_MESSAGE);
}
return ((Number) value).floatValue();
}
@Override
public final double getDouble()
{
T value = getObject();
if (value == null) {
throw DruidException.defensive(COLUMN_IS_NULL_ERROR_MESSAGE);
}
return ((Number) value).doubleValue();
}
@Override
public final long getLong()
{
T value = getObject();
if (value == null) {
throw DruidException.defensive(COLUMN_IS_NULL_ERROR_MESSAGE);
}
return ((Number) value).longValue();
}
@Override
public final boolean isNull()
{
T object = getObject();
if (object == null) {
return true;
}
if (object instanceof Number) {
return false;
}
throw DruidException.defensive(
"isNull() may only be called in case the underlying object is a Number but it was [%s]",
object.getClass().getName()
);
}
}

View File

@ -19,75 +19,43 @@
package org.apache.druid.segment;
import org.apache.druid.error.DruidException;
/**
* This class is convenient for implementation of "object-sourcing" {@link ColumnValueSelector}s, it provides default
* implementations for all {@link ColumnValueSelector}'s methods except {@link #getObject()} and {@link
* #classOfObject()}.
* Restricts selector usage to only allow {@link #getObject()}.
*
* This class should appear ONLY in "extends" clause or anonymous class creation, but NOT in "user" code, where
* {@link BaseObjectColumnValueSelector} must be used instead.
* This class is convenient for implementation of "object-sourcing"
* {@link ColumnValueSelector}s.
*
* This is a class rather than an interface unlike {@link LongColumnSelector}, {@link FloatColumnSelector} and {@link
* DoubleColumnSelector} solely in order to make {@link #isNull()} method final.
* This class should appear ONLY in "extends" clause or anonymous class
* creation, but NOT in "user" code, where {@link BaseObjectColumnValueSelector}
* must be used instead.
*/
public abstract class ObjectColumnSelector<T> implements ColumnValueSelector<T>
{
/**
* @deprecated This method is marked as deprecated in ObjectColumnSelector to minimize the probability of accidental
* calling. "Polymorphism" of ObjectColumnSelector should be used only when operating on {@link ColumnValueSelector}
* objects.
*/
@Deprecated
private static final String EXCEPTION_MESSAGE = "This class has restricted API; use getObject() instead";
@Override
public float getFloat()
public final float getFloat()
{
T value = getObject();
if (value == null) {
return 0;
}
return ((Number) value).floatValue();
throw DruidException.defensive(EXCEPTION_MESSAGE);
}
/**
* @deprecated This method is marked as deprecated in ObjectColumnSelector to minimize the probability of accidental
* calling. "Polymorphism" of ObjectColumnSelector should be used only when operating on {@link ColumnValueSelector}
* objects.
*/
@Deprecated
@Override
public double getDouble()
public final double getDouble()
{
T value = getObject();
if (value == null) {
return 0;
}
return ((Number) value).doubleValue();
throw DruidException.defensive(EXCEPTION_MESSAGE);
}
/**
* @deprecated This method is marked as deprecated in ObjectColumnSelector to minimize the probability of accidental
* calling. "Polymorphism" of ObjectColumnSelector should be used only when operating on {@link ColumnValueSelector}
* objects.
*/
@Deprecated
@Override
public long getLong()
public final long getLong()
{
T value = getObject();
if (value == null) {
return 0;
}
return ((Number) value).longValue();
throw DruidException.defensive(EXCEPTION_MESSAGE);
}
/**
* @deprecated This method is marked as deprecated in ObjectColumnSelector since it always returns false.
* There is no need to call this method.
*/
@Deprecated
@Override
public final boolean isNull()
{
return false;
throw DruidException.defensive(EXCEPTION_MESSAGE);
}
}

View File

@ -560,7 +560,6 @@ public class AutoTypeColumnIndexerTest extends InitializedNullHandlingTest
() -> cursorList.get(1).getColumnSelectorFactory().makeDimensionSelector(dimensionSpec)
);
Assert.assertEquals(StructuredData.wrap(2L), valueSelector.getObject());
Assert.assertFalse(valueSelector.isNull());
columnSelectorFactory = cursorList.get(2).getColumnSelectorFactory();
valueSelector = columnSelectorFactory.makeColumnValueSelector(NESTED_COL);
@ -569,7 +568,6 @@ public class AutoTypeColumnIndexerTest extends InitializedNullHandlingTest
() -> cursorList.get(2).getColumnSelectorFactory().makeDimensionSelector(dimensionSpec)
);
Assert.assertEquals(StructuredData.wrap(ImmutableMap.of("x", 1.1, "y", 2L)), valueSelector.getObject());
Assert.assertFalse(valueSelector.isNull());
columnSelectorFactory = cursorList.get(3).getColumnSelectorFactory();
valueSelector = columnSelectorFactory.makeColumnValueSelector(NESTED_COL);

View File

@ -551,7 +551,6 @@ public class NestedDataColumnIndexerV4Test extends InitializedNullHandlingTest
() -> cursorList.get(1).getColumnSelectorFactory().makeDimensionSelector(dimensionSpec)
);
Assert.assertEquals(StructuredData.wrap(2L), valueSelector.getObject());
Assert.assertFalse(valueSelector.isNull());
columnSelectorFactory = cursorList.get(2).getColumnSelectorFactory();
valueSelector = columnSelectorFactory.makeColumnValueSelector(NESTED_COL);
@ -560,7 +559,6 @@ public class NestedDataColumnIndexerV4Test extends InitializedNullHandlingTest
() -> cursorList.get(2).getColumnSelectorFactory().makeDimensionSelector(dimensionSpec)
);
Assert.assertEquals(StructuredData.wrap(ImmutableMap.of("x", 1.1, "y", 2L)), valueSelector.getObject());
Assert.assertFalse(valueSelector.isNull());
columnSelectorFactory = cursorList.get(3).getColumnSelectorFactory();
valueSelector = columnSelectorFactory.makeColumnValueSelector(NESTED_COL);

View File

@ -21,7 +21,7 @@ package org.apache.druid.segment;
import org.apache.druid.query.monomorphicprocessing.RuntimeShapeInspector;
public abstract class TestObjectColumnSelector<T> extends ObjectColumnSelector<T>
public abstract class TestObjectColumnSelector<T> extends ObjectBasedColumnSelector<T>
{
@Override
public void inspectRuntimeShape(RuntimeShapeInspector inspector)

View File

@ -0,0 +1,94 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.druid.segment.virtual;
import org.apache.druid.error.DruidException;
import org.apache.druid.query.monomorphicprocessing.RuntimeShapeInspector;
import org.apache.druid.segment.ObjectBasedColumnSelector;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
public class TestObjectBasedColumnSelector
{
static class MyObjectColumnSelector extends ObjectBasedColumnSelector<Object>
{
private Object obj;
MyObjectColumnSelector(Object obj)
{
this.obj = obj;
}
@Override
public void inspectRuntimeShape(RuntimeShapeInspector inspector)
{
}
@Override
public Object getObject()
{
return obj;
}
@Override
public Class<? extends Object> classOfObject()
{
if (obj == null) {
return null;
}
return obj.getClass();
}
}
@Test
public void testNull()
{
MyObjectColumnSelector selector = new MyObjectColumnSelector(null);
assertThrows(DruidException.class, () -> selector.getFloat());
assertThrows(DruidException.class, () -> selector.getDouble());
assertThrows(DruidException.class, () -> selector.getLong());
assertTrue(selector.isNull());
}
@Test
public void testLong()
{
MyObjectColumnSelector selector = new MyObjectColumnSelector(Long.valueOf(11L));
assertFalse(selector.isNull());
assertEquals(11f, selector.getLong(), 0.0f);
}
@Test
public void testInvalidIsNullUse()
{
MyObjectColumnSelector selector = new MyObjectColumnSelector(getClass());
DruidException e = assertThrows(DruidException.class, () -> selector.isNull());
assertEquals(
e.getMessage(),
"isNull() may only be called in case the underlying object is a Number but it was [java.lang.Class]"
);
}
}

View File

@ -130,16 +130,7 @@ public class CalciteWindowQueryTest extends BaseCalciteQueryTest
maybeDumpActualResults(results.results);
if (input.expectedOperators != null) {
final WindowOperatorQuery query = getWindowOperatorQuery(results.recordedQueries);
for (int i = 0; i < input.expectedOperators.size(); ++i) {
final OperatorFactory expectedOperator = input.expectedOperators.get(i);
final OperatorFactory actualOperator = query.getOperators().get(i);
if (!expectedOperator.validateEquivalent(actualOperator)) {
assertEquals("Operator Mismatch, index[" + i + "]",
queryJackson.writeValueAsString(expectedOperator),
queryJackson.writeValueAsString(actualOperator));
fail("validateEquivalent failed; but textual comparision of operators didn't reported the mismatch!");
}
}
validateOperators(input.expectedOperators, query.getOperators());
}
final RowSignature outputSignature = results.signature;
@ -179,6 +170,22 @@ public class CalciteWindowQueryTest extends BaseCalciteQueryTest
assertResultsValid(ResultMatchMode.RELAX_NULLS, input.expectedResults, results);
}
private void validateOperators(List<OperatorFactory> expectedOperators, List<OperatorFactory> currentOperators)
throws Exception
{
for (int i = 0; i < expectedOperators.size(); ++i) {
final OperatorFactory expectedOperator = expectedOperators.get(i);
final OperatorFactory actualOperator = currentOperators.get(i);
if (!expectedOperator.validateEquivalent(actualOperator)) {
assertEquals("Operator Mismatch, index[" + i + "]",
queryJackson.writeValueAsString(expectedOperator),
queryJackson.writeValueAsString(actualOperator));
fail("validateEquivalent failed; but textual comparision of operators didn't reported the mismatch!");
}
}
assertEquals("Operator count mismatch!", expectedOperators.size(), currentOperators.size());
}
private void maybeDumpActualResults(List<Object[]> results) throws Exception
{
if (DUMP_ACTUAL_RESULTS) {

View File

@ -4980,7 +4980,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_COUNT_MISMATCH)
@DrillTest("aggregates/testW_Nulls_10")
@Test
public void test_aggregates_testW_Nulls_10()
@ -5140,7 +5139,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_MISMATCH)
@DrillTest("aggregates/testW_Nulls_2")
@Test
public void test_aggregates_testW_Nulls_2()
@ -5228,7 +5226,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_COUNT_MISMATCH)
@DrillTest("aggregates/testW_Nulls_3")
@Test
public void test_aggregates_testW_Nulls_3()
@ -5236,7 +5233,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_MISMATCH)
@DrillTest("aggregates/testW_Nulls_4")
@Test
public void test_aggregates_testW_Nulls_4()
@ -5283,7 +5279,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_MISMATCH)
@DrillTest("aggregates/winFnQry_61")
@Test
public void test_aggregates_winFnQry_61()
@ -5291,7 +5286,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_MISMATCH)
@DrillTest("aggregates/winFnQry_62")
@Test
public void test_aggregates_winFnQry_62()
@ -5419,7 +5413,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_COUNT_MISMATCH)
@DrillTest("aggregates/winFnQry_79")
@Test
public void test_aggregates_winFnQry_79()
@ -5427,7 +5420,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_COUNT_MISMATCH)
@DrillTest("aggregates/winFnQry_80")
@Test
public void test_aggregates_winFnQry_80()
@ -5435,7 +5427,7 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_COUNT_MISMATCH)
@NotYetSupported(Modes.RESULT_MISMATCH)
@DrillTest("aggregates/winFnQry_81")
@Test
public void test_aggregates_winFnQry_81()
@ -5863,7 +5855,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_COUNT_MISMATCH)
@DrillTest("frameclause/subQueries/frmInSubQry_17")
@Test
public void test_frameclause_subQueries_frmInSubQry_17()
@ -5871,7 +5862,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_COUNT_MISMATCH)
@DrillTest("frameclause/subQueries/frmInSubQry_20")
@Test
public void test_frameclause_subQueries_frmInSubQry_20()
@ -5887,7 +5877,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_COUNT_MISMATCH)
@DrillTest("frameclause/subQueries/frmInSubQry_27")
@Test
public void test_frameclause_subQueries_frmInSubQry_27()
@ -5903,7 +5892,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_COUNT_MISMATCH)
@DrillTest("frameclause/subQueries/frmInSubQry_30")
@Test
public void test_frameclause_subQueries_frmInSubQry_30()
@ -6641,7 +6629,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_MISMATCH)
@DrillTest("frameclause/defaultFrame/RBUPACR_bgint_1")
@Test
public void test_frameclause_defaultFrame_RBUPACR_bgint_1()
@ -6649,7 +6636,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_MISMATCH)
@DrillTest("frameclause/defaultFrame/RBUPACR_bgint_2")
@Test
public void test_frameclause_defaultFrame_RBUPACR_bgint_2()
@ -6657,7 +6643,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_MISMATCH)
@DrillTest("frameclause/defaultFrame/RBUPACR_bgint_3")
@Test
public void test_frameclause_defaultFrame_RBUPACR_bgint_3()
@ -6702,7 +6687,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_MISMATCH)
@DrillTest("frameclause/defaultFrame/RBUPACR_dbl_1")
@Test
public void test_frameclause_defaultFrame_RBUPACR_dbl_1()
@ -6710,7 +6694,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_MISMATCH)
@DrillTest("frameclause/defaultFrame/RBUPACR_dbl_2")
@Test
public void test_frameclause_defaultFrame_RBUPACR_dbl_2()
@ -6718,7 +6701,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_MISMATCH)
@DrillTest("frameclause/defaultFrame/RBUPACR_dbl_3")
@Test
public void test_frameclause_defaultFrame_RBUPACR_dbl_3()
@ -6741,7 +6723,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_MISMATCH)
@DrillTest("frameclause/defaultFrame/RBUPACR_dt_1")
@Test
public void test_frameclause_defaultFrame_RBUPACR_dt_1()
@ -6749,7 +6730,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_MISMATCH)
@DrillTest("frameclause/defaultFrame/RBUPACR_dt_2")
@Test
public void test_frameclause_defaultFrame_RBUPACR_dt_2()
@ -6772,7 +6752,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_MISMATCH)
@DrillTest("frameclause/defaultFrame/RBUPACR_int10")
@Test
public void test_frameclause_defaultFrame_RBUPACR_int10()
@ -6795,7 +6774,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_MISMATCH)
@DrillTest("frameclause/defaultFrame/RBUPACR_int8")
@Test
public void test_frameclause_defaultFrame_RBUPACR_int8()
@ -6803,7 +6781,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_MISMATCH)
@DrillTest("frameclause/defaultFrame/RBUPACR_int9")
@Test
public void test_frameclause_defaultFrame_RBUPACR_int9()
@ -6872,7 +6849,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_MISMATCH)
@DrillTest("frameclause/multipl_wnwds/sum_mulwds")
@Test
public void test_frameclause_multipl_wnwds_sum_mulwds()
@ -7020,7 +6996,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_MISMATCH)
@DrillTest("frameclause/RBUPACR/RBUPACR_bgint_1")
@Test
public void test_frameclause_RBUPACR_RBUPACR_bgint_1()
@ -7028,7 +7003,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_MISMATCH)
@DrillTest("frameclause/RBUPACR/RBUPACR_bgint_2")
@Test
public void test_frameclause_RBUPACR_RBUPACR_bgint_2()
@ -7036,7 +7010,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_MISMATCH)
@DrillTest("frameclause/RBUPACR/RBUPACR_bgint_3")
@Test
public void test_frameclause_RBUPACR_RBUPACR_bgint_3()
@ -7081,7 +7054,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_MISMATCH)
@DrillTest("frameclause/RBUPACR/RBUPACR_dbl_1")
@Test
public void test_frameclause_RBUPACR_RBUPACR_dbl_1()
@ -7089,7 +7061,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_MISMATCH)
@DrillTest("frameclause/RBUPACR/RBUPACR_dbl_2")
@Test
public void test_frameclause_RBUPACR_RBUPACR_dbl_2()
@ -7097,7 +7068,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_MISMATCH)
@DrillTest("frameclause/RBUPACR/RBUPACR_dbl_3")
@Test
public void test_frameclause_RBUPACR_RBUPACR_dbl_3()
@ -7120,7 +7090,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.RESULT_MISMATCH)
@DrillTest("frameclause/RBUPACR/RBUPACR_int10")
@Test
public void test_frameclause_RBUPACR_RBUPACR_int10()
@ -7718,7 +7687,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.T_ALLTYPES_ISSUES)
@DrillTest("frameclause/multipl_wnwds/rnkNoFrm03")
@Test
public void test_frameclause_multipl_wnwds_rnkNoFrm03()
@ -7750,7 +7718,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.T_ALLTYPES_ISSUES)
@DrillTest("frameclause/RBUPACR/RBUPACR_dt_1")
@Test
public void test_frameclause_RBUPACR_RBUPACR_dt_1()
@ -7758,7 +7725,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.T_ALLTYPES_ISSUES)
@DrillTest("frameclause/RBUPACR/RBUPACR_dt_2")
@Test
public void test_frameclause_RBUPACR_RBUPACR_dt_2()
@ -7789,7 +7755,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.T_ALLTYPES_ISSUES)
@DrillTest("frameclause/RBUPACR/RBUPACR_int8")
@Test
public void test_frameclause_RBUPACR_RBUPACR_int8()
@ -7797,7 +7762,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.T_ALLTYPES_ISSUES)
@DrillTest("frameclause/RBUPACR/RBUPACR_int9")
@Test
public void test_frameclause_RBUPACR_RBUPACR_int9()
@ -7861,7 +7825,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.T_ALLTYPES_ISSUES)
@DrillTest("nestedAggs/multiWin_6")
@Test
public void test_nestedAggs_multiWin_6()
@ -7869,7 +7832,6 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
windowQueryTest();
}
@NotYetSupported(Modes.T_ALLTYPES_ISSUES)
@DrillTest("nestedAggs/multiWin_8")
@Test
public void test_nestedAggs_multiWin_8()

View File

@ -2,10 +2,11 @@ type: "operatorValidation"
sql: |
SELECT
l2,
MIN(l2) OVER(partition by l2)
l2,l1,
MIN(l2) OVER(partition by l2),
MIN(l2) OVER(partition by l2 order by l1)
FROM druid.numfoo
WHERE l2 is null or l2 = -1111 or l2 = 0
WHERE (l2 is null or l2 = -1111 or l2 = 0) and (l1 is null or l1 != 7)
expectedOperators:
@ -21,10 +22,21 @@ expectedOperators:
frame: { peerType: "ROWS", lowUnbounded: true, lowOffset: 0, uppUnbounded: true, uppOffset: 0 }
aggregations:
- { type: "longMin", name: "w0", fieldName: "l2" }
- type: "naiveSort"
columns:
- { column: l2, direction: ASC }
- { column: l1, direction: ASC }
- type: "naivePartition"
partitionColumns: [ "l2" ]
- type: "window"
processor:
type: "framedAgg"
frame: { peerType: "ROWS", lowUnbounded: true, lowOffset: 0, uppUnbounded: false, uppOffset: 0 }
aggregations:
- { type: "longMin", name: "w1", fieldName: "l2" }
expectedResults:
- [null,null]
- [null,null]
- [null,null]
- [null,null]
- [0,0]
- [null,null,null,null]
- [null,null,null,null]
- [null,null,null,null]
- [0,0,0,0]

View File

@ -4,4 +4,4 @@ SELECT *
FROM "t_alltype.parquet"
WINDOW W AS ( PARTITION BY c8 ORDER BY c1 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW )
) subQry
WHERE subQry.w_min > '1920-05-14'
WHERE MILLIS_TO_TIMESTAMP(subQry.w_min) > '1920-05-14'