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

chore: Allow specifying aliases for table functions #2364

Merged
merged 4 commits into from
Jan 7, 2024

Conversation

scsmithr
Copy link
Member

@scsmithr scsmithr commented Jan 7, 2024

Instead of duplicating the function definition itself.

Also a few cleanups.

Existing SLTs assert that this works as expected. SLTs for parquet_scan, etc are just copies of the read_parquet ones.

Instead of duplicating the function definition itself.

Also a few cleanups.
@@ -19,6 +19,7 @@ use table::{BuiltinTableFuncs, TableFunc};

/// Builtin table returning functions available for all sessions.
static BUILTIN_TABLE_FUNCS: Lazy<BuiltinTableFuncs> = Lazy::new(BuiltinTableFuncs::new);
// TODO: Why is this separate?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The arrow cast function has special handling in datafusion due to the dynamic return type. So it isn't a 'scalar_udf' and needs to be handled a bit differently.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This constant wasn't used, so removed it. Also added a comment when generating the hashmap about the arrow_cast special case.

@scsmithr scsmithr enabled auto-merge (squash) January 7, 2024 22:35
@scsmithr scsmithr merged commit c21a473 into main Jan 7, 2024
13 checks passed
@scsmithr scsmithr deleted the sean/table-func-aliases branch January 7, 2024 22:56
scsmithr added a commit that referenced this pull request Jan 7, 2024
```
> select * from read_csv('./testdata/csv/delimiter.csv', delimiter => ';');
┌───────┬──────────────┬─────────┐
│  col1 │ col2         │    col3 │
│    ── │ ──           │      ── │
│ Int64 │ Utf8         │ Float64 │
╞═══════╪══════════════╪═════════╡
│     1 │ hello, world │ 3.90000 │
│     2 │ HELLO, WORLD │ 4.90000 │
└───────┴──────────────┴─────────┘
```

Depends on #2364

Adds the plumbing for getting options from the user in our various scan
functions. The only one wired up right now is 'delimiter' for csv, but
other options should be very straightforward to add in now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants