Skip to content

cpp tablet new interface#747

Open
hongzhi-gao wants to merge 1 commit intoapache:developfrom
hongzhi-gao:feature/cpp-tablet-interface
Open

cpp tablet new interface#747
hongzhi-gao wants to merge 1 commit intoapache:developfrom
hongzhi-gao:feature/cpp-tablet-interface

Conversation

@hongzhi-gao
Copy link
Contributor

Add tsfile-cpp tablet new interface

    /**
     * @brief Constructs a Tablet object by taking pre-filled columns.
     *
     * For numeric types, `columns[col_index]` should point to a contiguous
     * array of the corresponding C++ type.
     * For string-like types (TEXT/BLOB/STRING), `columns[col_index]` should
     * point to an array of `common::String` with length `row_num`.
     */
    Tablet(uint32_t column_num, uint32_t row_num, void** columns,
           const std::vector<std::string>& column_names,
           const std::vector<common::TSDataType>& data_types);

    /**
     * @brief Set a whole column buffer at once.
     *
     * @param column_index Schema index of the column to set.
     * @param column A pointer to an array with `column_length` elements.
     *               See the constructor doc for the expected element types.
     * @param column_length Number of rows to copy from `column`.
     */
    int set_column(int column_index, void* column, int column_length);

Comment on lines +86 to +91
case common::BOOLEAN:
memcpy(col_values.bool_data, column, sizeof(bool) * len);
for (uint32_t r = 0; r < len; ++r) {
col_notnull_bitmap.clear(r);
}
break;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to directly assign the pointer instead of a memory copy.

The method should be extremely fast but may be unsafe.

Comment on lines +74 to +82
BitMap& col_notnull_bitmap = bitmaps_[column_index];

if (column == nullptr) {
// Treat as all-null.
for (uint32_t r = 0; r < len; ++r) {
col_notnull_bitmap.set(r);
}
cur_row_size_ = std::max(cur_row_size_, len);
return common::E_OK;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that the bitmap is a null_bitmap.

Comment on lines +178 to +179
* @brief Set a whole column buffer at once.
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mention how cur_row_size is updated after calling this method.

Comment on lines +185 to +186
int set_column(int column_index, void* column, int column_length);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about the time column.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants