| 45 | } |
| 46 | |
| 47 | Result<int64_t> ConvertTimestampValue(const std::shared_ptr<DataType>& in, |
| 48 | const std::shared_ptr<DataType>& out, |
| 49 | int64_t value) { |
| 50 | auto op_factor = |
| 51 | GetTimestampConversion(checked_cast<const TimestampType&>(*in).unit(), |
| 52 | checked_cast<const TimestampType&>(*out).unit()); |
| 53 | |
| 54 | auto op = op_factor.first; |
| 55 | auto factor = op_factor.second; |
| 56 | switch (op) { |
| 57 | case MULTIPLY: |
| 58 | return value * factor; |
| 59 | case DIVIDE: |
| 60 | return value / factor; |
| 61 | } |
| 62 | |
| 63 | // unreachable... |
| 64 | return 0; |
| 65 | } |
| 66 | |
| 67 | } // namespace util |
| 68 | } // namespace arrow |