westonpace commented on code in PR #13426:
URL: https://github.com/apache/arrow/pull/13426#discussion_r931509310
##########
cpp/src/arrow/compute/exec/test_util.cc:
##########
@@ -459,5 +460,40 @@ void PrintTo(const Declaration& decl, std::ostream* os) {
*os << "}";
}
+Result<std::shared_ptr<Table>> MakeRandomTimeSeriesTable(
+ const TableGenerationProperties& properties) {
+ int total_columns = properties.num_columns + 2;
+ std::vector<std::shared_ptr<Array>> columns;
+ columns.reserve(total_columns);
+ arrow::FieldVector field_vector;
+ field_vector.reserve(total_columns);
+
+ field_vector.push_back(field("time", int64()));
+ field_vector.push_back(field("id", int32()));
+ Int64Builder time_column_builder;
+ Int32Builder id_column_builder;
+ for (int64_t time = properties.start; time <= properties.end;
+ time += properties.time_frequency) {
+ for (int32_t id = 0; id < properties.num_ids; id++) {
+ ARROW_RETURN_NOT_OK(time_column_builder.Append(time));
+ ARROW_RETURN_NOT_OK(id_column_builder.Append(id));
+ }
+ }
+
+ int64_t num_rows = time_column_builder.length();
+ columns.push_back(time_column_builder.Finish().ValueOrDie());
+ columns.push_back(id_column_builder.Finish().ValueOrDie());
Review Comment:
```suggestion
ARROW_ASSIGN_OR_RAISE(auto time_column, time_column_builder.Finish());
columns.push_back(std::move(time_column));
ARROW_ASSIGN_OR_RAISE(auto id_column, id_column_builder.Finish());
columns.push_back(std::move(id_column));
```
--
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]