1 | /** |
---|---|
2 | * Licensed to the Apache Software Foundation (ASF) under one |
3 | * or more contributor license agreements. See the NOTICE file |
4 | * distributed with this work for additional information |
5 | * regarding copyright ownership. The ASF licenses this file |
6 | * to you under the Apache License, Version 2.0 (the |
7 | * "License"); you may not use this file except in compliance |
8 | * with the License. You may obtain a copy of the License at |
9 | * |
10 | * http://www.apache.org/licenses/LICENSE-2.0 |
11 | * |
12 | * Unless required by applicable law or agreed to in writing, software |
13 | * distributed under the License is distributed on an "AS IS" BASIS, |
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15 | * See the License for the specific language governing permissions and |
16 | * limitations under the License. |
17 | */ |
18 | |
19 | #include "orc/Common.hh" |
20 | |
21 | #include <sstream> |
22 | |
23 | namespace orc { |
24 | |
25 | std::string compressionKindToString(CompressionKind kind) { |
26 | switch (static_cast<int>(kind)) { |
27 | case CompressionKind_NONE: |
28 | return "none"; |
29 | case CompressionKind_ZLIB: |
30 | return "zlib"; |
31 | case CompressionKind_SNAPPY: |
32 | return "snappy"; |
33 | case CompressionKind_LZO: |
34 | return "lzo"; |
35 | case CompressionKind_LZ4: |
36 | return "lz4"; |
37 | case CompressionKind_ZSTD: |
38 | return "zstd"; |
39 | } |
40 | std::stringstream buffer; |
41 | buffer << "unknown - "<< kind; |
42 | return buffer.str(); |
43 | } |
44 | |
45 | std::string writerVersionToString(WriterVersion version) { |
46 | switch (static_cast<int>(version)) { |
47 | case WriterVersion_ORIGINAL: |
48 | return "original"; |
49 | case WriterVersion_HIVE_8732: |
50 | return "HIVE-8732"; |
51 | case WriterVersion_HIVE_4243: |
52 | return "HIVE-4243"; |
53 | case WriterVersion_HIVE_12055: |
54 | return "HIVE-12055"; |
55 | case WriterVersion_HIVE_13083: |
56 | return "HIVE-13083"; |
57 | case WriterVersion_ORC_101: |
58 | return "ORC-101"; |
59 | case WriterVersion_ORC_135: |
60 | return "ORC-135"; |
61 | } |
62 | std::stringstream buffer; |
63 | buffer << "future - "<< version; |
64 | return buffer.str(); |
65 | } |
66 | |
67 | std::string streamKindToString(StreamKind kind) { |
68 | switch (static_cast<int>(kind)) { |
69 | case StreamKind_PRESENT: |
70 | return "present"; |
71 | case StreamKind_DATA: |
72 | return "data"; |
73 | case StreamKind_LENGTH: |
74 | return "length"; |
75 | case StreamKind_DICTIONARY_DATA: |
76 | return "dictionary"; |
77 | case StreamKind_DICTIONARY_COUNT: |
78 | return "dictionary count"; |
79 | case StreamKind_SECONDARY: |
80 | return "secondary"; |
81 | case StreamKind_ROW_INDEX: |
82 | return "index"; |
83 | case StreamKind_BLOOM_FILTER: |
84 | return "bloom"; |
85 | } |
86 | std::stringstream buffer; |
87 | buffer << "unknown - "<< kind; |
88 | return buffer.str(); |
89 | } |
90 | |
91 | std::string columnEncodingKindToString(ColumnEncodingKind kind) { |
92 | switch (static_cast<int>(kind)) { |
93 | case ColumnEncodingKind_DIRECT: |
94 | return "direct"; |
95 | case ColumnEncodingKind_DICTIONARY: |
96 | return "dictionary"; |
97 | case ColumnEncodingKind_DIRECT_V2: |
98 | return "direct rle2"; |
99 | case ColumnEncodingKind_DICTIONARY_V2: |
100 | return "dictionary rle2"; |
101 | } |
102 | std::stringstream buffer; |
103 | buffer << "unknown - "<< kind; |
104 | return buffer.str(); |
105 | } |
106 | |
107 | std::string FileVersion::toString() const { |
108 | std::stringstream ss; |
109 | ss << getMajor() << '.' << getMinor(); |
110 | return ss.str(); |
111 | } |
112 | } |
113 |