]> git.proxmox.com Git - ceph.git/blame - ceph/src/arrow/cpp/src/parquet/hasher.h
import quincy 17.2.0
[ceph.git] / ceph / src / arrow / cpp / src / parquet / hasher.h
CommitLineData
1d09f67e
TL
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 <cstdint>
21#include "parquet/types.h"
22
23namespace parquet {
24// Abstract class for hash
25class Hasher {
26 public:
27 /// Compute hash for 32 bits value by using its plain encoding result.
28 ///
29 /// @param value the value to hash.
30 /// @return hash result.
31 virtual uint64_t Hash(int32_t value) const = 0;
32
33 /// Compute hash for 64 bits value by using its plain encoding result.
34 ///
35 /// @param value the value to hash.
36 /// @return hash result.
37 virtual uint64_t Hash(int64_t value) const = 0;
38
39 /// Compute hash for float value by using its plain encoding result.
40 ///
41 /// @param value the value to hash.
42 /// @return hash result.
43 virtual uint64_t Hash(float value) const = 0;
44
45 /// Compute hash for double value by using its plain encoding result.
46 ///
47 /// @param value the value to hash.
48 /// @return hash result.
49 virtual uint64_t Hash(double value) const = 0;
50
51 /// Compute hash for Int96 value by using its plain encoding result.
52 ///
53 /// @param value the value to hash.
54 /// @return hash result.
55 virtual uint64_t Hash(const Int96* value) const = 0;
56
57 /// Compute hash for ByteArray value by using its plain encoding result.
58 ///
59 /// @param value the value to hash.
60 /// @return hash result.
61 virtual uint64_t Hash(const ByteArray* value) const = 0;
62
63 /// Compute hash for fixed byte array value by using its plain encoding result.
64 ///
65 /// @param value the value address.
66 /// @param len the value length.
67 virtual uint64_t Hash(const FLBA* value, uint32_t len) const = 0;
68
69 virtual ~Hasher() = default;
70};
71
72} // namespace parquet