mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 01:22:04 +00:00
Insert data in column nullable
This commit is contained in:
parent
3340ae66ba
commit
d860b3912b
@ -81,9 +81,18 @@ StringRef ColumnNullable::getDataAt(size_t /*n*/) const
|
|||||||
throw Exception{"Method getDataAt is not supported for " + getName(), ErrorCodes::NOT_IMPLEMENTED};
|
throw Exception{"Method getDataAt is not supported for " + getName(), ErrorCodes::NOT_IMPLEMENTED};
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColumnNullable::insertData(const char * /*pos*/, size_t /*length*/)
|
void ColumnNullable::insertData(const char * pos, size_t length)
|
||||||
{
|
{
|
||||||
throw Exception{"Method insertData is not supported for " + getName(), ErrorCodes::NOT_IMPLEMENTED};
|
if (pos == nullptr)
|
||||||
|
{
|
||||||
|
getNestedColumn().insertDefault();
|
||||||
|
getNullMapData().push_back(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
getNestedColumn().insertData(pos, length);
|
||||||
|
getNullMapData().push_back(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StringRef ColumnNullable::serializeValueIntoArena(size_t n, Arena & arena, char const *& begin) const
|
StringRef ColumnNullable::serializeValueIntoArena(size_t n, Arena & arena, char const *& begin) const
|
||||||
|
@ -51,6 +51,8 @@ public:
|
|||||||
bool getBool(size_t n) const override { return isNullAt(n) ? 0 : nested_column->getBool(n); }
|
bool getBool(size_t n) const override { return isNullAt(n) ? 0 : nested_column->getBool(n); }
|
||||||
UInt64 get64(size_t n) const override { return nested_column->get64(n); }
|
UInt64 get64(size_t n) const override { return nested_column->get64(n); }
|
||||||
StringRef getDataAt(size_t n) const override;
|
StringRef getDataAt(size_t n) const override;
|
||||||
|
|
||||||
|
/// Will insert null value if pos=nullptr
|
||||||
void insertData(const char * pos, size_t length) override;
|
void insertData(const char * pos, size_t length) override;
|
||||||
StringRef serializeValueIntoArena(size_t n, Arena & arena, char const *& begin) const override;
|
StringRef serializeValueIntoArena(size_t n, Arena & arena, char const *& begin) const override;
|
||||||
const char * deserializeAndInsertFromArena(const char * pos) override;
|
const char * deserializeAndInsertFromArena(const char * pos) override;
|
||||||
|
@ -141,6 +141,7 @@ public:
|
|||||||
/// Appends data located in specified memory chunk if it is possible (throws an exception if it cannot be implemented).
|
/// Appends data located in specified memory chunk if it is possible (throws an exception if it cannot be implemented).
|
||||||
/// Is used to optimize some computations (in aggregation, for example).
|
/// Is used to optimize some computations (in aggregation, for example).
|
||||||
/// Parameter length could be ignored if column values have fixed size.
|
/// Parameter length could be ignored if column values have fixed size.
|
||||||
|
/// All data will be inserted as single element
|
||||||
virtual void insertData(const char * pos, size_t length) = 0;
|
virtual void insertData(const char * pos, size_t length) = 0;
|
||||||
|
|
||||||
/// Appends "default value".
|
/// Appends "default value".
|
||||||
|
Loading…
Reference in New Issue
Block a user