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 be047f11aa [BugFix](csv_reader) csv_reader support datev2/datetimev2 
(#17031)
be047f11aa is described below

commit be047f11aa2a9e261453a36c58fdcbfb5854bd35
Author: Tiewei Fang <[email protected]>
AuthorDate: Fri Feb 24 11:13:48 2023 +0800

    [BugFix](csv_reader) csv_reader support datev2/datetimev2 (#17031)
---
 be/src/exec/text_converter.hpp | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/be/src/exec/text_converter.hpp b/be/src/exec/text_converter.hpp
index c66834c3f2..0cdc7501ea 100644
--- a/be/src/exec/text_converter.hpp
+++ b/be/src/exec/text_converter.hpp
@@ -149,7 +149,18 @@ inline bool TextConverter::write_vec_column(const 
SlotDescriptor* slot_desc,
                 reinterpret_cast<char*>(&ts_slot), 0);
         break;
     }
-
+    case TYPE_DATEV2: {
+        vectorized::VecDateTimeValue ts_slot;
+        if (!ts_slot.from_date_str(data, len)) {
+            parse_result = StringParser::PARSE_FAILURE;
+            insert_after_parse_failure = false;
+            break;
+        }
+        ts_slot.cast_to_date();
+        uint32_t num = ts_slot.to_date_v2();
+        
reinterpret_cast<vectorized::ColumnVector<vectorized::UInt32>*>(col_ptr)->insert_value(num);
+        break;
+    }
     case TYPE_DATETIME: {
         vectorized::VecDateTimeValue ts_slot;
         if (!ts_slot.from_date_str(data, len)) {
@@ -162,6 +173,18 @@ inline bool TextConverter::write_vec_column(const 
SlotDescriptor* slot_desc,
                 reinterpret_cast<char*>(&ts_slot), 0);
         break;
     }
+    case TYPE_DATETIMEV2: {
+        vectorized::VecDateTimeValue ts_slot;
+        if (!ts_slot.from_date_str(data, len)) {
+            parse_result = StringParser::PARSE_FAILURE;
+            insert_after_parse_failure = false;
+            break;
+        }
+        ts_slot.to_datetime();
+        uint64_t num = ts_slot.to_datetime_v2();
+        
reinterpret_cast<vectorized::ColumnVector<vectorized::UInt64>*>(col_ptr)->insert_value(num);
+        break;
+    }
 
     case TYPE_DECIMALV2: {
         DecimalV2Value decimal_slot;


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

Reply via email to