Skip to content

Commit

Permalink
Merge branch 'develop' into fix_large_page_read_and_bitmap_index
Browse files Browse the repository at this point in the history
  • Loading branch information
jt2594838 committed Mar 3, 2025
2 parents b4cd050 + 5ab2840 commit 49edd00
Show file tree
Hide file tree
Showing 43 changed files with 3,045 additions and 1,042 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unit-test-cpp-py.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
- name: Build and test with Maven
shell: bash
run: |
./mvnw${{ steps.platform_suffix.outputs.platform_suffix }} -P with-cpp clean verify
./mvnw${{ steps.platform_suffix.outputs.platform_suffix }} -P with-cpp,with-python clean verify
- name: Upload whl Artifact
uses: actions/upload-artifact@v4
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ python/tsfile/*.h
python/tsfile/*.cpp
python/data
python/venv/*
python/tests/__pycache__/*
python/tests/*.tsfile
cpp/cmake-build-debug-mingw/

.vscode/
Expand Down
24 changes: 19 additions & 5 deletions cpp/src/common/schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ struct MeasurementSchemaGroup {
*/
class TableSchema {
public:

TableSchema() = default;

/**
Expand All @@ -184,7 +183,8 @@ class TableSchema {
* in the table.
*/
TableSchema(const std::string &table_name,
const std::vector<common::ColumnSchema> &column_schemas):table_name_(table_name) {
const std::vector<common::ColumnSchema> &column_schemas)
: table_name_(table_name) {
to_lowercase_inplace(table_name_);
for (const common::ColumnSchema &column_schema : column_schemas) {
column_schemas_.emplace_back(std::make_shared<MeasurementSchema>(
Expand Down Expand Up @@ -225,6 +225,22 @@ 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_) {
column_pos_index_.insert(
std::make_pair(measurement_schema->measurement_name_, idx++));
}
}

int serialize_to(common::ByteStream &out) {
int ret = common::E_OK;
if (RET_FAIL(common::SerializationUtil::write_var_uint(
Expand Down Expand Up @@ -280,9 +296,7 @@ class TableSchema {
return ret;
}

int32_t get_columns_num() const {
return column_schemas_.size();
}
int32_t get_columns_num() const { return column_schemas_.size(); }

int find_column_index(const std::string &column_name) {
std::string lower_case_column_name = to_lower(column_name);
Expand Down
16 changes: 11 additions & 5 deletions cpp/src/common/tablet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ namespace storage {
int Tablet::init() {
ASSERT(timestamps_ == nullptr);
timestamps_ = (int64_t *)malloc(sizeof(int64_t) * max_row_num_);
cur_row_size_ = 0;

size_t schema_count = schema_vec_->size();
std::pair<std::map<std::string, int>::iterator, bool> ins_res;
Expand Down Expand Up @@ -137,6 +138,7 @@ int Tablet::add_timestamp(uint32_t row_index, int64_t timestamp) {
}
timestamps_[row_index] = timestamp;
cur_row_size_ = std::max(row_index + 1, cur_row_size_);

return E_OK;
}

Expand Down Expand Up @@ -257,6 +259,12 @@ int Tablet::add_value(uint32_t row_index, uint32_t schema_index,
return ret;
}

template <>
int Tablet::add_value(uint32_t row_index, uint32_t schema_index,
const char *val) {
return add_value(row_index, schema_index, String(val));
}

template <typename T>
int Tablet::add_value(uint32_t row_index, const std::string &measurement_name,
T val) {
Expand All @@ -271,10 +279,9 @@ int Tablet::add_value(uint32_t row_index, const std::string &measurement_name,
return ret;
}

template<>
int Tablet::add_value(uint32_t row_index,
const std::string &measurement_name,
const char *val) {
template <>
int Tablet::add_value(uint32_t row_index, const std::string &measurement_name,
const char *val) {
return add_value(row_index, measurement_name, String(val));
}

Expand Down Expand Up @@ -304,7 +311,6 @@ template int Tablet::add_value(uint32_t row_index,
template int Tablet::add_value(uint32_t row_index,
const std::string &measurement_name, String val);


void Tablet::set_column_categories(
const std::vector<ColumnCategory> &column_categories) {
column_categories_ = column_categories;
Expand Down
Loading

0 comments on commit 49edd00

Please sign in to comment.