-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from hannes/main
Update to DuckDB 0.9.1
- Loading branch information
Showing
85 changed files
with
763 additions
and
471 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/duckdb/extension/parquet/include/parquet_bss_decoder.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
//===----------------------------------------------------------------------===// | ||
// DuckDB | ||
// | ||
// parquet_bss_decoder.hpp | ||
// | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#pragma once | ||
#include "parquet_types.h" | ||
#include "resizable_buffer.hpp" | ||
|
||
namespace duckdb { | ||
|
||
/// Decoder for the Byte Stream Split encoding | ||
class BssDecoder { | ||
public: | ||
/// Create a decoder object. buffer/buffer_len is the encoded data. | ||
BssDecoder(data_ptr_t buffer, uint32_t buffer_len) : buffer_(buffer, buffer_len), value_offset_(0) { | ||
} | ||
|
||
public: | ||
template <typename T> | ||
void GetBatch(data_ptr_t values_target_ptr, uint32_t batch_size) { | ||
if (buffer_.len % sizeof(T) != 0) { | ||
std::stringstream error; | ||
error << "Data buffer size for the BYTE_STREAM_SPLIT encoding (" << buffer_.len | ||
<< ") should be a multiple of the type size (" << sizeof(T) << ")"; | ||
throw std::runtime_error(error.str()); | ||
} | ||
uint32_t num_buffer_values = buffer_.len / sizeof(T); | ||
|
||
buffer_.available((value_offset_ + batch_size) * sizeof(T)); | ||
|
||
for (uint32_t byte_offset = 0; byte_offset < sizeof(T); ++byte_offset) { | ||
data_ptr_t input_bytes = buffer_.ptr + byte_offset * num_buffer_values + value_offset_; | ||
for (uint32_t i = 0; i < batch_size; ++i) { | ||
values_target_ptr[byte_offset + i * sizeof(T)] = *(input_bytes + i); | ||
} | ||
} | ||
value_offset_ += batch_size; | ||
} | ||
|
||
private: | ||
ByteBuffer buffer_; | ||
uint32_t value_offset_; | ||
}; | ||
|
||
} // namespace duckdb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.