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: use fat arrows for options #3012

Merged
merged 3 commits into from
Jun 6, 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
8 changes: 6 additions & 2 deletions crates/parser/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -895,8 +895,12 @@ impl<'a> GlareDbParser<'a> {
// normalize it.
let key = self.parser.parse_identifier(false)?.value;

// Optional `=`
let _ = self.parser.consume_token(&Token::Eq);
// Optional `=` or `=>`
for token in [Token::Eq, Token::RArrow] {
if self.parser.consume_token(&token) {
break;
}
}

let value = self.parse_options_value()?;

Expand Down
5 changes: 5 additions & 0 deletions testdata/sqllogictests/credential.slt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ CREATE OR REPLACE CREDENTIALS slt_cred PROVIDER debug
OPTIONS (table_type = 'never_ending')
COMMENT 'creds-for-slt-2';

statement ok
CREATE OR REPLACE CREDENTIALS slt_cred PROVIDER debug
OPTIONS (table_type => 'never_ending')
COMMENT 'creds-for-slt-2';

query TT rowsort
SELECT credentials_name, comment
FROM glare_catalog.credentials
Expand Down
12 changes: 12 additions & 0 deletions testdata/sqllogictests/xlsx.slt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ create external table multi_report from excel options(location='./testdata/xlsx/
statement ok
create external table quarter_projection from excel options(location='./testdata/xlsx/multiple_sheets.xlsx', sheet_name='cost_projection', has_header='true');

statement ok
create external table arrow_options from excel options(location=>'./testdata/xlsx/multiple_sheets.xlsx', sheet_name='cost_projection', has_header='true');

statement ok
create external table basic_report from excel options(location='./testdata/xlsx/userdata1.xlsx', has_header='false');

Expand Down Expand Up @@ -98,6 +101,15 @@ select "Resources", "Cost", "Revenue" from quarter_projection;
4 40 400
5 50 500

query
select "Resources", "Cost", "Revenue" from arrow_options;
----
1 10 100
2 20 200
3 30 300
4 40 400
5 50 500

statement ok
drop table basic_report;

Expand Down
10 changes: 10 additions & 0 deletions testdata/sqllogictests_bigquery/large_table.slt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,14 @@ CREATE EXTERNAL TABLE large_table
table_id = 'bikeshare_trips'
);

statement ok
CREATE EXTERNAL TABLE large_table_arrow_options
FROM bigquery
OPTIONS (
service_account_key => '${GCP_SERVICE_ACCOUNT_KEY}',
project_id => '${GCP_PROJECT_ID}',
dataset_id => '${BIGQUERY_DATASET_ID}',
table_id => 'bikeshare_trips'
);

include ${PWD}/testdata/sqllogictests_datasources_common/include/large_table.slti
8 changes: 8 additions & 0 deletions testdata/sqllogictests_iceberg/s3.slt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ CREATE CREDENTIALS aws_creds
secret_access_key = '${AWS_SECRET_ACCESS_KEY}',
);

statement ok
CREATE CREDENTIALS aws_creds_arrow_specification
PROVIDER aws
OPTIONS (
access_key_id => '${AWS_ACCESS_KEY_ID}',
secret_access_key => '${AWS_SECRET_ACCESS_KEY}',
);


# iceberg_snapshots

Expand Down
9 changes: 9 additions & 0 deletions testdata/sqllogictests_postgres/basic.slt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,13 @@ CREATE EXTERNAL TABLE basic
table = 'bikeshare_stations'
);

statement ok
CREATE EXTERNAL TABLE basic_arrow_specification
FROM postgres
OPTIONS (
connection_string => '${POSTGRES_CONN_STRING}',
schema => 'public',
table => 'bikeshare_stations'
);

include ${PWD}/testdata/sqllogictests_datasources_common/include/basic.slti