ffacs commented on code in PR #2010:
URL: https://github.com/apache/orc/pull/2010#discussion_r1734062467
##########
c++/include/orc/Vector.hh:
##########
@@ -251,13 +256,14 @@ namespace orc {
void resize(uint64_t capacity) override;
// Calculate data and length in StringVectorBatch from dictionary and index
- void calculateDataAndLength();
+ void decodeDictionary() override;
std::shared_ptr<StringDictionary> dictionary;
// index for dictionary entry
DataBuffer<int64_t> index;
- std::atomic<bool> calculated{false};
+
+ std::atomic<bool> dictionary_encoded{false};
Review Comment:
```suggestion
std::atomic<bool> dictionaryDecoded{false};
```
##########
c++/src/ColumnWriter.cc:
##########
@@ -931,8 +933,8 @@ namespace orc {
}
};
- mutable std::vector<DictEntryWithIndex> flat_dict;
- std::unordered_map<std::string, size_t> key_to_index;
+ mutable std::vector<DictEntryWithIndex> flatDict_;
+ std::unordered_map<std::string, size_t> keyToIndex;
Review Comment:
```suggestion
std::unordered_map<std::string, size_t> keyToIndex_;
```
##########
c++/src/ColumnWriter.cc:
##########
@@ -952,9 +959,12 @@ namespace orc {
// write dictionary data & length to output buffer
void SortedStringDictionary::flush(AppendOnlyBufferedStream* dataStream,
RleEncoder* lengthEncoder) const {
- for (auto it = dict_.cbegin(); it != dict_.cend(); ++it) {
- dataStream->write(it->first.data, it->first.length);
- lengthEncoder->write(static_cast<int64_t>(it->first.length));
+ std::sort(flatDict_.begin(), flatDict_.end(), LessThan());
+
+ for (const auto& entry_with_index : flatDict_) {
Review Comment:
```suggestion
for (const auto& entryWithIndex : flatDict_) {
```
--
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]