| 494 | } |
| 495 | |
| 496 | bool ArrowReader::fillPoint(PointRef& point) |
| 497 | { |
| 498 | |
| 499 | |
| 500 | for(int columnNum = 0; columnNum < m_currentBatch->num_columns(); ++columnNum) |
| 501 | { |
| 502 | // https://arrow.apache.org/docs/cpp/api/array.html#_CPPv4N5arrow5ArrayE |
| 503 | std::shared_ptr<arrow::Array> array = m_currentBatch->column(columnNum); |
| 504 | |
| 505 | pdal::Dimension::Id pDimId = m_arrayIds[columnNum]; |
| 506 | switch (array->type_id()) |
| 507 | { |
| 508 | case arrow::Type::DOUBLE: |
| 509 | { |
| 510 | const auto castArray = static_cast<const arrow::DoubleArray*>(array.get()); |
| 511 | point.setField<double>(pDimId, castArray->Value(m_currentBatchPointIndex)); |
| 512 | break; |
| 513 | } |
| 514 | case arrow::Type::FLOAT: |
| 515 | { |
| 516 | const auto castArray = static_cast<const arrow::FloatArray*>(array.get()); |
| 517 | point.setField<float>(pDimId, castArray->Value(m_currentBatchPointIndex)); |
| 518 | break; |
| 519 | } |
| 520 | case arrow::Type::INT8: |
| 521 | { |
| 522 | const auto castArray = static_cast<const arrow::Int8Array*>(array.get()); |
| 523 | point.setField<int8_t>(pDimId, castArray->Value(m_currentBatchPointIndex)); |
| 524 | break; |
| 525 | } |
| 526 | case arrow::Type::UINT8: |
| 527 | { |
| 528 | const auto castArray = static_cast<const arrow::UInt8Array*>(array.get()); |
| 529 | point.setField<uint8_t>(pDimId, castArray->Value(m_currentBatchPointIndex)); |
| 530 | break; |
| 531 | } |
| 532 | case arrow::Type::INT16: |
| 533 | { |
| 534 | const auto castArray = static_cast<const arrow::Int16Array*>(array.get()); |
| 535 | point.setField<int16_t>(pDimId, castArray->Value(m_currentBatchPointIndex)); |
| 536 | break; |
| 537 | } |
| 538 | case arrow::Type::UINT16: |
| 539 | { |
| 540 | const auto castArray = static_cast<const arrow::UInt16Array*>(array.get()); |
| 541 | point.setField<uint16_t>(pDimId, castArray->Value(m_currentBatchPointIndex)); |
| 542 | break; |
| 543 | } |
| 544 | case arrow::Type::INT32: |
| 545 | { |
| 546 | const auto castArray = static_cast<const arrow::Int32Array*>(array.get()); |
| 547 | point.setField<int32_t>(pDimId, castArray->Value(m_currentBatchPointIndex)); |
| 548 | break; |
| 549 | } |
| 550 | case arrow::Type::UINT32: |
| 551 | { |
| 552 | const auto castArray = static_cast<const arrow::UInt32Array*>(array.get()); |
| 553 | point.setField<uint32_t>(pDimId, castArray->Value(m_currentBatchPointIndex)); |