mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-10 16:32:12 +00:00
Fix: check correctly frame bounds for RANGE
This commit is contained in:
parent
66dd0faec8
commit
918571a5ee
@ -91,9 +91,6 @@ void WindowFrame::toString(WriteBuffer & buf) const
|
|||||||
void WindowFrame::checkValid() const
|
void WindowFrame::checkValid() const
|
||||||
{
|
{
|
||||||
// Check the validity of offsets.
|
// Check the validity of offsets.
|
||||||
if (type == WindowFrame::FrameType::ROWS
|
|
||||||
|| type == WindowFrame::FrameType::GROUPS)
|
|
||||||
{
|
|
||||||
if (begin_type == BoundaryType::Offset
|
if (begin_type == BoundaryType::Offset
|
||||||
&& !((begin_offset.getType() == Field::Types::UInt64
|
&& !((begin_offset.getType() == Field::Types::UInt64
|
||||||
|| begin_offset.getType() == Field::Types::Int64)
|
|| begin_offset.getType() == Field::Types::Int64)
|
||||||
@ -119,7 +116,6 @@ void WindowFrame::checkValid() const
|
|||||||
applyVisitor(FieldVisitorToString(), end_offset),
|
applyVisitor(FieldVisitorToString(), end_offset),
|
||||||
end_offset.getType());
|
end_offset.getType());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Check relative positioning of offsets.
|
// Check relative positioning of offsets.
|
||||||
// UNBOUNDED PRECEDING end and UNBOUNDED FOLLOWING start should have been
|
// UNBOUNDED PRECEDING end and UNBOUNDED FOLLOWING start should have been
|
||||||
|
@ -148,7 +148,7 @@ static int compareValuesWithOffsetFloat(const IColumn * _compared_column,
|
|||||||
const auto * reference_column = assert_cast<const ColumnType *>(
|
const auto * reference_column = assert_cast<const ColumnType *>(
|
||||||
_reference_column);
|
_reference_column);
|
||||||
const auto offset = _offset.get<typename ColumnType::ValueType>();
|
const auto offset = _offset.get<typename ColumnType::ValueType>();
|
||||||
assert(offset >= 0);
|
chassert(offset >= 0);
|
||||||
|
|
||||||
const auto compared_value_data = compared_column->getDataAt(compared_row);
|
const auto compared_value_data = compared_column->getDataAt(compared_row);
|
||||||
assert(compared_value_data.size == sizeof(typename ColumnType::ValueType));
|
assert(compared_value_data.size == sizeof(typename ColumnType::ValueType));
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
-- invalid start offset with RANGE
|
||||||
|
SELECT count() OVER (ORDER BY 3.4028234663852886e38 RANGE BETWEEN 0.0 PRECEDING AND UNBOUNDED FOLLOWING); -- { serverError BAD_ARGUMENTS }
|
||||||
|
SELECT count() OVER (ORDER BY 3.4028234663852886e38 RANGE BETWEEN nan PRECEDING AND UNBOUNDED FOLLOWING); -- { serverError BAD_ARGUMENTS }
|
||||||
|
-- invalid end offset with RANGE
|
||||||
|
SELECT count() OVER (ORDER BY 3.4028234663852886e38 RANGE BETWEEN UNBOUNDED PRECEDING AND 0.0 FOLLOWING); -- { serverError BAD_ARGUMENTS }
|
||||||
|
SELECT count() OVER (ORDER BY 3.4028234663852886e38 RANGE BETWEEN UNBOUNDED PRECEDING AND nan FOLLOWING); -- { serverError BAD_ARGUMENTS }
|
Loading…
Reference in New Issue
Block a user