/root/doris/be/src/runtime/map_value.h
Line | Count | Source (jump to first uncovered line) |
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 | | #pragma once |
19 | | |
20 | | #include <stdint.h> |
21 | | |
22 | | namespace doris { |
23 | | |
24 | | /** |
25 | | * MapValue is for map type in memory |
26 | | */ |
27 | | class MapValue { |
28 | | public: |
29 | | MapValue() = default; |
30 | | |
31 | 0 | explicit MapValue(int32_t length) : _key_data(nullptr), _value_data(nullptr), _length(length) {} |
32 | | |
33 | | MapValue(void* k_data, void* v_data, int32_t length) |
34 | 0 | : _key_data(k_data), _value_data(v_data), _length(length) {} |
35 | | |
36 | 0 | int32_t size() const { return _length; } |
37 | | |
38 | 0 | int32_t length() const { return _length; } |
39 | | |
40 | | void shallow_copy(const MapValue* other); |
41 | | |
42 | 0 | const void* key_data() const { return _key_data; } |
43 | 0 | void* mutable_key_data() const { return _key_data; } |
44 | 0 | const void* value_data() const { return _value_data; } |
45 | 0 | void* mutable_value_data() const { return _value_data; } |
46 | | |
47 | 0 | void set_length(int32_t length) { _length = length; } |
48 | 0 | void set_key(void* data) { _key_data = data; } |
49 | 0 | void set_value(void* data) { _value_data = data; } |
50 | | |
51 | | private: |
52 | | // child column data pointer |
53 | | void* _key_data = nullptr; |
54 | | void* _value_data = nullptr; |
55 | | // length for map size |
56 | | int32_t _length; |
57 | | |
58 | | }; //map-value |
59 | | } // namespace doris |