Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use duckdb functions without having to specify the full type signature #531

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5779c4c
Initial trial for new read_csv syntax
JelteF Dec 9, 2024
a799f7e
Generate query that works for iceberg scans
JelteF Dec 11, 2024
25d0b37
Correct column aliases and use star
JelteF Dec 12, 2024
b86d517
Attempt to fix create table as, but very hacky
JelteF Dec 13, 2024
bbdaf8e
Add comment about bug so I don't forget
JelteF Dec 13, 2024
db3f6c5
Add support for duckdb.query
JelteF Dec 18, 2024
8802342
Add missing max aggregate
JelteF Dec 20, 2024
a54e8a5
Add error hint
JelteF Jan 14, 2025
42d08f5
Ignore warning about declarations after statements
JelteF Jan 14, 2025
755ec9b
Fix warning
JelteF Jan 14, 2025
bc40f0b
Don't rename subscript expressions in subqueries
JelteF Jan 14, 2025
3919d76
Fix materialized views
JelteF Jan 14, 2025
1992351
Only do CTAS type detection using duckdb for unresolved types
JelteF Jan 14, 2025
2321203
Use C duckdb_only_function handler for approx_count_distinct
JelteF Jan 14, 2025
c6639f1
Support array/json indexing
JelteF Jan 14, 2025
7126bc8
Fix CTAS
JelteF Jan 15, 2025
50da850
Move extension registration to top of subscript transform fuction
JelteF Jan 15, 2025
c89792e
Remove pprint
JelteF Jan 15, 2025
99830ad
More comments and tests
JelteF Jan 15, 2025
b8345ea
Even more comments and tests
JelteF Jan 15, 2025
1b20a9f
Add missing file
JelteF Jan 15, 2025
916b7c4
Revert "Generate query that works for iceberg scans"
JelteF Jan 17, 2025
93a2fed
Fix iceberg_scan in a better way
JelteF Jan 17, 2025
557bfcc
Update iceberg_scan fix
JelteF Jan 17, 2025
6c44d56
Also wrap "query" in a subquery
JelteF Jan 17, 2025
a1bea36
Update comment to reflect reality
JelteF Jan 18, 2025
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
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ COMPILER_FLAGS=-Wno-sign-compare -Wshadow -Wswitch -Wunused-parameter -Wunreacha

override PG_CPPFLAGS += -Iinclude -isystem third_party/duckdb/src/include -isystem third_party/duckdb/third_party/re2 ${COMPILER_FLAGS}
override PG_CXXFLAGS += -std=c++17 ${DUCKDB_BUILD_CXX_FLAGS} ${COMPILER_FLAGS} -Wno-register
# Ignore declaration-after-statement warnings in our code. Postgres enforces
# this because their ancient style guide requires it, but we don't care. It
# would only apply to C files anyway, and we don't have many of those. The only
# ones that we do have are vendored in from Postgres (ruleutils), and allowing
# declarations to be anywhere is even a good thing for those as we can keep our
# changes to the vendored code in one place.
override PG_CFLAGS += -Wno-declaration-after-statement

SHLIB_LINK += -Wl,-rpath,$(PG_LIB)/ -lpq -Lthird_party/duckdb/build/$(DUCKDB_BUILD_TYPE)/src -L$(PG_LIB) -lduckdb -lstdc++ -llz4

Expand Down
3 changes: 3 additions & 0 deletions include/pgduckdb/pgduckdb_metadata_cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ bool IsExtensionRegistered();
bool IsDuckdbOnlyFunction(Oid function_oid);
uint64 CacheVersion();
Oid ExtensionOid();
Oid SchemaOid();
Oid DuckdbRowOid();
Oid DuckdbUnresolvedTypeOid();
Oid DuckdbTableAmOid();
bool IsMotherDuckEnabled();
bool IsMotherDuckEnabledAnywhere();
Expand Down
9 changes: 9 additions & 0 deletions include/pgduckdb/pgduckdb_ruleutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,12 @@ char *pgduckdb_get_tabledef(Oid relation_id);
bool pgduckdb_is_not_default_expr(Node *node, void *context);
List *pgduckdb_db_and_schema(const char *postgres_schema_name, bool is_duckdb_table);
const char *pgduckdb_db_and_schema_string(const char *postgres_schema_name, bool is_duckdb_table);
bool pgduckdb_is_duckdb_row(Oid type_oid);
bool pgduckdb_is_unresolved_type(Oid type_oid);
bool pgduckdb_var_is_duckdb_row(Var *var);
bool pgduckdb_func_returns_duckdb_row(RangeTblFunction *rtfunc);
bool pgduckdb_target_list_contains_unresolved_type_or_row(List *target_list);
Var *pgduckdb_duckdb_row_subscript_var(Expr *expr);
List *pgduckdb_star_start_vars(List *target_list);

extern bool processed_targetlist;
Loading
Loading