ColinLeeo commented on code in PR #739:
URL: https://github.com/apache/tsfile/pull/739#discussion_r2958748539
##########
cpp/src/cwrapper/arrow_c.cc:
##########
@@ -790,69 +682,68 @@ static common::TSDataType ArrowFormatToDataType(const
char* format) {
if (strcmp(format, "f") == 0) return common::FLOAT;
if (strcmp(format, "g") == 0) return common::DOUBLE;
if (strcmp(format, "u") == 0) return common::TEXT;
+ if (strcmp(format, "z") == 0) return common::BLOB;
if (strcmp(format, "tdD") == 0) return common::DATE;
return common::INVALID_DATATYPE;
}
// Convert Arrow C Data Interface struct array to storage::Tablet.
-// The timestamp column (format "tsn:") is used as tablet timestamps;
-// all other columns become tablet data columns.
+// time_col_index specifies which column in the Arrow struct to use as the
+// timestamp column.
+// All other columns become data columns in the Tablet.
// reg_schema: optional registered TableSchema; when provided its column types
// are used in the Tablet (so they match the writer's registered schema
-// exactly). Arrow format strings are still used to decode the actual buffers.
+// exactly).
+// Arrow format strings are still used to decode the actual buffers.
int ArrowStructToTablet(const char* table_name, const ArrowArray* in_array,
const ArrowSchema* in_schema,
const storage::TableSchema* reg_schema,
- storage::Tablet** out_tablet) {
+ storage::Tablet** out_tablet, int time_col_index) {
if (!in_array || !in_schema || !out_tablet) return common::E_INVALID_ARG;
if (strcmp(in_schema->format, "+s") != 0) return common::E_INVALID_ARG;
int64_t n_rows = in_array->length;
int64_t n_cols = in_schema->n_children;
if (n_rows <= 0 || n_cols == 0) return common::E_INVALID_ARG;
- int time_col_idx = -1;
+ if (time_col_index < 0 || time_col_index >= n_cols)
+ return common::E_INVALID_ARG;
Review Comment:
The time_column_index should be set by caller.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]