morningman commented on code in PR #15386:
URL: https://github.com/apache/doris/pull/15386#discussion_r1058009852


##########
be/src/vec/exec/vjdbc_connector.cpp:
##########
@@ -417,8 +417,19 @@ Status JdbcConnector::_convert_column_data(JNIEnv* env, 
jobject jobj,
         M(TYPE_FLOAT, float, vectorized::ColumnVector<vectorized::Float32>)
         M(TYPE_DOUBLE, double, vectorized::ColumnVector<vectorized::Float64>)
 #undef M
+    case TYPE_CHAR: {
+        std::string data = _jobject_to_string(env, jobj);
+        // Now have test pg and oracle with char(100), if data='abc'
+        // but read string data length is 100, so need trim extral spaces

Review Comment:
   ```suggestion
           // but read string data length is 100, so need trim extra spaces
   ```



##########
be/src/vec/exec/vjdbc_connector.cpp:
##########
@@ -417,8 +417,19 @@ Status JdbcConnector::_convert_column_data(JNIEnv* env, 
jobject jobj,
         M(TYPE_FLOAT, float, vectorized::ColumnVector<vectorized::Float32>)
         M(TYPE_DOUBLE, double, vectorized::ColumnVector<vectorized::Float64>)
 #undef M
+    case TYPE_CHAR: {
+        std::string data = _jobject_to_string(env, jobj);
+        // Now have test pg and oracle with char(100), if data='abc'
+        // but read string data length is 100, so need trim extral spaces
+        if ((_conn_param.table_type == TOdbcTableType::POSTGRESQL) ||
+            (_conn_param.table_type == TOdbcTableType::ORACLE)) {
+            data = data.erase(data.find_last_not_of(' ') + 1);

Review Comment:
   What if there are spaces in user data? like `abc    `?



##########
be/src/vec/exec/vjdbc_connector.cpp:
##########
@@ -417,8 +417,19 @@ Status JdbcConnector::_convert_column_data(JNIEnv* env, 
jobject jobj,
         M(TYPE_FLOAT, float, vectorized::ColumnVector<vectorized::Float32>)
         M(TYPE_DOUBLE, double, vectorized::ColumnVector<vectorized::Float64>)
 #undef M
+    case TYPE_CHAR: {
+        std::string data = _jobject_to_string(env, jobj);
+        // Now have test pg and oracle with char(100), if data='abc'
+        // but read string data length is 100, so need trim extral spaces

Review Comment:
   ```suggestion
           // but read string data length is 100, so need trim extra spaces
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to