You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
void print_data_result(DataResult* result) {
printf("result->column_num:%d\n",result->column_num);
std::cout << std::left << std::setw(15) << "timestamp";
for (int i = 0; i < result->column_num; i++) {
std::cout << std::left << std::setw(15)
<< result->column_schema[i]->name;
}
std::cout << std::endl;
for (int i = 0; i < result->cur_num; i++) {
std::cout << std::left << std::setw(15);
std::cout << result->times[i];
for (int j = 0; j < result->column_num; j++) {
ColumnSchema* schema = result->column_schema[j];
double dval;
float fval;
std::cout << std::left << std::setw(15);
switch (get_datatype(schema->column_def)) {
case TSDataType::BOOLEAN:
std::cout
<< ((*((int64_t*)result->value[j] + i)) > 0 ? "true"
: "false");
break;
case TSDataType::INT32:
std::cout << *((int64_t*)result->value[j] + i);
break;
case TSDataType::INT64:
std::cout << *((int64_t*)result->value[j] + i);
break;
case TSDataType::FLOAT:
memcpy(&fval, (int64_t*)result->value[j] + i,
sizeof(float));
std::cout << fval;
break;
case TSDataType::DOUBLE:
memcpy(&dval, (int64_t*)result->value[j] + i,
sizeof(double));
std::cout << dval;
break;
default:
std::cout << "";
}
}
std::cout << std::endl;
}
}
In the code,
case TSDataType::FLOAT:
memcpy(&fval, (int64_t*)result->value[j] + i,
sizeof(float));
std::cout << fval;
directly adds pointers, resulting in 8 bytes being skipped on a 64-bit system instead of the 4 bytes required by the float type. The pointer type needs to be converted before adding pointers.
The current TsFile C++ version is continuously being upgraded and improved, and it requires the help and support of open-source developers. TsFile CPP has already supported TsFile V3, but it has not yet supported TsFile V4, which is currently used by IoTDB and has been implemented in the Java version. The issue pointed out in this case concerns the C interface provided by CPP to the developer, and it will be fixed in the near future.
I think this is a great project. Its position in time series database is like that of sqlite in relational database. A lightweight, in-process, self-sufficient, serverless, zero-configuration time series data file engine is very useful for many scenarios.
In the code,
directly adds pointers, resulting in 8 bytes being skipped on a 64-bit system instead of the 4 bytes required by the float type. The pointer type needs to be converted before adding pointers.
The actual result should be:
But the original code output is:
Obviously half of the data is missing.
In addition, is the CPP/C version still in a very early stage? There are many todos in both the source code and the example code.
The text was updated successfully, but these errors were encountered: