jt2594838 commented on code in PR #388: URL: https://github.com/apache/tsfile/pull/388#discussion_r1976783999
########## cpp/src/common/schema.h: ########## @@ -225,6 +225,23 @@ class TableSchema { column_schemas_(std::move(other.column_schemas_)), column_categories_(std::move(other.column_categories_)) {} + + TableSchema(const TableSchema &other) noexcept + : table_name_(other.table_name_), + column_categories_(other.column_categories_) { + for (const auto &column_schema : other.column_schemas_) { + // Just call default construction + column_schemas_.emplace_back( + std::make_shared<MeasurementSchema>(*column_schema)); + } + int idx = 0; + for (const auto &measurement_schema : column_schemas_) { + to_lowercase_inplace(measurement_schema->measurement_name_); + column_pos_index_.insert( + std::make_pair(measurement_schema->measurement_name_, idx++)); Review Comment: Measurement names from an existing schema should already be converted to lower case, so there is no need to convert here. ########## cpp/src/cwrapper/tsfile_cwrapper.cc: ########## @@ -80,8 +80,10 @@ TsFileWriter tsfile_writer_new(WriteFile file, TableSchema *schema, storage::TableSchema *table_schema = new storage::TableSchema(schema->table_name, column_schemas); *err_code = common::E_OK; - return new storage::TsFileTableWriter( + auto table_writer = new storage::TsFileTableWriter( static_cast<storage::WriteFile *>(file), table_schema); + delete table_schema; + return table_writer; Review Comment: Why is table_schema deleted? ########## cpp/src/cwrapper/tsfile_cwrapper.cc: ########## @@ -179,31 +181,30 @@ TABLE_ADD_VALUE_BY_INDEX_DEF(float); TABLE_ADD_VALUE_BY_INDEX_DEF(double); TABLE_ADD_VALUE_BY_INDEX_DEF(bool); -/* // TsRecord API -TsRecord ts_record_new(const char *device_id, Timestamp timestamp, - int timeseries_num) { -auto *record = new storage::TsRecord(timestamp, device_id, -timeseries_num); return record; +TsRecord _ts_record_new(const char *device_id, Timestamp timestamp, + int timeseries_num) { + auto *record = new storage::TsRecord(timestamp, device_id, timeseries_num); + return record; } Review Comment: May add some comment like: "WARN: temporary interface/internal method, compatibility and existence not guaranteed in next versions" -- 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: notifications-unsubscr...@tsfile.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org