fix defaults mismatch size

This commit is contained in:
Alexander Tokmakov 2020-01-09 22:24:29 +03:00
parent 1b97cb3f95
commit 45d0089d3f
3 changed files with 17 additions and 0 deletions

View File

@ -62,6 +62,9 @@ Block AddingDefaultsBlockInputStream::readImpl()
if (evaluate_block.has(column.first))
evaluate_block.erase(column.first);
if (!evaluate_block.columns())
evaluate_block.insert({ColumnConst::create(ColumnUInt8::create(1, 0), res.rows()), std::make_shared<DataTypeUInt8>(), "_dummy"});
evaluateMissingDefaults(evaluate_block, header.getNamesAndTypesList(), column_defaults, context, false);
std::unordered_map<size_t, MutableColumnPtr> mixed_columns;

View File

@ -0,0 +1,4 @@
1 hello
2 test2
42 test42
42 world

View File

@ -0,0 +1,10 @@
DROP TABLE IF EXISTS defaults_all_columns;
CREATE TABLE defaults_all_columns (n UInt8 DEFAULT 42, s String DEFAULT concat('test', CAST(n, 'String'))) ENGINE = Memory;
INSERT INTO defaults_all_columns FORMAT JSONEachRow {"n": 1, "s": "hello"} {};
INSERT INTO defaults_all_columns FORMAT JSONEachRow {"n": 2}, {"s": "world"};
SELECT * FROM defaults_all_columns ORDER BY n, s;
DROP TABLE defaults_all_columns;