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

yiguolei pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-1.2-lts by this push:
     new 0ec259b0df [fix](multi-catalog) fix hana jdbc catalog insert error 
(#17838) (#17839)
0ec259b0df is described below

commit 0ec259b0df2130c716042ebd26d1c1ce2aa9af76
Author: yongkang.zhong <zhong...@qq.com>
AuthorDate: Thu Mar 16 11:05:40 2023 +0800

    [fix](multi-catalog) fix hana jdbc catalog insert error (#17838) (#17839)
    
    cherry-pick from #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 c79cf4d63b..534c463571 100644
--- a/be/src/exec/table_connector.cpp
+++ b/be/src/exec/table_connector.cpp
@@ -247,7 +247,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
@@ -272,6 +272,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;
@@ -338,7 +344,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: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to