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: read_text table function #2924

Merged
merged 3 commits into from
Apr 24, 2024
Merged

Conversation

universalmind303
Copy link
Contributor

No description provided.

Copy link
Contributor

@tychoish tychoish left a comment

Choose a reason for hiding this comment

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

I think this is fine as is but I have a few questions.

Comment on lines +205 to +213
columns.sort_by(|a, b| a.0.cmp(&b.0));

let batch = RecordBatch::try_new(
schema.clone(),
columns.into_iter().map(|(_, v)| v).collect(),
)?;

let stream = once(async move { Ok(batch) }).boxed();
Ok(stream)
Copy link
Contributor

Choose a reason for hiding this comment

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

let me see if I understand this:

so this is all running (already) inside of an async function/task, and we start another task to convert something into a stream, which produces a record batch that has exactly one row in it?

(I think also that we can call .flatten() to avoid the extra function here; and also the sort is cheap in this case but probably can be enforced procedurally in the code)

select filename from read_text('gs://${GCS_BUCKET_NAME}/multi_csv/**/*', gcp_creds);
----
multi_csv/bikeshare_stations.csv
multi_csv/bikeshare_stations_2.csv
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a way to assert in an SLT that the value that we expect to have data/content isn't empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah we are testing that in testdata/sqllogictests/functions/read_text.slt

query I
select content from read_text('./testdata/blob/hello.txt');
----
hello world

@universalmind303 universalmind303 enabled auto-merge (squash) April 24, 2024 02:37
@universalmind303 universalmind303 merged commit c7f1f06 into main Apr 24, 2024
26 checks passed
@universalmind303 universalmind303 deleted the universalmind303/read-text branch April 24, 2024 02:52
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