MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / createColumnConst

Method createColumnConst

src/DataTypes/DataTypeNullable.cpp:74–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74MutableColumnConstPtr DataTypeNullable::createColumnConst(size_t size, const Field & field) const
75{
76 if (onlyNull())
77 {
78 auto column = createColumn();
79 column->insert(field);
80 return ColumnConst::create(std::move(column), size);
81 }
82
83 auto column = nested_data_type->createColumn();
84 bool is_null = field.isNull();
85
86 if (is_null)
87 nested_data_type->insertDefaultInto(*column);
88 else
89 column->insert(field);
90
91 auto null_mask = ColumnUInt8::create();
92 null_mask->getData().push_back(is_null ? static_cast<UInt8>(1) : static_cast<UInt8>(0));
93
94 auto res = ColumnNullable::create(std::move(column), std::move(null_mask));
95 return ColumnConst::create(std::move(res), size);
96}
97
98SerializationPtr DataTypeNullable::doGetSerialization(const SerializationInfoSettings & settings) const
99{

Callers

nothing calls this directly

Calls 9

onlyNullFunction · 0.85
createFunction · 0.70
createColumnFunction · 0.50
insertMethod · 0.45
createColumnMethod · 0.45
isNullMethod · 0.45
insertDefaultIntoMethod · 0.45
push_backMethod · 0.45
getDataMethod · 0.45

Tested by

no test coverage detected