fix failed uts

This commit is contained in:
taiyang-li 2024-02-29 15:00:09 +08:00
parent f89cb57d02
commit f7d1739808
2 changed files with 21 additions and 17 deletions

View File

@ -418,6 +418,11 @@ private:
PaddedPODArray<S> inserts(rows, static_cast<S>(instructions.size()));
calculateInserts(instructions, rows, inserts);
for (size_t i=0; i<rows; ++i)
{
std::cout << "rows:" << i << ", inserts:" << static_cast<size_t>(inserts[i]) << std::endl;
}
res_data.resize_exact(rows);
if (res_null_map)
res_null_map->resize_exact(rows);
@ -426,23 +431,14 @@ private:
std::vector<const UInt8 *> null_map_cols(instructions.size(), nullptr);
for (size_t i = 0; i < instructions.size(); ++i)
{
if (instructions[i].source->isNullable())
{
const ColumnNullable * nullable_col;
if (!instructions[i].source_is_constant)
nullable_col = assert_cast<const ColumnNullable *>(instructions[i].source.get());
else
{
const ColumnPtr data_column = assert_cast<const ColumnConst &>(*instructions[i].source).getDataColumnPtr();
nullable_col = assert_cast<const ColumnNullable *>(data_column.get());
}
null_map_cols[i] = assert_cast<const ColumnUInt8 &>(*nullable_col->getNullMapColumnPtr()).getData().data();
data_cols[i] = assert_cast<const ColumnVectorOrDecimal<T> &>(*nullable_col->getNestedColumnPtr()).getData().data();
}
else
{
data_cols[i] = assert_cast<const ColumnVectorOrDecimal<T> &>(*instructions[i].source).getData().data();
}
auto & instruction = instructions[i];
const IColumn * non_const_col = instructions[i].source_is_constant
? &assert_cast<const ColumnConst &>(*instruction.source).getDataColumn()
: instruction.source.get();
const ColumnNullable * nullable_col = checkAndGetColumn<ColumnNullable>(non_const_col);
data_cols[i] = nullable_col ? assert_cast<const ColumnVectorOrDecimal<T> &>(nullable_col->getNestedColumn()).getData().data()
: assert_cast<const ColumnVectorOrDecimal<T> &>(*non_const_col).getData().data();
null_map_cols[i] = nullable_col ? assert_cast<const ColumnUInt8 &>(nullable_col->getNullMapColumn()).getData().data() : nullptr;
}
std::unique_ptr<PaddedPODArray<UInt8>> shared_null_map;

View File

@ -5,4 +5,12 @@
<query>select count(1) from test_multiif_t where multiIf(d > 2, d-2, d > 1, d-1, d >0, d, 0) > 1 SETTINGS max_threads=1</query>
<drop_query>DROP TABLE IF EXISTS test_multiif_t</drop_query>
<!-- Test multiIf with decimal inputs -->
<query>SELECT count() FROM zeros(10000000) WHERE NOT ignore(multiIf( rand(1) % 2 = 0, materialize(1::Nullable(Decimal256(3))), rand(2) % 2 = 0, materialize(2::Nullable(Decimal256(3))), rand(3) % 2 = 0, materialize(3::Nullable(Decimal256(3))), rand(4) % 2 = 0, materialize(4::Nullable(Decimal256(3))), rand(5) % 2 = 0, materialize(5::Nullable(Decimal256(3))), materialize(6::Nullable(Decimal256(3)))))</query>
<query>SELECT count() FROM zeros(10000000) WHERE NOT ignore(multiIf( rand(1) % 2 = 0, materialize(1::Decimal256(3)), rand(2) % 2 = 0, materialize(2::Decimal256(3)), rand(3) % 2 = 0, materialize(3::Decimal256(3)), rand(4) % 2 = 0, materialize(4::Decimal256(3)), rand(5) % 2 = 0, materialize(5::Decimal256(3)), materialize(6::Decimal256(3))))</query>
<!-- Test multiIf with integer inputs -->
<query>SELECT count() FROM zeros(10000000) WHERE NOT ignore(multiIf(rand() % 2 = 0, rand()+2, rand() % 3 = 0, rand()+3, rand() % 4 = 0, rand()+4, rand() % 5 = 0, rand() + 5, rand() % 6 = 0, rand() + 6, rand()))</query>
</test>