wgtmac commented on code in PR #1307:
URL: https://github.com/apache/orc/pull/1307#discussion_r1018098146
##########
c++/include/orc/Vector.hh:
##########
@@ -88,28 +88,116 @@ namespace orc {
ColumnVectorBatch& operator=(const ColumnVectorBatch&);
};
- struct LongVectorBatch : public ColumnVectorBatch {
- LongVectorBatch(uint64_t capacity, MemoryPool& pool);
- virtual ~LongVectorBatch();
+ template <typename ValueType>
+ struct IntegerVectorBatch : public ColumnVectorBatch {
+ IntegerVectorBatch(uint64_t cap, MemoryPool& pool)
+ : ColumnVectorBatch(cap, pool), data(pool, cap) {
+ // PASS
+ }
- DataBuffer<int64_t> data;
- std::string toString() const;
- void resize(uint64_t capacity);
- void clear();
- uint64_t getMemoryUsage();
+ virtual ~IntegerVectorBatch() = default;
+
+ inline std::string toString() const;
+
+ void resize(uint64_t cap) {
+ if (capacity < cap) {
+ ColumnVectorBatch::resize(cap);
+ data.resize(cap);
+ }
+ }
+
+ void clear() {
+ numElements = 0;
+ }
+
+ uint64_t getMemoryUsage() {
+ return ColumnVectorBatch::getMemoryUsage() +
+ static_cast<uint64_t>(data.capacity() * sizeof(int64_t));
Review Comment:
```suggestion
static_cast<uint64_t>(data.capacity() * sizeof(ValueType));
```
##########
c++/src/ColumnReader.cc:
##########
@@ -474,31 +465,32 @@ namespace orc {
return numValues;
}
- template <TypeKind columnKind, bool isLittleEndian>
- void DoubleColumnReader<columnKind, isLittleEndian>::next(ColumnVectorBatch&
rowBatch,
- uint64_t
numValues, char* notNull) {
+ template <TypeKind columnKind, bool isLittleEndian, typename ValueType,
typename BatchType>
+ void DoubleColumnReader<columnKind, isLittleEndian, ValueType,
BatchType>::next(
+ ColumnVectorBatch& rowBatch, uint64_t numValues, char* notNull) {
ColumnReader::next(rowBatch, numValues, notNull);
// update the notNull from the parent class
notNull = rowBatch.hasNulls ? rowBatch.notNull.data() : nullptr;
- double* outArray = dynamic_cast<DoubleVectorBatch&>(rowBatch).data.data();
+ ValueType* outArray =
+
reinterpret_cast<ValueType*>(dynamic_cast<BatchType&>(rowBatch).data.data());
if (columnKind == FLOAT) {
Review Comment:
```suggestion
if constexpr (columnKind == FLOAT) {
```
##########
tools/src/FileMetadata.cc:
##########
@@ -26,7 +26,7 @@
#include "orc/Exceptions.hh"
#include "orc/OrcFile.hh"
-//#include "Adaptor.hh"
+// #include "Adaptor.hh"
Review Comment:
Remove this line
##########
c++/src/ColumnReader.cc:
##########
@@ -129,6 +129,12 @@ namespace orc {
}
}
+ void expandBytesToLongs(int8_t* buffer, uint64_t numValues) {
Review Comment:
if sizeof(char) == sizeof(int8_t), this function can return early. BTW, the
name is strange since the output type is no longer LONG.
##########
c++/src/Timezone.cc:
##########
@@ -24,6 +24,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
+#include <iostream>
Review Comment:
Remove it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]