| 26 | namespace r { |
| 27 | |
| 28 | static inline std::shared_ptr<arrow::DataType> IndexTypeForFactors(int n_factors) { |
| 29 | if (n_factors < INT8_MAX) { |
| 30 | return arrow::int8(); |
| 31 | } else if (n_factors < INT16_MAX) { |
| 32 | return arrow::int16(); |
| 33 | } else { |
| 34 | return arrow::int32(); |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | std::shared_ptr<arrow::DataType> InferArrowTypeFromFactor(SEXP factor) { |
| 39 | SEXP factors = Rf_getAttrib(factor, R_LevelsSymbol); |
no outgoing calls
no test coverage detected