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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
|
/**
* 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 "ConvertColumnReader.hh"
namespace orc {
// Assume that we are using tight numeric vector batch
using BooleanVectorBatch = ByteVectorBatch;
ConvertColumnReader::ConvertColumnReader(const Type& _readType, const Type& fileType,
StripeStreams& stripe, bool _throwOnOverflow)
: ColumnReader(_readType, stripe), readType(_readType), throwOnOverflow(_throwOnOverflow) {
reader = buildReader(fileType, stripe, /*useTightNumericVector=*/true,
/*throwOnOverflow=*/false, /*convertToReadType*/ false);
data =
fileType.createRowBatch(0, memoryPool, /*encoded=*/false, /*useTightNumericVector=*/true);
}
void ConvertColumnReader::next(ColumnVectorBatch& rowBatch, uint64_t numValues, char* notNull) {
reader->next(*data, numValues, notNull);
rowBatch.resize(data->capacity);
rowBatch.numElements = data->numElements;
rowBatch.hasNulls = data->hasNulls;
if (!rowBatch.hasNulls) {
memset(rowBatch.notNull.data(), 1, data->notNull.size());
} else {
memcpy(rowBatch.notNull.data(), data->notNull.data(), data->notNull.size());
}
}
uint64_t ConvertColumnReader::skip(uint64_t numValues) {
return reader->skip(numValues);
}
void ConvertColumnReader::seekToRowGroup(
std::unordered_map<uint64_t, PositionProvider>& positions) {
reader->seekToRowGroup(positions);
}
static inline bool canFitInLong(double value) {
constexpr double MIN_LONG_AS_DOUBLE = -0x1p63;
constexpr double MAX_LONG_AS_DOUBLE_PLUS_ONE = 0x1p63;
return ((MIN_LONG_AS_DOUBLE - value < 1.0) && (value < MAX_LONG_AS_DOUBLE_PLUS_ONE));
}
template <typename FileType, typename ReadType>
static inline void handleOverflow(ColumnVectorBatch& dstBatch, uint64_t idx, bool shouldThrow) {
if (!shouldThrow) {
dstBatch.notNull.data()[idx] = 0;
dstBatch.hasNulls = true;
} else {
std::ostringstream ss;
ss << "Overflow when convert from " << typeid(FileType).name() << " to "
<< typeid(ReadType).name();
throw SchemaEvolutionError(ss.str());
}
}
// return false if overflow
template <typename ReadType>
static bool downCastToInteger(ReadType& dstValue, int64_t inputLong) {
dstValue = static_cast<ReadType>(inputLong);
if constexpr (std::is_same<ReadType, int64_t>::value) {
return true;
}
if (static_cast<int64_t>(dstValue) != inputLong) {
return false;
}
return true;
}
template <typename DestBatchPtrType>
static inline DestBatchPtrType SafeCastBatchTo(ColumnVectorBatch* batch) {
auto result = dynamic_cast<DestBatchPtrType>(batch);
if (result == nullptr) {
std::ostringstream ss;
ss << "Bad cast when convert from ColumnVectorBatch to "
<< typeid(typename std::remove_const<
typename std::remove_pointer<DestBatchPtrType>::type>::type)
.name();
throw InvalidArgument(ss.str());
}
return result;
}
// set null or throw exception if overflow
template <typename ReadType, typename FileType>
static inline void convertNumericElement(const FileType& srcValue, ReadType& destValue,
ColumnVectorBatch& destBatch, uint64_t idx,
bool shouldThrow) {
constexpr bool isFileTypeFloatingPoint(std::is_floating_point<FileType>::value);
constexpr bool isReadTypeFloatingPoint(std::is_floating_point<ReadType>::value);
int64_t longValue = static_cast<int64_t>(srcValue);
if (isFileTypeFloatingPoint) {
if (isReadTypeFloatingPoint) {
destValue = static_cast<ReadType>(srcValue);
} else {
if (!canFitInLong(static_cast<double>(srcValue)) ||
!downCastToInteger(destValue, longValue)) {
handleOverflow<FileType, ReadType>(destBatch, idx, shouldThrow);
}
}
} else {
if (isReadTypeFloatingPoint) {
destValue = static_cast<ReadType>(srcValue);
if (destValue != destValue) { // check is NaN
handleOverflow<FileType, ReadType>(destBatch, idx, shouldThrow);
}
} else {
if (!downCastToInteger(destValue, static_cast<int64_t>(srcValue))) {
handleOverflow<FileType, ReadType>(destBatch, idx, shouldThrow);
}
}
}
}
// { boolean, byte, short, int, long, float, double } ->
// { byte, short, int, long, float, double }
template <typename FileTypeBatch, typename ReadTypeBatch, typename ReadType>
class NumericConvertColumnReader : public ConvertColumnReader {
public:
NumericConvertColumnReader(const Type& _readType, const Type& fileType, StripeStreams& stripe,
bool _throwOnOverflow)
: ConvertColumnReader(_readType, fileType, stripe, _throwOnOverflow) {}
void next(ColumnVectorBatch& rowBatch, uint64_t numValues, char* notNull) override {
ConvertColumnReader::next(rowBatch, numValues, notNull);
const auto& srcBatch = *SafeCastBatchTo<const FileTypeBatch*>(data.get());
auto& dstBatch = *SafeCastBatchTo<ReadTypeBatch*>(&rowBatch);
if (rowBatch.hasNulls) {
for (uint64_t i = 0; i < rowBatch.numElements; ++i) {
if (rowBatch.notNull[i]) {
convertNumericElement<ReadType>(srcBatch.data[i], dstBatch.data[i], rowBatch, i,
throwOnOverflow);
}
}
} else {
for (uint64_t i = 0; i < rowBatch.numElements; ++i) {
convertNumericElement<ReadType>(srcBatch.data[i], dstBatch.data[i], rowBatch, i,
throwOnOverflow);
}
}
}
};
// { boolean, byte, short, int, long, float, double } -> { boolean }
template <typename FileTypeBatch>
class NumericConvertColumnReader<FileTypeBatch, BooleanVectorBatch, bool>
: public ConvertColumnReader {
public:
NumericConvertColumnReader(const Type& _readType, const Type& fileType, StripeStreams& stripe,
bool _throwOnOverflow)
: ConvertColumnReader(_readType, fileType, stripe, _throwOnOverflow) {}
void next(ColumnVectorBatch& rowBatch, uint64_t numValues, char* notNull) override {
ConvertColumnReader::next(rowBatch, numValues, notNull);
const auto& srcBatch = *SafeCastBatchTo<const FileTypeBatch*>(data.get());
auto& dstBatch = *SafeCastBatchTo<BooleanVectorBatch*>(&rowBatch);
if (rowBatch.hasNulls) {
for (uint64_t i = 0; i < rowBatch.numElements; ++i) {
if (rowBatch.notNull[i]) {
dstBatch.data[i] = (static_cast<int64_t>(srcBatch.data[i]) == 0 ? 0 : 1);
}
}
} else {
for (uint64_t i = 0; i < rowBatch.numElements; ++i) {
dstBatch.data[i] = (static_cast<int64_t>(srcBatch.data[i]) == 0 ? 0 : 1);
}
}
}
};
class ConvertToStringVariantColumnReader : public ConvertColumnReader {
public:
ConvertToStringVariantColumnReader(const Type& _readType, const Type& fileType,
StripeStreams& stripe, bool _throwOnOverflow)
: ConvertColumnReader(_readType, fileType, stripe, _throwOnOverflow) {}
void next(ColumnVectorBatch& rowBatch, uint64_t numValues, char* notNull) override;
virtual uint64_t convertToStrBuffer(ColumnVectorBatch& rowBatch, uint64_t numValues) = 0;
protected:
std::vector<std::string> strBuffer;
};
void ConvertToStringVariantColumnReader::next(ColumnVectorBatch& rowBatch, uint64_t numValues,
char* notNull) {
ConvertColumnReader::next(rowBatch, numValues, notNull);
// cache converted string in the buffer
auto totalLength = convertToStrBuffer(rowBatch, numValues);
// contact string values to blob buffer of vector batch
auto& dstBatch = *SafeCastBatchTo<StringVectorBatch*>(&rowBatch);
dstBatch.blob.resize(totalLength);
char* blob = dstBatch.blob.data();
for (uint64_t i = 0; i < numValues; ++i) {
if (!rowBatch.hasNulls || rowBatch.notNull[i]) {
const auto size = strBuffer[i].size();
::memcpy(blob, strBuffer[i].c_str(), size);
dstBatch.data[i] = blob;
dstBatch.length[i] = static_cast<int32_t>(size);
blob += size;
}
}
strBuffer.clear();
}
class BooleanToStringVariantColumnReader : public ConvertToStringVariantColumnReader {
public:
BooleanToStringVariantColumnReader(const Type& _readType, const Type& fileType,
StripeStreams& stripe, bool _throwOnOverflow)
: ConvertToStringVariantColumnReader(_readType, fileType, stripe, _throwOnOverflow) {
trueValue = "TRUE";
falseValue = "FALSE";
if (readType.getKind() == CHAR || readType.getKind() == VARCHAR) {
if (readType.getMaximumLength() < 5) {
throw SchemaEvolutionError("Invalid maximum length for boolean type: " +
std::to_string(readType.getMaximumLength()));
}
if (readType.getKind() == CHAR) {
trueValue.resize(readType.getMaximumLength(), ' ');
falseValue.resize(readType.getMaximumLength(), ' ');
}
}
}
uint64_t convertToStrBuffer(ColumnVectorBatch& rowBatch, uint64_t numValues) override;
private:
std::string trueValue;
std::string falseValue;
};
uint64_t BooleanToStringVariantColumnReader::convertToStrBuffer(ColumnVectorBatch& rowBatch,
uint64_t numValues) {
uint64_t size = 0;
strBuffer.resize(numValues);
const auto& srcBatch = *SafeCastBatchTo<const BooleanVectorBatch*>(data.get());
// cast the bool value to string
for (uint64_t i = 0; i < numValues; ++i) {
if (!rowBatch.hasNulls || rowBatch.notNull[i]) {
strBuffer[i] = (srcBatch.data[i] ? trueValue : falseValue);
size += strBuffer[i].size();
}
}
return size;
}
template <typename FileTypeBatch>
class NumericToStringVariantColumnReader : public ConvertToStringVariantColumnReader {
public:
NumericToStringVariantColumnReader(const Type& _readType, const Type& fileType,
StripeStreams& stripe, bool _throwOnOverflow)
: ConvertToStringVariantColumnReader(_readType, fileType, stripe, _throwOnOverflow) {}
uint64_t convertToStrBuffer(ColumnVectorBatch& rowBatch, uint64_t numValues) override;
};
template <typename FileTypeBatch>
uint64_t NumericToStringVariantColumnReader<FileTypeBatch>::convertToStrBuffer(
ColumnVectorBatch& rowBatch, uint64_t numValues) {
uint64_t size = 0;
strBuffer.resize(numValues);
const auto& srcBatch = *SafeCastBatchTo<const FileTypeBatch*>(data.get());
if (readType.getKind() == STRING) {
for (uint64_t i = 0; i < numValues; ++i) {
if (!rowBatch.hasNulls || rowBatch.notNull[i]) {
strBuffer[i] = std::to_string(srcBatch.data[i]);
size += strBuffer[i].size();
}
}
} else if (readType.getKind() == VARCHAR) {
const auto maxLength = readType.getMaximumLength();
for (uint64_t i = 0; i < numValues; ++i) {
if (!rowBatch.hasNulls || rowBatch.notNull[i]) {
strBuffer[i] = std::to_string(srcBatch.data[i]);
if (strBuffer[i].size() > maxLength) {
handleOverflow<decltype(srcBatch.data[i]), std::string>(rowBatch, i, throwOnOverflow);
} else {
size += strBuffer[i].size();
}
}
}
} else if (readType.getKind() == CHAR) {
const auto maxLength = readType.getMaximumLength();
for (uint64_t i = 0; i < numValues; ++i) {
if (!rowBatch.hasNulls || rowBatch.notNull[i]) {
strBuffer[i] = std::to_string(srcBatch.data[i]);
if (strBuffer[i].size() > maxLength) {
handleOverflow<decltype(srcBatch.data[i]), std::string>(rowBatch, i, throwOnOverflow);
} else {
strBuffer[i].resize(maxLength, ' ');
size += strBuffer[i].size();
}
}
}
} else {
throw SchemaEvolutionError("Invalid type for numeric to string conversion: " +
readType.toString());
}
return size;
}
template <typename FileTypeBatch, typename ReadTypeBatch, bool isFloatingFileType>
class NumericToDecimalColumnReader : public ConvertColumnReader {
public:
NumericToDecimalColumnReader(const Type& _readType, const Type& fileType, StripeStreams& stripe,
bool _throwOnOverflow)
: ConvertColumnReader(_readType, fileType, stripe, _throwOnOverflow) {
precision = static_cast<int32_t>(readType.getPrecision());
scale = static_cast<int32_t>(readType.getScale());
bool overflow = false;
upperBound = scaleUpInt128ByPowerOfTen(1, precision, overflow);
}
void next(ColumnVectorBatch& rowBatch, uint64_t numValues, char* notNull) override {
ConvertColumnReader::next(rowBatch, numValues, notNull);
const auto& srcBatch = *SafeCastBatchTo<const FileTypeBatch*>(data.get());
auto& dstBatch = *SafeCastBatchTo<ReadTypeBatch*>(&rowBatch);
dstBatch.precision = precision;
dstBatch.scale = scale;
for (uint64_t i = 0; i < numValues; ++i) {
if (!rowBatch.hasNulls || rowBatch.notNull[i]) {
if constexpr (isFloatingFileType) {
convertDoubleToDecimal(dstBatch, i, srcBatch.data[i]);
} else {
convertIntegerToDecimal(dstBatch, i, srcBatch.data[i]);
}
}
}
}
private:
template <typename SrcType>
void convertDoubleToDecimal(ReadTypeBatch& dstBatch, uint64_t idx, SrcType value) {
const auto result = convertDecimal(value, precision, scale);
Int128 i128 = result.second;
if (result.first) {
handleOverflow<SrcType, decltype(dstBatch.values[idx])>(dstBatch, idx, throwOnOverflow);
return;
}
if constexpr (std::is_same<ReadTypeBatch, Decimal64VectorBatch>::value) {
if (!i128.fitsInLong()) {
handleOverflow<SrcType, decltype(dstBatch.values[idx])>(dstBatch, idx, throwOnOverflow);
} else {
dstBatch.values[idx] = i128.toLong();
}
} else {
dstBatch.values[idx] = i128;
}
}
template <typename SrcType>
void convertIntegerToDecimal(ReadTypeBatch& dstBatch, uint64_t idx, SrcType value) {
int fromScale = 0;
auto result = convertDecimal(value, fromScale, precision, scale);
if (result.first) {
handleOverflow<SrcType, decltype(dstBatch.values[idx])>(dstBatch, idx, throwOnOverflow);
} else {
if constexpr (std::is_same<ReadTypeBatch, Decimal64VectorBatch>::value) {
if (!result.second.fitsInLong()) {
handleOverflow<SrcType, decltype(dstBatch.values[idx])>(dstBatch, idx, throwOnOverflow);
} else {
dstBatch.values[idx] = result.second.toLong();
}
} else {
dstBatch.values[idx] = result.second;
}
}
}
int32_t precision;
int32_t scale;
int64_t scaleMultiplier;
Int128 upperBound;
};
class ConvertToTimestampColumnReader : public ConvertColumnReader {
public:
ConvertToTimestampColumnReader(const Type& _readType, const Type& fileType,
StripeStreams& stripe, bool _throwOnOverflow)
: ConvertColumnReader(_readType, fileType, stripe, _throwOnOverflow),
readerTimezone(readType.getKind() == TIMESTAMP_INSTANT ? &getTimezoneByName("GMT")
: &stripe.getReaderTimezone()),
needConvertTimezone(readerTimezone != &getTimezoneByName("GMT")) {}
void next(ColumnVectorBatch& rowBatch, uint64_t numValues, char* notNull) override;
protected:
const orc::Timezone* readerTimezone;
const bool needConvertTimezone;
};
// avoid emitting vtable in every translation unit
void ConvertToTimestampColumnReader::next(ColumnVectorBatch& rowBatch, uint64_t numValues,
char* notNull) {
ConvertColumnReader::next(rowBatch, numValues, notNull);
}
template <typename FileTypeBatch>
class NumericToTimestampColumnReader : public ConvertToTimestampColumnReader {
public:
NumericToTimestampColumnReader(const Type& _readType, const Type& fileType,
StripeStreams& stripe, bool _throwOnOverflow)
: ConvertToTimestampColumnReader(_readType, fileType, stripe, _throwOnOverflow) {}
void next(ColumnVectorBatch& rowBatch, uint64_t numValues, char* notNull) override {
ConvertToTimestampColumnReader::next(rowBatch, numValues, notNull);
const auto& srcBatch = *SafeCastBatchTo<const FileTypeBatch*>(data.get());
auto& dstBatch = *SafeCastBatchTo<TimestampVectorBatch*>(&rowBatch);
for (uint64_t i = 0; i < numValues; ++i) {
if (!rowBatch.hasNulls || rowBatch.notNull[i]) {
convertToTimestamp(dstBatch, i, srcBatch.data[i]);
}
}
}
private:
template <typename FileType>
void convertToTimestamp(TimestampVectorBatch& dstBatch, uint64_t idx, FileType value);
};
template <typename FileTypeBatch>
template <typename FileType>
void NumericToTimestampColumnReader<FileTypeBatch>::convertToTimestamp(
TimestampVectorBatch& dstBatch, uint64_t idx, FileType value) {
if constexpr (std::is_floating_point<FileType>::value) {
if (value > static_cast<FileType>(std::numeric_limits<int64_t>::max()) ||
value < static_cast<FileType>(std::numeric_limits<int64_t>::min())) {
handleOverflow<FileType, int64_t>(dstBatch, idx, throwOnOverflow);
return;
}
dstBatch.data[idx] = static_cast<int64_t>(value);
dstBatch.nanoseconds[idx] = static_cast<int32_t>(
static_cast<double>(value - static_cast<FileType>(dstBatch.data[idx])) * 1e9);
if (dstBatch.nanoseconds[idx] < 0) {
dstBatch.data[idx] -= 1;
dstBatch.nanoseconds[idx] += static_cast<int32_t>(1e9);
}
} else {
dstBatch.data[idx] = value;
dstBatch.nanoseconds[idx] = 0;
}
if (needConvertTimezone) {
dstBatch.data[idx] = readerTimezone->convertFromUTC(dstBatch.data[idx]);
}
}
template <typename FileTypeBatch, typename ReadTypeBatch, typename ReadType>
class DecimalToNumericColumnReader : public ConvertColumnReader {
public:
DecimalToNumericColumnReader(const Type& _readType, const Type& fileType, StripeStreams& stripe,
bool _throwOnOverflow)
: ConvertColumnReader(_readType, fileType, stripe, _throwOnOverflow) {
precision = fileType.getPrecision();
scale = fileType.getScale();
factor = 1;
for (int i = 0; i < scale; i++) {
factor *= 10;
}
}
void next(ColumnVectorBatch& rowBatch, uint64_t numValues, char* notNull) override {
ConvertColumnReader::next(rowBatch, numValues, notNull);
const auto& srcBatch = *SafeCastBatchTo<const FileTypeBatch*>(data.get());
auto& dstBatch = *SafeCastBatchTo<ReadTypeBatch*>(&rowBatch);
for (uint64_t i = 0; i < numValues; ++i) {
if (!rowBatch.hasNulls || rowBatch.notNull[i]) {
if constexpr (std::is_floating_point_v<ReadType>) {
convertDecimalToDouble(dstBatch, i, srcBatch);
} else {
convertDecimalToInteger(dstBatch, i, srcBatch);
}
}
}
}
private:
void convertDecimalToInteger(ReadTypeBatch& dstBatch, uint64_t idx,
const FileTypeBatch& srcBatch) {
using FileType = decltype(srcBatch.values[idx]);
Int128 result = scaleDownInt128ByPowerOfTen(srcBatch.values[idx], scale);
if (!result.fitsInLong()) {
handleOverflow<FileType, ReadType>(dstBatch, idx, throwOnOverflow);
return;
}
convertNumericElement<ReadType, int64_t>(result.toLong(), dstBatch.data[idx], dstBatch, idx,
throwOnOverflow);
}
void convertDecimalToDouble(ReadTypeBatch& dstBatch, uint64_t idx,
const FileTypeBatch& srcBatch) {
double doubleValue = Int128(srcBatch.values[idx]).toDouble();
dstBatch.data[idx] = static_cast<ReadType>(doubleValue) / static_cast<ReadType>(factor);
}
int32_t precision;
int32_t scale;
int64_t factor;
};
template <typename FileTypeBatch>
class DecimalToNumericColumnReader<FileTypeBatch, BooleanVectorBatch, bool>
: public ConvertColumnReader {
public:
DecimalToNumericColumnReader(const Type& _readType, const Type& fileType, StripeStreams& stripe,
bool _throwOnOverflow)
: ConvertColumnReader(_readType, fileType, stripe, _throwOnOverflow) {}
void next(ColumnVectorBatch& rowBatch, uint64_t numValues, char* notNull) override {
ConvertColumnReader::next(rowBatch, numValues, notNull);
const auto& srcBatch = *SafeCastBatchTo<const FileTypeBatch*>(data.get());
auto& dstBatch = *SafeCastBatchTo<BooleanVectorBatch*>(&rowBatch);
for (uint64_t i = 0; i < numValues; ++i) {
if (!rowBatch.hasNulls || rowBatch.notNull[i]) {
dstBatch.data[i] = srcBatch.values[i] == 0 ? 0 : 1;
}
}
}
};
template <typename FileTypeBatch, typename ReadTypeBatch>
class DecimalConvertColumnReader : public ConvertColumnReader {
public:
DecimalConvertColumnReader(const Type& _readType, const Type& fileType, StripeStreams& stripe,
bool _throwOnOverflow)
: ConvertColumnReader(_readType, fileType, stripe, _throwOnOverflow) {
fromPrecision = fileType.getPrecision();
fromScale = fileType.getScale();
toPrecision = _readType.getPrecision();
toScale = _readType.getScale();
}
void next(ColumnVectorBatch& rowBatch, uint64_t numValues, char* notNull) override {
ConvertColumnReader::next(rowBatch, numValues, notNull);
const auto& srcBatch = *SafeCastBatchTo<const FileTypeBatch*>(data.get());
auto& dstBatch = *SafeCastBatchTo<ReadTypeBatch*>(&rowBatch);
for (uint64_t i = 0; i < numValues; ++i) {
if (!rowBatch.hasNulls || rowBatch.notNull[i]) {
convertDecimalToDecimal(dstBatch, i, srcBatch);
}
}
}
private:
void convertDecimalToDecimal(ReadTypeBatch& dstBatch, uint64_t idx,
const FileTypeBatch& srcBatch) {
using FileType = decltype(srcBatch.values[idx]);
using ReadType = decltype(dstBatch.values[idx]);
auto [overflows, resultI128] =
convertDecimal(srcBatch.values[idx], fromScale, toPrecision, toScale);
if (overflows) {
handleOverflow<FileType, ReadType>(dstBatch, idx, throwOnOverflow);
}
if constexpr (std::is_same_v<ReadTypeBatch, Decimal64VectorBatch>) {
if (!resultI128.fitsInLong()) {
handleOverflow<FileType, ReadType>(dstBatch, idx, throwOnOverflow);
} else {
dstBatch.values[idx] = resultI128.toLong();
}
} else {
dstBatch.values[idx] = resultI128;
}
}
int32_t fromPrecision;
int32_t fromScale;
int32_t toPrecision;
int32_t toScale;
};
#define DEFINE_NUMERIC_CONVERT_READER(FROM, TO, TYPE) \
using FROM##To##TO##ColumnReader = \
NumericConvertColumnReader<FROM##VectorBatch, TO##VectorBatch, TYPE>;
#define DEFINE_NUMERIC_CONVERT_TO_STRING_VARINT_READER(FROM, TO) \
using FROM##To##TO##ColumnReader = NumericToStringVariantColumnReader<FROM##VectorBatch>;
#define DEFINE_NUMERIC_CONVERT_TO_DECIMAL_READER(FROM, IS_FROM_FLOATING) \
using FROM##To##Decimal64##ColumnReader = \
NumericToDecimalColumnReader<FROM##VectorBatch, Decimal64VectorBatch, IS_FROM_FLOATING>; \
using FROM##To##Decimal128##ColumnReader = \
NumericToDecimalColumnReader<FROM##VectorBatch, Decimal128VectorBatch, IS_FROM_FLOATING>;
#define DEFINE_NUMERIC_CONVERT_TO_TIMESTAMP_READER(FROM) \
using FROM##ToTimestampColumnReader = NumericToTimestampColumnReader<FROM##VectorBatch>;
#define DEFINE_DECIMAL_CONVERT_TO_NUMERIC_READER(TO, TYPE) \
using Decimal64##To##TO##ColumnReader = \
DecimalToNumericColumnReader<Decimal64VectorBatch, TO##VectorBatch, TYPE>; \
using Decimal128##To##TO##ColumnReader = \
DecimalToNumericColumnReader<Decimal128VectorBatch, TO##VectorBatch, TYPE>;
#define DEFINE_DECIMAL_CONVERT_TO_DECIMAL_READER(TO) \
using Decimal64##To##TO##ColumnReader = \
DecimalConvertColumnReader<Decimal64VectorBatch, TO##VectorBatch>; \
using Decimal128##To##TO##ColumnReader = \
DecimalConvertColumnReader<Decimal128VectorBatch, TO##VectorBatch>;
DEFINE_NUMERIC_CONVERT_READER(Boolean, Byte, int8_t)
DEFINE_NUMERIC_CONVERT_READER(Boolean, Short, int16_t)
DEFINE_NUMERIC_CONVERT_READER(Boolean, Int, int32_t)
DEFINE_NUMERIC_CONVERT_READER(Boolean, Long, int64_t)
DEFINE_NUMERIC_CONVERT_READER(Byte, Short, int16_t)
DEFINE_NUMERIC_CONVERT_READER(Byte, Int, int32_t)
DEFINE_NUMERIC_CONVERT_READER(Byte, Long, int64_t)
DEFINE_NUMERIC_CONVERT_READER(Short, Int, int32_t)
DEFINE_NUMERIC_CONVERT_READER(Short, Long, int64_t)
DEFINE_NUMERIC_CONVERT_READER(Int, Long, int64_t)
DEFINE_NUMERIC_CONVERT_READER(Float, Double, double)
DEFINE_NUMERIC_CONVERT_READER(Byte, Boolean, bool)
DEFINE_NUMERIC_CONVERT_READER(Short, Boolean, bool)
DEFINE_NUMERIC_CONVERT_READER(Short, Byte, int8_t)
DEFINE_NUMERIC_CONVERT_READER(Int, Boolean, bool)
DEFINE_NUMERIC_CONVERT_READER(Int, Byte, int8_t)
DEFINE_NUMERIC_CONVERT_READER(Int, Short, int16_t)
DEFINE_NUMERIC_CONVERT_READER(Long, Boolean, bool)
DEFINE_NUMERIC_CONVERT_READER(Long, Byte, int8_t)
DEFINE_NUMERIC_CONVERT_READER(Long, Short, int16_t)
DEFINE_NUMERIC_CONVERT_READER(Long, Int, int32_t)
DEFINE_NUMERIC_CONVERT_READER(Double, Float, float)
// Floating to integer
DEFINE_NUMERIC_CONVERT_READER(Float, Boolean, bool)
DEFINE_NUMERIC_CONVERT_READER(Float, Byte, int8_t)
DEFINE_NUMERIC_CONVERT_READER(Float, Short, int16_t)
DEFINE_NUMERIC_CONVERT_READER(Float, Int, int32_t)
DEFINE_NUMERIC_CONVERT_READER(Float, Long, int64_t)
DEFINE_NUMERIC_CONVERT_READER(Double, Boolean, bool)
DEFINE_NUMERIC_CONVERT_READER(Double, Byte, int8_t)
DEFINE_NUMERIC_CONVERT_READER(Double, Short, int16_t)
DEFINE_NUMERIC_CONVERT_READER(Double, Int, int32_t)
DEFINE_NUMERIC_CONVERT_READER(Double, Long, int64_t)
// Integer to Floating
DEFINE_NUMERIC_CONVERT_READER(Boolean, Float, float)
DEFINE_NUMERIC_CONVERT_READER(Byte, Float, float)
DEFINE_NUMERIC_CONVERT_READER(Short, Float, float)
DEFINE_NUMERIC_CONVERT_READER(Int, Float, float)
DEFINE_NUMERIC_CONVERT_READER(Long, Float, float)
DEFINE_NUMERIC_CONVERT_READER(Boolean, Double, double)
DEFINE_NUMERIC_CONVERT_READER(Byte, Double, double)
DEFINE_NUMERIC_CONVERT_READER(Short, Double, double)
DEFINE_NUMERIC_CONVERT_READER(Int, Double, double)
DEFINE_NUMERIC_CONVERT_READER(Long, Double, double)
// Numeric to String/Char
DEFINE_NUMERIC_CONVERT_TO_STRING_VARINT_READER(Byte, String)
DEFINE_NUMERIC_CONVERT_TO_STRING_VARINT_READER(Short, String)
DEFINE_NUMERIC_CONVERT_TO_STRING_VARINT_READER(Int, String)
DEFINE_NUMERIC_CONVERT_TO_STRING_VARINT_READER(Long, String)
DEFINE_NUMERIC_CONVERT_TO_STRING_VARINT_READER(Float, String)
DEFINE_NUMERIC_CONVERT_TO_STRING_VARINT_READER(Double, String)
DEFINE_NUMERIC_CONVERT_TO_STRING_VARINT_READER(Byte, Char)
DEFINE_NUMERIC_CONVERT_TO_STRING_VARINT_READER(Short, Char)
DEFINE_NUMERIC_CONVERT_TO_STRING_VARINT_READER(Int, Char)
DEFINE_NUMERIC_CONVERT_TO_STRING_VARINT_READER(Long, Char)
DEFINE_NUMERIC_CONVERT_TO_STRING_VARINT_READER(Float, Char)
DEFINE_NUMERIC_CONVERT_TO_STRING_VARINT_READER(Double, Char)
DEFINE_NUMERIC_CONVERT_TO_STRING_VARINT_READER(Byte, Varchar)
DEFINE_NUMERIC_CONVERT_TO_STRING_VARINT_READER(Short, Varchar)
DEFINE_NUMERIC_CONVERT_TO_STRING_VARINT_READER(Int, Varchar)
DEFINE_NUMERIC_CONVERT_TO_STRING_VARINT_READER(Long, Varchar)
DEFINE_NUMERIC_CONVERT_TO_STRING_VARINT_READER(Float, Varchar)
DEFINE_NUMERIC_CONVERT_TO_STRING_VARINT_READER(Double, Varchar)
using BooleanToStringColumnReader = BooleanToStringVariantColumnReader;
using BooleanToCharColumnReader = BooleanToStringVariantColumnReader;
using BooleanToVarcharColumnReader = BooleanToStringVariantColumnReader;
// Numeric to Decimal
DEFINE_NUMERIC_CONVERT_TO_DECIMAL_READER(Boolean, false)
DEFINE_NUMERIC_CONVERT_TO_DECIMAL_READER(Byte, false)
DEFINE_NUMERIC_CONVERT_TO_DECIMAL_READER(Short, false)
DEFINE_NUMERIC_CONVERT_TO_DECIMAL_READER(Int, false)
DEFINE_NUMERIC_CONVERT_TO_DECIMAL_READER(Long, false)
DEFINE_NUMERIC_CONVERT_TO_DECIMAL_READER(Float, true)
DEFINE_NUMERIC_CONVERT_TO_DECIMAL_READER(Double, true)
// Numeric to Timestamp
DEFINE_NUMERIC_CONVERT_TO_TIMESTAMP_READER(Boolean)
DEFINE_NUMERIC_CONVERT_TO_TIMESTAMP_READER(Byte)
DEFINE_NUMERIC_CONVERT_TO_TIMESTAMP_READER(Short)
DEFINE_NUMERIC_CONVERT_TO_TIMESTAMP_READER(Int)
DEFINE_NUMERIC_CONVERT_TO_TIMESTAMP_READER(Long)
DEFINE_NUMERIC_CONVERT_TO_TIMESTAMP_READER(Float)
DEFINE_NUMERIC_CONVERT_TO_TIMESTAMP_READER(Double)
// Decimal to Numeric
DEFINE_DECIMAL_CONVERT_TO_NUMERIC_READER(Boolean, bool)
DEFINE_DECIMAL_CONVERT_TO_NUMERIC_READER(Byte, int8_t)
DEFINE_DECIMAL_CONVERT_TO_NUMERIC_READER(Short, int16_t)
DEFINE_DECIMAL_CONVERT_TO_NUMERIC_READER(Int, int32_t)
DEFINE_DECIMAL_CONVERT_TO_NUMERIC_READER(Long, int64_t)
DEFINE_DECIMAL_CONVERT_TO_NUMERIC_READER(Float, float)
DEFINE_DECIMAL_CONVERT_TO_NUMERIC_READER(Double, double)
// Decimal to Decimal
DEFINE_DECIMAL_CONVERT_TO_DECIMAL_READER(Decimal64)
DEFINE_DECIMAL_CONVERT_TO_DECIMAL_READER(Decimal128)
#define CREATE_READER(NAME) \
return std::make_unique<NAME>(_readType, fileType, stripe, throwOnOverflow);
#define CASE_CREATE_READER(TYPE, CONVERT) \
case TYPE: \
CREATE_READER(CONVERT##ColumnReader)
const static int32_t MAX_PRECISION_64 = 18;
static inline bool isDecimal64(const Type& type) {
return type.getPrecision() > 0 && type.getPrecision() <= MAX_PRECISION_64;
}
#define CASE_CREATE_FROM_DECIMAL_READER(TYPE, TO) \
case TYPE: { \
if (isDecimal64(fileType)) { \
CREATE_READER(Decimal64To##TO##ColumnReader) \
} else { \
CREATE_READER(Decimal128To##TO##ColumnReader) \
} \
}
#define CASE_CREATE_DECIMAL_READER(FROM) \
case DECIMAL: { \
if (isDecimal64(_readType)) { \
CREATE_READER(FROM##ToDecimal64ColumnReader) \
} else { \
CREATE_READER(FROM##ToDecimal128ColumnReader) \
} \
}
#define CASE_EXCEPTION \
default: \
throw SchemaEvolutionError("Cannot convert from " + fileType.toString() + " to " + \
_readType.toString());
std::unique_ptr<ColumnReader> buildConvertReader(const Type& fileType, StripeStreams& stripe,
bool useTightNumericVector,
bool throwOnOverflow) {
if (!useTightNumericVector) {
throw SchemaEvolutionError(
"SchemaEvolution only support tight vector, please create ColumnVectorBatch with "
"option useTightNumericVector");
}
const auto& _readType = *stripe.getSchemaEvolution()->getReadType(fileType);
switch (fileType.getKind()) {
case BOOLEAN: {
switch (_readType.getKind()) {
CASE_CREATE_READER(BYTE, BooleanToByte)
CASE_CREATE_READER(SHORT, BooleanToShort)
CASE_CREATE_READER(INT, BooleanToInt)
CASE_CREATE_READER(LONG, BooleanToLong)
CASE_CREATE_READER(FLOAT, BooleanToFloat)
CASE_CREATE_READER(DOUBLE, BooleanToDouble)
CASE_CREATE_READER(STRING, BooleanToString)
CASE_CREATE_READER(CHAR, BooleanToChar)
CASE_CREATE_READER(VARCHAR, BooleanToVarchar)
CASE_CREATE_DECIMAL_READER(Boolean)
CASE_CREATE_READER(TIMESTAMP, BooleanToTimestamp)
CASE_CREATE_READER(TIMESTAMP_INSTANT, BooleanToTimestamp)
case BOOLEAN:
case BINARY:
case LIST:
case MAP:
case STRUCT:
case UNION:
case DATE:
CASE_EXCEPTION
}
}
case BYTE: {
switch (_readType.getKind()) {
CASE_CREATE_READER(BOOLEAN, ByteToBoolean)
CASE_CREATE_READER(SHORT, ByteToShort)
CASE_CREATE_READER(INT, ByteToInt)
CASE_CREATE_READER(LONG, ByteToLong)
CASE_CREATE_READER(FLOAT, ByteToFloat)
CASE_CREATE_READER(DOUBLE, ByteToDouble)
CASE_CREATE_READER(STRING, ByteToString)
CASE_CREATE_READER(CHAR, ByteToChar)
CASE_CREATE_READER(VARCHAR, ByteToVarchar)
CASE_CREATE_DECIMAL_READER(Byte)
CASE_CREATE_READER(TIMESTAMP, ByteToTimestamp)
CASE_CREATE_READER(TIMESTAMP_INSTANT, ByteToTimestamp)
case BYTE:
case BINARY:
case LIST:
case MAP:
case STRUCT:
case UNION:
case DATE:
CASE_EXCEPTION
}
}
case SHORT: {
switch (_readType.getKind()) {
CASE_CREATE_READER(BOOLEAN, ShortToBoolean)
CASE_CREATE_READER(BYTE, ShortToByte)
CASE_CREATE_READER(INT, ShortToInt)
CASE_CREATE_READER(LONG, ShortToLong)
CASE_CREATE_READER(FLOAT, ShortToFloat)
CASE_CREATE_READER(DOUBLE, ShortToDouble)
CASE_CREATE_READER(STRING, ShortToString)
CASE_CREATE_READER(CHAR, ShortToChar)
CASE_CREATE_READER(VARCHAR, ShortToVarchar)
CASE_CREATE_DECIMAL_READER(Short)
CASE_CREATE_READER(TIMESTAMP, ShortToTimestamp)
CASE_CREATE_READER(TIMESTAMP_INSTANT, ShortToTimestamp)
case SHORT:
case BINARY:
case LIST:
case MAP:
case STRUCT:
case UNION:
case DATE:
CASE_EXCEPTION
}
}
case INT: {
switch (_readType.getKind()) {
CASE_CREATE_READER(BOOLEAN, IntToBoolean)
CASE_CREATE_READER(BYTE, IntToByte)
CASE_CREATE_READER(SHORT, IntToShort)
CASE_CREATE_READER(LONG, IntToLong)
CASE_CREATE_READER(FLOAT, IntToFloat)
CASE_CREATE_READER(DOUBLE, IntToDouble)
CASE_CREATE_READER(STRING, IntToString)
CASE_CREATE_READER(CHAR, IntToChar)
CASE_CREATE_READER(VARCHAR, IntToVarchar)
CASE_CREATE_DECIMAL_READER(Int)
CASE_CREATE_READER(TIMESTAMP, IntToTimestamp)
CASE_CREATE_READER(TIMESTAMP_INSTANT, IntToTimestamp)
case INT:
case BINARY:
case LIST:
case MAP:
case STRUCT:
case UNION:
case DATE:
CASE_EXCEPTION
}
}
case LONG: {
switch (_readType.getKind()) {
CASE_CREATE_READER(BOOLEAN, LongToBoolean)
CASE_CREATE_READER(BYTE, LongToByte)
CASE_CREATE_READER(SHORT, LongToShort)
CASE_CREATE_READER(INT, LongToInt)
CASE_CREATE_READER(FLOAT, LongToFloat)
CASE_CREATE_READER(DOUBLE, LongToDouble)
CASE_CREATE_READER(STRING, LongToString)
CASE_CREATE_READER(CHAR, LongToChar)
CASE_CREATE_READER(VARCHAR, LongToVarchar)
CASE_CREATE_DECIMAL_READER(Long)
CASE_CREATE_READER(TIMESTAMP, LongToTimestamp)
CASE_CREATE_READER(TIMESTAMP_INSTANT, LongToTimestamp)
case LONG:
case BINARY:
case LIST:
case MAP:
case STRUCT:
case UNION:
case DATE:
CASE_EXCEPTION
}
}
case FLOAT: {
switch (_readType.getKind()) {
CASE_CREATE_READER(BOOLEAN, FloatToBoolean)
CASE_CREATE_READER(BYTE, FloatToByte)
CASE_CREATE_READER(SHORT, FloatToShort)
CASE_CREATE_READER(INT, FloatToInt)
CASE_CREATE_READER(LONG, FloatToLong)
CASE_CREATE_READER(DOUBLE, FloatToDouble)
CASE_CREATE_READER(STRING, FloatToString)
CASE_CREATE_READER(CHAR, FloatToChar)
CASE_CREATE_READER(VARCHAR, FloatToVarchar)
CASE_CREATE_DECIMAL_READER(Float)
CASE_CREATE_READER(TIMESTAMP, FloatToTimestamp)
CASE_CREATE_READER(TIMESTAMP_INSTANT, FloatToTimestamp)
case FLOAT:
case BINARY:
case LIST:
case MAP:
case STRUCT:
case UNION:
case DATE:
CASE_EXCEPTION
}
}
case DOUBLE: {
switch (_readType.getKind()) {
CASE_CREATE_READER(BOOLEAN, DoubleToBoolean)
CASE_CREATE_READER(BYTE, DoubleToByte)
CASE_CREATE_READER(SHORT, DoubleToShort)
CASE_CREATE_READER(INT, DoubleToInt)
CASE_CREATE_READER(LONG, DoubleToLong)
CASE_CREATE_READER(FLOAT, DoubleToFloat)
CASE_CREATE_READER(STRING, DoubleToString)
CASE_CREATE_READER(CHAR, DoubleToChar)
CASE_CREATE_READER(VARCHAR, DoubleToVarchar)
CASE_CREATE_DECIMAL_READER(Double)
CASE_CREATE_READER(TIMESTAMP, DoubleToTimestamp)
CASE_CREATE_READER(TIMESTAMP_INSTANT, DoubleToTimestamp)
case DOUBLE:
case BINARY:
case LIST:
case MAP:
case STRUCT:
case UNION:
case DATE:
CASE_EXCEPTION
}
}
case STRING:
case BINARY:
case TIMESTAMP:
case LIST:
case MAP:
case STRUCT:
case UNION:
case DECIMAL: {
switch (_readType.getKind()) {
CASE_CREATE_FROM_DECIMAL_READER(BOOLEAN, Boolean)
CASE_CREATE_FROM_DECIMAL_READER(BYTE, Byte)
CASE_CREATE_FROM_DECIMAL_READER(SHORT, Short)
CASE_CREATE_FROM_DECIMAL_READER(INT, Int)
CASE_CREATE_FROM_DECIMAL_READER(LONG, Long)
CASE_CREATE_FROM_DECIMAL_READER(FLOAT, Float)
CASE_CREATE_FROM_DECIMAL_READER(DOUBLE, Double)
case DECIMAL: {
if (isDecimal64(fileType)) {
if (isDecimal64(_readType)) {
CREATE_READER(Decimal64ToDecimal64ColumnReader)
} else {
CREATE_READER(Decimal64ToDecimal128ColumnReader)
}
} else {
if (isDecimal64(_readType)) {
CREATE_READER(Decimal128ToDecimal64ColumnReader)
} else {
CREATE_READER(Decimal128ToDecimal128ColumnReader)
}
}
}
case STRING:
case CHAR:
case VARCHAR:
case TIMESTAMP:
case TIMESTAMP_INSTANT:
case BINARY:
case LIST:
case MAP:
case STRUCT:
case UNION:
case DATE:
CASE_EXCEPTION
}
}
case DATE:
case VARCHAR:
case CHAR:
case TIMESTAMP_INSTANT:
CASE_EXCEPTION
}
}
#undef DEFINE_NUMERIC_CONVERT_READER
#undef DEFINE_NUMERIC_CONVERT_TO_STRING_VARINT_READER
#undef DEFINE_NUMERIC_CONVERT_TO_DECIMAL_READER
#undef DEFINE_NUMERIC_CONVERT_TO_TIMESTAMP_READER
#undef DEFINE_DECIMAL_CONVERT_TO_NUMERIC_READER
#undef DEFINE_DECIMAL_CONVERT_TO_DECIMAL_READER
#undef CASE_CREATE_FROM_DECIMAL_READER
#undef CASE_CREATE_READER
#undef CASE_EXCEPTION
} // namespace orc
|