diff --git a/crash-repro/main.cc b/crash-repro/main.cc index ec51fbfa0286d..871cc033f139d 100644 --- a/crash-repro/main.cc +++ b/crash-repro/main.cc @@ -29,41 +29,30 @@ template -arrow::Result> make_numeric_array() { //std::vector values) { +arrow::Result> make_numeric_array(std::vector values) { using TypeClass = typename arrow::CTypeTraits::ArrowType; - std::vector values = {1, 2, 3}; std::cout << "create builder" << std::endl; arrow::NumericBuilder builder; std::cout << "append values" << std::endl; ARROW_RETURN_NOT_OK(builder.AppendValues(values)); - std::cout << "done values" << std::endl; + std::cout << "done values" << std::endl; std::shared_ptr array; ARROW_RETURN_NOT_OK(builder.Finish(&array)); - std::cout << "finish" << std::endl; + std::cout << "finish" << std::endl; return array; } arrow::Result> make_table() { - //std::vector doubleValues = {1, 2, 3, 4}; - //std::vector int32Values = {1, 2, 3, 4}; - std::cout << "1" << std::endl; - auto maybeDoubleArray = make_numeric_array(); //doubleValues); - if (!maybeDoubleArray.ok()) { - std::cout << "Status is : " << maybeDoubleArray.status().message() << std::endl; - } - std::cout << "after check" << std::endl; - - - ARROW_ASSIGN_OR_RAISE(auto doubleArray, maybeDoubleArray); + std::vector doubleValues = {1, 2, 3, 4}; + std::vector int32Values = {1, 2, 3, 4}; - std::cout << "2" << std::endl; + ARROW_ASSIGN_OR_RAISE(auto doubleArray, make_numeric_array(doubleValues)); - ARROW_ASSIGN_OR_RAISE(auto int32Array, make_numeric_array()); //int32Values)); - std::cout << "3" << std::endl; + ARROW_ASSIGN_OR_RAISE(auto int32Array, make_numeric_array(int32Values)); std::vector> columns = {doubleArray, int32Array}; auto tableSchema = arrow::schema({arrow::field("A", doubleArray->type()), arrow::field("B", int32Array->type())}); @@ -89,11 +78,13 @@ int main(int argc, char* argv[]) { std::string filename{argv[1]}; std::cout << "Filename is " << filename << std::endl; - auto maybe_table = make_table(); - std::cout << "4" << std::endl; + auto tableSchema = arrow::schema({arrow::field("A", arrow::int32()), arrow::field("B", arrow::float64())}); + + std::cout << tableSchema->ToString() << std::endl; + //auto maybe_table = make_table(); + - if (!maybe_table.ok()) { return 1; } - std::cout << "5" << std::endl; + //if (!maybe_table.ok()) { return 1; } // auto table = maybe_table.ValueOrDie(); // std::cout << table->ToString() << std::endl;