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+
18+ #include < gtest/gtest.h>
19+
20+ #include " runtime/decimalv2_value.h"
21+ #include " runtime/primitive_type.h"
22+ #include " testutil/column_helper.h"
23+ #include " vec/columns/column.h"
24+ #include " vec/columns/column_array.h"
25+ #include " vec/columns/column_const.h"
26+ #include " vec/data_types/data_type_number.h"
27+ #include " vec/functions/function.h"
28+ #include " vec/runtime/vdatetime_value.h"
29+
30+ namespace doris ::vectorized {
31+
32+ template <typename T>
33+ void test_for_type () {
34+ PaddedPODArray<T> arr;
35+ for (int i = 0 ; i < 100 ; ++i) {
36+ arr.push_back (T {});
37+ }
38+ arr.resize (1000 );
39+ for (int i = 0 ; i < 100 ; ++i) {
40+ EXPECT_EQ (T {}, arr[i]);
41+ }
42+ }
43+
44+ TEST (PodArrayTypeTest, test) {
45+ test_for_type<int8_t >();
46+ test_for_type<int16_t >();
47+ test_for_type<int32_t >();
48+ test_for_type<int64_t >();
49+ test_for_type<uint8_t >();
50+ test_for_type<uint16_t >();
51+ test_for_type<uint32_t >();
52+ test_for_type<uint64_t >();
53+ test_for_type<float >();
54+ test_for_type<double >();
55+ test_for_type<VecDateTimeValue>();
56+ test_for_type<DateV2Value<DateV2ValueType>>();
57+ test_for_type<DateV2Value<DateTimeV2ValueType>>();
58+ test_for_type<DecimalV2Value>();
59+ test_for_type<Decimal32>();
60+ test_for_type<Decimal64>();
61+ test_for_type<Decimal128V2>();
62+ test_for_type<Decimal128V3>();
63+ test_for_type<Decimal256>();
64+ }
65+
66+ } // namespace doris::vectorized
0 commit comments