You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by li...@apache.org on 2022/04/29 12:05:40 UTC

[arrow] branch master updated: ARROW-16408: [C++] Add support for DATE type in SQLite FlightSQL example

This is an automated email from the ASF dual-hosted git repository.

lidavidm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new d6ca3e2e9e ARROW-16408: [C++] Add support for DATE type in SQLite FlightSQL example
d6ca3e2e9e is described below

commit d6ca3e2e9e995ff42df2465484ebf86de853a136
Author: Tom Drabas <dr...@gmail.com>
AuthorDate: Fri Apr 29 08:05:25 2022 -0400

    ARROW-16408: [C++] Add support for DATE type in SQLite FlightSQL example
    
    While it works in the integration tests, some SQLite databases have been created (erroneously) with `DATE` data type (instead of `TEXT`). This minor fix handle this edge case.
    
    Closes #13027 from drabastomek/flight-sqlite-example
    
    Authored-by: Tom Drabas <dr...@gmail.com>
    Signed-off-by: David Li <li...@gmail.com>
---
 cpp/src/arrow/flight/sql/example/sqlite_server.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cpp/src/arrow/flight/sql/example/sqlite_server.cc b/cpp/src/arrow/flight/sql/example/sqlite_server.cc
index 02620e0b22..2105eb5be0 100644
--- a/cpp/src/arrow/flight/sql/example/sqlite_server.cc
+++ b/cpp/src/arrow/flight/sql/example/sqlite_server.cc
@@ -206,7 +206,7 @@ std::shared_ptr<DataType> GetArrowType(const char* sqlite_type) {
     return float64();
   } else if (boost::iequals(sqlite_type, "BLOB")) {
     return binary();
-  } else if (boost::iequals(sqlite_type, "TEXT") ||
+  } else if (boost::iequals(sqlite_type, "TEXT") || boost::iequals(sqlite_type, "DATE") ||
              boost::istarts_with(sqlite_type, "char") ||
              boost::istarts_with(sqlite_type, "varchar")) {
     return utf8();
@@ -227,7 +227,7 @@ int32_t GetSqlTypeFromTypeName(const char* sqlite_type) {
     return SQLITE_FLOAT;
   } else if (boost::iequals(sqlite_type, "BLOB")) {
     return SQLITE_BLOB;
-  } else if (boost::iequals(sqlite_type, "TEXT") ||
+  } else if (boost::iequals(sqlite_type, "TEXT") || boost::iequals(sqlite_type, "DATE") ||
              boost::istarts_with(sqlite_type, "char") ||
              boost::istarts_with(sqlite_type, "varchar")) {
     return SQLITE_TEXT;