| 169 | } // namespace |
| 170 | |
| 171 | arrow::Result<std::shared_ptr<DataType>> GetArrowType(const char* sqlite_type) { |
| 172 | if (sqlite_type == nullptr || std::strlen(sqlite_type) == 0) { |
| 173 | // SQLite may not know the column type yet. |
| 174 | return null(); |
| 175 | } |
| 176 | |
| 177 | if (boost::iequals(sqlite_type, "int") || boost::iequals(sqlite_type, "integer")) { |
| 178 | return int64(); |
| 179 | } else if (boost::iequals(sqlite_type, "REAL")) { |
| 180 | return float64(); |
| 181 | } else if (boost::iequals(sqlite_type, "BLOB")) { |
| 182 | return binary(); |
| 183 | } else if (boost::iequals(sqlite_type, "TEXT") || boost::iequals(sqlite_type, "DATE") || |
| 184 | boost::istarts_with(sqlite_type, "char") || |
| 185 | boost::istarts_with(sqlite_type, "varchar")) { |
| 186 | return utf8(); |
| 187 | } |
| 188 | return Status::Invalid("Invalid SQLite type: ", sqlite_type); |
| 189 | } |
| 190 | |
| 191 | int32_t GetSqlTypeFromTypeName(const char* sqlite_type) { |
| 192 | if (sqlite_type == NULLPTR) { |