Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,21 @@ void DeltaLengthByteArrayDecoder::InitializePage() {
void DeltaLengthByteArrayDecoder::Read(shared_ptr<ResizeableBuffer> &block_ref, uint8_t *defines, idx_t read_count,
Vector &result, idx_t result_offset) {
if (defines) {
ReadInternal<true>(block_ref, defines, read_count, result, result_offset);
if (reader.Type().IsJSONType()) {
ReadInternal<true, true>(block_ref, defines, read_count, result, result_offset);
} else {
ReadInternal<true, false>(block_ref, defines, read_count, result, result_offset);
}
} else {
ReadInternal<false>(block_ref, defines, read_count, result, result_offset);
if (reader.Type().IsJSONType()) {
ReadInternal<false, true>(block_ref, defines, read_count, result, result_offset);
} else {
ReadInternal<false, false>(block_ref, defines, read_count, result, result_offset);
}
}
}

template <bool HAS_DEFINES>
template <bool HAS_DEFINES, bool VALIDATE_INDIVIDUAL_STRINGS>
void DeltaLengthByteArrayDecoder::ReadInternal(shared_ptr<ResizeableBuffer> &block_ref, uint8_t *const defines,
const idx_t read_count, Vector &result, const idx_t result_offset) {
auto &block = *block_ref;
Expand All @@ -58,6 +66,8 @@ void DeltaLengthByteArrayDecoder::ReadInternal(shared_ptr<ResizeableBuffer> &blo
}
}

const auto &string_column_reader = reader.Cast<StringColumnReader>();

const auto start_ptr = block.ptr;
for (idx_t row_idx = 0; row_idx < read_count; row_idx++) {
const auto result_idx = result_offset + row_idx;
Expand All @@ -75,11 +85,15 @@ void DeltaLengthByteArrayDecoder::ReadInternal(shared_ptr<ResizeableBuffer> &blo
}
const auto &str_len = length_data[length_idx++];
result_data[result_idx] = string_t(char_ptr_cast(block.ptr), str_len);
if (VALIDATE_INDIVIDUAL_STRINGS) {
string_column_reader.VerifyString(char_ptr_cast(block.ptr), str_len);
}
block.unsafe_inc(str_len);
}

// Verify that the strings we read are valid UTF-8
reader.Cast<StringColumnReader>().VerifyString(char_ptr_cast(start_ptr), block.ptr - start_ptr);
if (!VALIDATE_INDIVIDUAL_STRINGS) {
string_column_reader.VerifyString(char_ptr_cast(start_ptr), NumericCast<uint32_t>(block.ptr - start_ptr));
}

StringColumnReader::ReferenceBlock(result, block_ref);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class DeltaLengthByteArrayDecoder {
void Skip(uint8_t *defines, idx_t skip_count);

private:
template <bool HAS_DEFINES>
template <bool HAS_DEFINES, bool VALIDATE_INDIVIDUAL_STRINGS>
void ReadInternal(shared_ptr<ResizeableBuffer> &block, uint8_t *defines, idx_t read_count, Vector &result,
idx_t result_offset);
template <bool HAS_DEFINES>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
namespace duckdb {

class StringColumnReader : public ColumnReader {
public:
enum class StringColumnType : uint8_t { VARCHAR, JSON, OTHER };

static StringColumnType GetStringColumnType(const LogicalType &type) {
Expand All @@ -36,7 +37,7 @@ class StringColumnReader : public ColumnReader {

public:
static void VerifyString(const char *str_data, uint32_t str_len, const bool isVarchar);
void VerifyString(const char *str_data, uint32_t str_len);
void VerifyString(const char *str_data, uint32_t str_len) const;

static void ReferenceBlock(Vector &result, shared_ptr<ResizeableBuffer> &block);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void StringColumnReader::VerifyString(const char *str_data, uint32_t str_len, co
}
}

void StringColumnReader::VerifyString(const char *str_data, uint32_t str_len) {
void StringColumnReader::VerifyString(const char *str_data, uint32_t str_len) const {
switch (string_column_type) {
case StringColumnType::VARCHAR:
VerifyString(str_data, str_len, true);
Expand Down
6 changes: 4 additions & 2 deletions src/duckdb/src/common/adbc/adbc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,8 @@ static int get_schema(struct ArrowArrayStream *stream, struct ArrowSchema *out)
auto count = duckdb_column_count(&result_wrapper->result);
std::vector<duckdb_logical_type> types(count);

std::vector<std::string> owned_names(count);
std::vector<std::string> owned_names;
owned_names.reserve(count);
duckdb::vector<const char *> names(count);
for (idx_t i = 0; i < count; i++) {
types[i] = duckdb_column_logical_type(&result_wrapper->result, i);
Expand Down Expand Up @@ -793,7 +794,8 @@ AdbcStatusCode StatementGetParameterSchema(struct AdbcStatement *statement, stru
count = 1;
}
std::vector<duckdb_logical_type> types(count);
std::vector<std::string> owned_names(count);
std::vector<std::string> owned_names;
owned_names.reserve(count);
duckdb::vector<const char *> names(count);

for (idx_t i = 0; i < count; i++) {
Expand Down
34 changes: 0 additions & 34 deletions src/duckdb/src/common/types/row/block_iterator.cpp

This file was deleted.

6 changes: 3 additions & 3 deletions src/duckdb/src/function/table/version/pragma_version.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef DUCKDB_PATCH_VERSION
#define DUCKDB_PATCH_VERSION "2-dev146"
#define DUCKDB_PATCH_VERSION "2-dev185"
#endif
#ifndef DUCKDB_MINOR_VERSION
#define DUCKDB_MINOR_VERSION 4
Expand All @@ -8,10 +8,10 @@
#define DUCKDB_MAJOR_VERSION 1
#endif
#ifndef DUCKDB_VERSION
#define DUCKDB_VERSION "v1.4.2-dev146"
#define DUCKDB_VERSION "v1.4.2-dev185"
#endif
#ifndef DUCKDB_SOURCE_ID
#define DUCKDB_SOURCE_ID "b4d86dddcf"
#define DUCKDB_SOURCE_ID "307f9b41ff"
#endif
#include "duckdb/function/table/system_functions.hpp"
#include "duckdb/main/database.hpp"
Expand Down
Loading