761417898 commented on code in PR #345:
URL: https://github.com/apache/tsfile/pull/345#discussion_r1900354375


##########
cpp/src/common/schema.h:
##########
@@ -84,5 +113,147 @@ struct MeasurementSchemaGroup {
     TimeChunkWriter *time_chunk_writer_ = nullptr;
 };
 
+enum class ColumnCategory { ID, MEASUREMENT };
+
+class TableSchema {
+   public:
+    TableSchema() = default;
+    TableSchema(const std::string &table_name,
+                const std::vector<std::shared_ptr<MeasurementSchema>>
+                    &measurement_schemas,
+                const std::vector<ColumnCategory> &column_categories)
+        : table_name_(table_name),
+          measurement_schemas_(measurement_schemas),
+          column_categories_(column_categories) {
+        int idx = 0;
+        for (auto &measurement_schema : measurement_schemas_) {
+            column_pos_index_.insert(
+                std::make_pair(measurement_schema->measurement_name_, idx++));
+        }
+    }
+
+    TableSchema(TableSchema &&other) noexcept
+        : table_name_(std::move(other.table_name_)),
+          measurement_schemas_(std::move(other.measurement_schemas_)),
+          column_categories_(std::move(other.column_categories_)) {}
+
+    TableSchema(const TableSchema &other) = default;
+
+    int serialize_to(common::ByteStream &out) {
+        int ret = common::E_OK;
+        if (RET_FAIL(common::SerializationUtil::write_var_uint(
+                measurement_schemas_.size(), out))) {
+        } else {
+            for (size_t i = 0; IS_SUCC(ret) && i < measurement_schemas_.size();
+                 i++) {
+                auto column_schema = measurement_schemas_[i];
+                auto column_category = column_categories_[i];
+                // column_schema-
+                common::SerializationUtil::write_i32(
+                    static_cast<int32_t>(column_category), out);
+            }
+        }
+        return ret;
+    }
+
+    ~TableSchema() = default;
+
+    std::string get_table_name() { return table_name_; }

Review Comment:
   fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to