MCPcopy Create free account
hub / github.com/apache/arrow / GetArrowType

Function GetArrowType

cpp/src/arrow/flight/sql/example/sqlite_server.cc:175–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 2

GetSchemaMethod · 0.70
ReadNextMethod · 0.70

Calls 3

InvalidFunction · 0.50

Tested by

no test coverage detected