nullable.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #pragma once
  2. #include "column.h"
  3. #include "numeric.h"
  4. namespace NClickHouse {
  5. /**
  6. * Represents column of Nullable(T).
  7. */
  8. class TColumnNullable: public TColumn {
  9. public:
  10. static TIntrusivePtr<TColumnNullable> Create(TColumnRef nested);
  11. static TIntrusivePtr<TColumnNullable> Create(TColumnRef nested, TColumnRef nulls);
  12. /// Returns null flag at given row number.
  13. bool IsNull(size_t n) const;
  14. /// Returns nested column.
  15. TColumnRef Nested() const;
  16. public:
  17. /// Appends content of given column to the end of current one.
  18. void Append(TColumnRef column) override;
  19. /// Loads column data from input stream.
  20. bool Load(TCodedInputStream* input, size_t rows) override;
  21. /// Saves column data to output stream.
  22. void Save(TCodedOutputStream* output) override;
  23. /// Returns count of rows in the column.
  24. size_t Size() const override;
  25. /// Makes slice of the current column.
  26. TColumnRef Slice(size_t begin, size_t len) override;
  27. private:
  28. TColumnNullable(TColumnRef nested, TColumnRef nulls);
  29. TColumnRef Nested_;
  30. TIntrusivePtr<TColumnUInt8> Nulls_;
  31. };
  32. }