blob: 477bfd3b4c86a079fedeb608e77ba24d382a1d6d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "orc/Common.hh"
#include <sstream>
namespace orc {
std::string compressionKindToString(CompressionKind kind) {
switch (static_cast<int>(kind)) {
case CompressionKind_NONE:
return "none";
case CompressionKind_ZLIB:
return "zlib";
case CompressionKind_SNAPPY:
return "snappy";
case CompressionKind_LZO:
return "lzo";
case CompressionKind_LZ4:
return "lz4";
case CompressionKind_ZSTD:
return "zstd";
}
std::stringstream buffer;
buffer << "unknown - " << kind;
return buffer.str();
}
std::string writerVersionToString(WriterVersion version) {
switch (static_cast<int>(version)) {
case WriterVersion_ORIGINAL:
return "original";
case WriterVersion_HIVE_8732:
return "HIVE-8732";
case WriterVersion_HIVE_4243:
return "HIVE-4243";
case WriterVersion_HIVE_12055:
return "HIVE-12055";
case WriterVersion_HIVE_13083:
return "HIVE-13083";
case WriterVersion_ORC_101:
return "ORC-101";
case WriterVersion_ORC_135:
return "ORC-135";
case WriterVersion_ORC_517:
return "ORC-517";
case WriterVersion_ORC_203:
return "ORC-203";
case WriterVersion_ORC_14:
return "ORC-14";
}
std::stringstream buffer;
buffer << "future - " << version;
return buffer.str();
}
std::string writerIdToString(uint32_t id) {
switch (id) {
case ORC_JAVA_WRITER:
return "ORC Java";
case ORC_CPP_WRITER:
return "ORC C++";
case PRESTO_WRITER:
return "Presto";
case SCRITCHLEY_GO:
return "Scritchley Go";
case TRINO_WRITER:
return "Trino";
default: {
std::ostringstream buffer;
buffer << "Unknown(" << id << ")";
return buffer.str();
}
}
}
std::string streamKindToString(StreamKind kind) {
switch (static_cast<int>(kind)) {
case StreamKind_PRESENT:
return "present";
case StreamKind_DATA:
return "data";
case StreamKind_LENGTH:
return "length";
case StreamKind_DICTIONARY_DATA:
return "dictionary";
case StreamKind_DICTIONARY_COUNT:
return "dictionary count";
case StreamKind_SECONDARY:
return "secondary";
case StreamKind_ROW_INDEX:
return "index";
case StreamKind_BLOOM_FILTER:
return "bloom";
}
std::stringstream buffer;
buffer << "unknown - " << kind;
return buffer.str();
}
std::string columnEncodingKindToString(ColumnEncodingKind kind) {
switch (static_cast<int>(kind)) {
case ColumnEncodingKind_DIRECT:
return "direct";
case ColumnEncodingKind_DICTIONARY:
return "dictionary";
case ColumnEncodingKind_DIRECT_V2:
return "direct rle2";
case ColumnEncodingKind_DICTIONARY_V2:
return "dictionary rle2";
}
std::stringstream buffer;
buffer << "unknown - " << kind;
return buffer.str();
}
std::string FileVersion::toString() const {
if (majorVersion == 1 && minorVersion == 9999) {
return "UNSTABLE-PRE-2.0";
}
std::stringstream ss;
ss << majorVersion << '.' << minorVersion;
return ss.str();
}
const FileVersion& FileVersion::v_0_11(){
static FileVersion version(0,11);
return version;
}
const FileVersion& FileVersion::v_0_12(){
static FileVersion version(0,12);
return version;
}
/**
* Do not use this format except for testing. It will not be compatible
* with other versions of the software. While we iterate on the ORC 2.0
* format, we will make incompatible format changes under this version
* without providing any forward or backward compatibility.
*
* When 2.0 is released, this version identifier will be completely removed.
*/
const FileVersion& FileVersion::UNSTABLE_PRE_2_0() {
static FileVersion version(1, 9999);
return version;
}
}
|