Skip to content
Open
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
14 changes: 13 additions & 1 deletion vortex-duckdb/cpp/include/table_function.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ struct VortexBindData final : FunctionData {
}
};

struct DistributedFragment {
idx_t file_index;
idx_t row_start;
idx_t row_end;
idx_t estimated_bytes;

bool operator==(const DistributedFragment &other) const {
return file_index == other.file_index && row_start == other.row_start &&
row_end == other.row_end && estimated_bytes == other.estimated_bytes;
}
};

struct PortableSnapshot {
string portable_bind;
vector<DistributedFile> distributed_files;
Expand All @@ -78,7 +90,7 @@ struct VortexBindData final : FunctionData {
bool explicit_split_mode = false;
bool splits_applied = false;
vector<idx_t> eligible_file_indexes;
vector<idx_t> assigned_file_indexes;
vector<DistributedFragment> assigned_fragments;
#endif
};

Expand Down
483 changes: 296 additions & 187 deletions vortex-duckdb/cpp/table_function.cpp

Large diffs are not rendered by default.

34 changes: 32 additions & 2 deletions vortex-duckdb/include/vortex.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@

#define COUNT_STAR_PROJ_IDX UINT64_MAX

#if defined(VORTEX_VANE_DISTRIBUTED)
typedef struct {
uint64_t file_index;
uint64_t row_start;
uint64_t row_end;
uint64_t estimated_bytes;
} VortexDistributedFragmentView;
#endif

#if defined(VORTEX_VANE_DISTRIBUTED)
typedef struct {
const uint8_t *name;
Expand Down Expand Up @@ -119,6 +128,27 @@ const uint8_t *duckdb_table_function_distributed_bind_bytes(const void *portable
size_t *size_out);
#endif

#if defined(VORTEX_VANE_DISTRIBUTED)
extern
duckdb_vx_data duckdb_table_function_distributed_plan_fragments(const uint8_t *portable_bind,
size_t portable_bind_size,
const uint64_t *selected_file_indexes,
size_t selected_file_count,
size_t target_fragment_count,
duckdb_vx_error *error_out);
#endif

#if defined(VORTEX_VANE_DISTRIBUTED)
extern size_t duckdb_table_function_distributed_fragment_count(const void *fragment_plan);
#endif

#if defined(VORTEX_VANE_DISTRIBUTED)
extern
bool duckdb_table_function_distributed_fragment_at(const void *fragment_plan,
size_t index,
VortexDistributedFragmentView *fragment_out);
#endif

#if defined(VORTEX_VANE_DISTRIBUTED)
extern size_t duckdb_table_function_distributed_file_count(const void *portable_bind);
#endif
Expand Down Expand Up @@ -158,8 +188,8 @@ bool duckdb_table_function_distributed_file_is_selected(duckdb_vx_table_filter_s
extern
duckdb_vx_data duckdb_table_function_init_global_distributed(const uint8_t *portable_bind,
size_t portable_bind_size,
const uint64_t *assigned_file_indexes,
size_t assigned_file_count,
const VortexDistributedFragmentView *assigned_fragments,
size_t assigned_fragment_count,
bool ignore_optional_filters,
const duckdb_vx_tfunc_init_input *init_input,
duckdb_vx_error *error_out);
Expand Down
Loading
Loading