/root/doris/be/src/util/io_helper.cpp
Line | Count | Source |
1 | | // Licensed to the Apache Software Foundation (ASF) under one |
2 | | // or more contributor license agreements. See the NOTICE file |
3 | | // distributed with this work for additional information |
4 | | // regarding copyright ownership. The ASF licenses this file |
5 | | // to you under the Apache License, Version 2.0 (the |
6 | | // "License"); you may not use this file except in compliance |
7 | | // with the License. You may obtain a copy of the License at |
8 | | // |
9 | | // http://www.apache.org/licenses/LICENSE-2.0 |
10 | | // |
11 | | // Unless required by applicable law or agreed to in writing, |
12 | | // software distributed under the License is distributed on an |
13 | | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
14 | | // KIND, either express or implied. See the License for the |
15 | | // specific language governing permissions and limitations |
16 | | // under the License. |
17 | | // This file is copied from |
18 | | // https://github.com/ClickHouse/ClickHouse/blob/master/src/Functions/registerFunctionsComparison.cpp |
19 | | // and modified by Doris |
20 | | |
21 | | #include "util/io_helper.h" |
22 | | |
23 | | namespace doris { |
24 | 29.7k | bool read_date_text_impl(VecDateTimeValue& x, const StringRef& buf) { |
25 | 29.7k | auto ans = x.from_date_str(buf.data, buf.size); |
26 | 29.7k | x.cast_to_date(); |
27 | 29.7k | return ans; |
28 | 29.7k | } |
29 | | |
30 | 35.8k | bool read_datetime_text_impl(VecDateTimeValue& x, const StringRef& buf) { |
31 | 35.8k | auto ans = x.from_date_str(buf.data, buf.size); |
32 | 35.8k | x.to_datetime(); |
33 | 35.8k | return ans; |
34 | 35.8k | } |
35 | | |
36 | 25.6k | bool read_date_v2_text_impl(DateV2Value<DateV2ValueType>& x, const StringRef& buf) { |
37 | 25.6k | return x.from_date_str(buf.data, (int)buf.size, config::allow_zero_date); |
38 | 25.6k | } |
39 | | |
40 | | bool read_date_v2_text_impl(DateV2Value<DateV2ValueType>& x, const StringRef& buf, |
41 | 0 | const cctz::time_zone& local_time_zone) { |
42 | 0 | return x.from_date_str(buf.data, buf.size, local_time_zone, config::allow_zero_date); |
43 | 0 | } |
44 | | |
45 | | bool read_datetime_v2_text_impl(DateV2Value<DateTimeV2ValueType>& x, const StringRef& buf, |
46 | 142k | UInt32 scale) { |
47 | 142k | return x.from_date_str(buf.data, (int)buf.size, scale, config::allow_zero_date); |
48 | 142k | } |
49 | | |
50 | | bool read_datetime_v2_text_impl(DateV2Value<DateTimeV2ValueType>& x, const StringRef& buf, |
51 | 0 | const cctz::time_zone& local_time_zone, UInt32 scale) { |
52 | 0 | return x.from_date_str(buf.data, buf.size, local_time_zone, scale, config::allow_zero_date); |
53 | 0 | } |
54 | | |
55 | | } // namespace doris |