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

feat: add some table aliases for lance,iceberg and delta #2752

Merged
merged 3 commits into from
Mar 8, 2024
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
1 change: 1 addition & 0 deletions crates/sqlbuiltins/src/functions/table/delta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ impl ConstBuiltinFunction for DeltaScan {
const DESCRIPTION: &'static str = "Scans a delta table";
const EXAMPLE: &'static str = "SELECT * FROM delta_scan('file:///path/to/table')";
const FUNCTION_TYPE: FunctionType = FunctionType::TableReturning;
const ALIASES: &'static [&'static str] = &["read_delta"];
}

#[async_trait]
Expand Down
1 change: 1 addition & 0 deletions crates/sqlbuiltins/src/functions/table/iceberg/scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ impl ConstBuiltinFunction for IcebergScan {
const DESCRIPTION: &'static str = "Scans an iceberg table";
const EXAMPLE: &'static str = "SELECT * FROM iceberg_scan('file:///path/to/table')";
const FUNCTION_TYPE: FunctionType = FunctionType::TableReturning;
const ALIASES: &'static [&'static str] = &["read_iceberg"];
}

#[async_trait]
Expand Down
1 change: 1 addition & 0 deletions crates/sqlbuiltins/src/functions/table/lance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ impl ConstBuiltinFunction for LanceScan {
const DESCRIPTION: &'static str = "Scans a Lance table";
const EXAMPLE: &'static str = "SELECT * FROM lance_scan('file:///path/to/table.lance')";
const FUNCTION_TYPE: FunctionType = FunctionType::TableReturning;
const ALIASES: &'static [&'static str] = &["read_lance"];
}

#[async_trait]
Expand Down
8 changes: 8 additions & 0 deletions testdata/sqllogictests/functions/delta_scan.slt
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,11 @@ select * from delta_scan('./testdata/delta/table1/') order by a;
1 hello
2 world



# aliases
query IT
select * from read_delta('file://${PWD}/testdata/delta/table1/') order by a;
----
1 hello
2 world
6 changes: 6 additions & 0 deletions testdata/sqllogictests_iceberg/local_v2.slt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@ select count(*) = 1000
from iceberg_scan('./testdata/iceberg/tables/lineitem_simple_longversion');
----
t

query T
select count(*) = 1000
from read_iceberg('./testdata/iceberg/tables/lineitem_simple_longversion');
----
t
8 changes: 8 additions & 0 deletions testdata/sqllogictests_object_store/local/lance.slt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ select * from lance_scan('file://${TMP}') order by point.lat;
[0.2, 1.8] {lat:42.1,long:-74.1}
[1.1, 1.2] {lat:45.5,long:-122.7}

# alias
query IT
select * from read_lance('file://${TMP}') order by point.lat;
----
[0.2, 1.8] {lat:42.1,long:-74.1}
[1.1, 1.2] {lat:45.5,long:-122.7}


statement ok
copy (select * from lance_tbl) to '${TMP}' format lance;

Expand Down