-
Notifications
You must be signed in to change notification settings - Fork 60
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
base: develop
Are you sure you want to change the base?
Conversation
/*--------------------------TsFile Writer Register------------------------ */ | ||
void tsfile_writer_register_table(TsFileWriter writer, TableSchema* schema); | ||
ERRNO tsfile_writer_register_timeseries(TsFileWriter writer, | ||
const char* device_name, |
There was a problem hiding this comment.
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); | ||
|
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
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; | ||
} |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this for?
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); | ||
} |
There was a problem hiding this comment.
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
No description provided.