aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/clickhouse/client/columns/enum.h
diff options
context:
space:
mode:
authorgalaxycrab <UgnineSirdis@ydb.tech>2023-11-23 11:26:33 +0300
committergalaxycrab <UgnineSirdis@ydb.tech>2023-11-23 12:01:57 +0300
commit44354d0fc55926c1d4510d1d2c9c9f6a1a5e9300 (patch)
treecb4d75cd1c6dbc3da0ed927337fd8d1b6ed9da84 /library/cpp/clickhouse/client/columns/enum.h
parent0e69bf615395fdd48ecee032faaec81bc468b0b8 (diff)
downloadydb-44354d0fc55926c1d4510d1d2c9c9f6a1a5e9300.tar.gz
YQ Connector:test INNER JOIN
Diffstat (limited to 'library/cpp/clickhouse/client/columns/enum.h')
-rw-r--r--library/cpp/clickhouse/client/columns/enum.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/library/cpp/clickhouse/client/columns/enum.h b/library/cpp/clickhouse/client/columns/enum.h
new file mode 100644
index 0000000000..90d773bd9f
--- /dev/null
+++ b/library/cpp/clickhouse/client/columns/enum.h
@@ -0,0 +1,57 @@
+#pragma once
+
+#include "column.h"
+
+namespace NClickHouse {
+ template <typename T>
+ class TColumnEnum: public TColumn {
+ public:
+ static TIntrusivePtr<TColumnEnum<T>> Create(const TVector<TEnumItem>& enumItems);
+ static TIntrusivePtr<TColumnEnum<T>> Create(
+ const TVector<TEnumItem>& enumItems,
+ const TVector<T>& values,
+ bool checkValues = false);
+ static TIntrusivePtr<TColumnEnum<T>> Create(const TVector<TEnumItem>& enumItems, const TVector<TString>& names);
+
+ /// Appends one element to the end of column.
+ void Append(const T& value, bool checkValue = false);
+ void Append(const TString& name);
+
+ /// Returns element at given row number.
+ const T& At(size_t n) const;
+ const TString& NameAt(size_t n) const;
+
+ /// Returns element at given row number.
+ const T& operator[](size_t n) const;
+
+ /// Set element at given row number.
+ void SetAt(size_t n, const T& value, bool checkValue = false);
+ void SetNameAt(size_t n, const TString& name);
+
+ public:
+ /// Appends content of given column to the end of current one.
+ void Append(TColumnRef column) override;
+
+ /// Loads column data from input stream.
+ bool Load(TCodedInputStream* input, size_t rows) override;
+
+ /// Saves column data to output stream.
+ void Save(TCodedOutputStream* output) override;
+
+ /// Returns count of rows in the column.
+ size_t Size() const override;
+
+ /// Makes slice of the current column.
+ TColumnRef Slice(size_t begin, size_t len) override;
+
+ private:
+ TColumnEnum(TTypeRef type);
+ TColumnEnum(TTypeRef type, const TVector<T>& data);
+
+ TVector<T> Data_;
+ };
+
+ using TColumnEnum8 = TColumnEnum<i8>;
+ using TColumnEnum16 = TColumnEnum<i16>;
+
+}