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

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


The following commit(s) were added to refs/heads/master by this push:
     new 921e8192b2 [fix](multi-catalog) fix hana jdbc catalog insert error 
(#17838)
921e8192b2 is described below

commit 921e8192b247de97e79b37d048aa5e6a492a7ab4
Author: yongkang.zhong <[email protected]>
AuthorDate: Thu Mar 16 07:25:19 2023 +0800

    [fix](multi-catalog) fix hana jdbc catalog insert error (#17838)
---
 be/src/exec/table_connector.cpp | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/be/src/exec/table_connector.cpp b/be/src/exec/table_connector.cpp
index ddaa76f618..0062dd37fa 100644
--- a/be/src/exec/table_connector.cpp
+++ b/be/src/exec/table_connector.cpp
@@ -169,7 +169,7 @@ Status TableConnector::convert_column_data(const 
vectorized::ColumnPtr& column_p
                                            const TypeDescriptor& type, int row,
                                            TOdbcTableType::type table_type) {
     auto extra_convert_func = [&](const std::string_view& str, const bool& 
is_date) -> void {
-        if (table_type != TOdbcTableType::ORACLE) {
+        if (table_type != TOdbcTableType::ORACLE && table_type != 
TOdbcTableType::SAP_HANA) {
             fmt::format_to(_insert_stmt_buffer, "\"{}\"", str);
         } else {
             //if is ORACLE and date type, insert into need convert
@@ -194,6 +194,12 @@ Status TableConnector::convert_column_data(const 
vectorized::ColumnPtr& column_p
     auto [item, size] = column->get_data_at(row);
     switch (type.type) {
     case TYPE_BOOLEAN:
+        if (table_type == TOdbcTableType::SAP_HANA) {
+            fmt::format_to(_insert_stmt_buffer, "{}", *reinterpret_cast<const 
bool*>(item));
+        } else {
+            fmt::format_to(_insert_stmt_buffer, "{}", *reinterpret_cast<const 
int8_t*>(item));
+        }
+        break;
     case TYPE_TINYINT:
         fmt::format_to(_insert_stmt_buffer, "{}", *reinterpret_cast<const 
int8_t*>(item));
         break;
@@ -260,7 +266,8 @@ Status TableConnector::convert_column_data(const 
vectorized::ColumnPtr& column_p
     case TYPE_STRING: {
         // TODO(zhangstar333): check array data type of postgresql
         // for oracle/pg database string must be '
-        if (table_type == TOdbcTableType::ORACLE || table_type == 
TOdbcTableType::POSTGRESQL) {
+        if (table_type == TOdbcTableType::ORACLE || table_type == 
TOdbcTableType::POSTGRESQL ||
+            table_type == TOdbcTableType::SAP_HANA) {
             fmt::format_to(_insert_stmt_buffer, "'{}'", 
fmt::basic_string_view(item, size));
         } else {
             fmt::format_to(_insert_stmt_buffer, "\"{}\"", 
fmt::basic_string_view(item, size));


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to