Copilot commented on code in PR #50872:
URL: https://github.com/apache/arrow/pull/50872#discussion_r3789305255
##########
cpp/src/parquet/decoder.cc:
##########
@@ -1706,6 +1707,175 @@ class DeltaBitPackDecoder : public
TypedDecoderImpl<DType> {
T last_value_;
};
+// ----------------------------------------------------------------------
+// FSST decoder
+
+class FsstDecoder final : public TypedDecoderImpl<ByteArrayType> {
+ public:
+ FsstDecoder(const ColumnDescriptor* descr,
+ const std::shared_ptr<Buffer>& symbol_table_body, MemoryPool*
pool)
+ : TypedDecoderImpl<ByteArrayType>(descr, Encoding::FSST),
+ pool_(pool),
+
symbol_table_(internal::FsstSymbolTable::Deserialize(symbol_table_body)) {}
+
+ void SetData(int num_values, const uint8_t* data, int len) override;
+
+ int Decode(ByteArray* buffer, int max_values) override {
+ max_values = std::min(max_values, this->num_values_);
+ for (int i = 0; i < max_values; ++i) {
+ const int32_t begin = decoded_offsets_[value_index_];
+ const int32_t end = decoded_offsets_[value_index_ + 1];
+ buffer[i].ptr = begin == end ? nullptr : decoded_data_.data() + begin;
+ buffer[i].len = static_cast<uint32_t>(end - begin);
Review Comment:
FSST decoding uses `ptr == nullptr` to represent empty strings (`begin ==
end`). In this codebase `ByteArray::ptr == nullptr` is used as a sentinel for
“no value” (and `operator std::string_view()` will build a string_view from
`ptr`), so empty strings should not be represented with a null pointer.
--
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]