В примере веб-сайта вектор схемы определен как
Код: Выделить всё
std::vector schema_vector = {
arrow::field("id", arrow::int64()),
arrow::field("components", arrow::int64()),
arrow::field("component_cost", arrow::list(arrow::float64()))
};
Код: Выделить всё
"fields": {"PrimitiveType": { "field_info": { "name": "item", "repetition": "Optional", "id": null }, "logical_type": null, "converted_type": null, "physical_type": "Double" } }
В моем случае, если я хочу убедитесь, что повторение элемента требуется в массиве списка, и я попробовал следующее, чтобы вывести паркет на мой локальный диск (т. е. я изменил «schema_vector» по сравнению с приведенным выше, используемым в Apache веб-сайт Стрелы)
Код: Выделить всё
std::vector schema_vector = {
arrow::field("id", arrow::int64()),
arrow::field("components", arrow::int64()),
arrow::field("component_cost", arrow::list(arrow::field("item", arrow::float64(), false)))
};
auto schema = std::make_shared(schema_vector);
std::shared_ptr table = arrow::Table::Make(schema, {id_array, components_array, component_cost_array});
auto file_path = "C:/my_example/example.parquet";
PARQUET_ASSIGN_OR_THROW(outfile, arrow::io::FileOutputStream::Open(file_path.string()));
PARQUET_THROW_NOT_OK(parquet::arrow::WriteTable(*table, arrow::default_memory_pool(), outfile));
Любые предложения вот, большое спасибо!!!
Я попробовал описанный выше способ, и он не сработал.
Я просто хотел бы вывести файл паркета на свой локальный диск, где будет находиться схема для элемента списка в «comComponent_cost».
Код: Выделить всё
"fields": { "PrimitiveType": { "field_info": { "name": "item", "repetition": "Required", "id": null }, "logical_type": null, "converted_type": null, "physical_type": "Double" } }
Подробнее здесь: https://stackoverflow.com/questions/783 ... n-required