mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
fix filling of defaults after parsing into sparse columns
This commit is contained in:
parent
2e3145c757
commit
b9f686b47c
@ -9,6 +9,7 @@
|
||||
#include <Columns/ColumnsCommon.h>
|
||||
#include <Columns/ColumnDecimal.h>
|
||||
#include <Columns/ColumnConst.h>
|
||||
#include <Columns/ColumnSparse.h>
|
||||
#include <Columns/FilterDescription.h>
|
||||
|
||||
#include <DataTypes/DataTypesNumber.h>
|
||||
@ -184,7 +185,7 @@ void AddingDefaultsTransform::transform(Chunk & chunk)
|
||||
|
||||
std::unordered_map<size_t, MutableColumnPtr> mixed_columns;
|
||||
|
||||
for (const ColumnWithTypeAndName & column_def : evaluate_block)
|
||||
for (auto & column_def : evaluate_block)
|
||||
{
|
||||
const String & column_name = column_def.name;
|
||||
|
||||
@ -199,6 +200,9 @@ void AddingDefaultsTransform::transform(Chunk & chunk)
|
||||
|
||||
if (!defaults_mask.empty())
|
||||
{
|
||||
column_read.column = recursiveRemoveSparse(column_read.column);
|
||||
column_def.column = recursiveRemoveSparse(column_def.column);
|
||||
|
||||
/// TODO: FixedString
|
||||
if (isColumnedAsNumber(column_read.type) || isDecimal(column_read.type))
|
||||
{
|
||||
|
@ -0,0 +1,4 @@
|
||||
1 false
|
||||
2 false
|
||||
all_1_1_0 Sparse
|
||||
all_2_2_0 Sparse
|
22
tests/queries/0_stateless/03271_parse_sparse_columns_defaults.sh
Executable file
22
tests/queries/0_stateless/03271_parse_sparse_columns_defaults.sh
Executable file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
# shellcheck source=../shell_config.sh
|
||||
. "$CURDIR"/../shell_config.sh
|
||||
|
||||
$CLICKHOUSE_CLIENT --query "
|
||||
DROP TABLE IF EXISTS test_default_bool;
|
||||
|
||||
CREATE TABLE test_default_bool (id Int8, b Bool DEFAULT false)
|
||||
ENGINE = MergeTree ORDER BY id
|
||||
SETTINGS ratio_of_defaults_for_sparse_serialization = 0.9;
|
||||
"
|
||||
|
||||
echo 'INSERT INTO test_default_bool FORMAT CSV 1,\N' | $CLICKHOUSE_CURL -sS "$CLICKHOUSE_URL" --data-binary @-
|
||||
echo 'INSERT INTO test_default_bool FORMAT CSV 2,\N' | $CLICKHOUSE_CURL -sS "$CLICKHOUSE_URL" --data-binary @-
|
||||
|
||||
$CLICKHOUSE_CLIENT --query "
|
||||
SELECT * FROM test_default_bool ORDER BY id;
|
||||
SELECT name, serialization_kind FROM system.parts_columns WHERE database = currentDatabase() AND table = 'test_default_bool' AND column = 'b' AND active;
|
||||
DROP TABLE test_default_bool;
|
||||
"
|
Loading…
Reference in New Issue
Block a user