Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support C wrapper for tsfile v4. #387

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from

Conversation

ColinLeeo
Copy link
Contributor

No description provided.

/*--------------------------TsFile Writer Register------------------------ */
void tsfile_writer_register_table(TsFileWriter writer, TableSchema* schema);
ERRNO tsfile_writer_register_timeseries(TsFileWriter writer,
const char* device_name,
Copy link
Contributor

Choose a reason for hiding this comment

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

device_name -> device_id

TableSchema tsfile_reader_get_table_schema(TsFileReader reader,
const char* table_name);
DeviceSchema tsfile_reader_get_timeseries_schema(TsFileReader reader, const char* device_id);

Copy link
Contributor

Choose a reason for hiding this comment

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

TableSchema* tsfile_reader_get_all_table_schemas(TsFileReader reader, uint32_t* size)

// destroy pointer
ERRNO destroy_tsfile_ts_record(TsRecord record);
ERRNO destroy_tablet(Tablet tablet);
void destroy_tsfile_result_set(ResultSet result_set);
Copy link
Contributor

Choose a reason for hiding this comment

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

The operation name on ResultSet is more often "close" rather than "destroy."

/*--------------------------TsFile Reader and Writer------------------------ */
TsFileReader tsfile_reader_new(const char* pathname, ERRNO* err_code);
TsFileWriter tsfile_writer_new(const char* pathname, ERRNO* err_code);
TsFileWriter tsfile_writer_open_conf(const char* pathname, mode_t flag,
Copy link
Contributor

Choose a reason for hiding this comment

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

tsfile_writer_new_with_conf?

auto reader = new storage::TsFileReader();
int ret = reader->open(pathname);
if (ret != common::E_OK) {
std::cout << "open file failed" << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove or replace with LOG and add in other functions.

Comment on lines +175 to +181
Expression* and_filter_to_and_query(Expression* exp_and, Expression* exp) {
if (exp_and->children_length >= MAX_COLUMN_FILTER_NUM - 1) {
return nullptr;
}
exp_and->children[exp_and->children_length++] = exp;
return exp_and;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

and_filter_to_and_query -> add_filter_to_and_filter

} ExpressionType;

typedef struct constant {
int64_t value_condition;
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 using a union?

char** column_names;
int column_num;
QueryDataRetINTERNAL data;
}* QueryDataRet;
Copy link
Contributor

Choose a reason for hiding this comment

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

QueryDataRet -> ResultSet

int children_length;
} Expression;

typedef Tablet DataResult;
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this for?

Comment on lines +116 to +121
for (int i = 0; i < measurement_num - 1; i++) {
ASSERT_TRUE(tsfile_result_set_has_next(result_set));
ASSERT_FALSE(tsfile_result_set_is_null_by_index(result_set,i));
ASSERT_EQ(tsfile_result_set_get_value_by_index_int64_t(result_set, i), i*2);
ASSERT_EQ(tsfile_result_set_get_value_by_name_int64_t(result_set, std::string("measurement" + std::to_string(i)).c_str()), i*2);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Better to check the whole data set

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