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

fix: add signature for read_excel #2376

Merged
merged 4 commits into from
Jan 8, 2024

Conversation

universalmind303
Copy link
Contributor

closes #2373

> select function_name, parameters from glare_catalog.functions WHERE function_name = 'read_excel';
┌───────────────┬─────────────────────────────────────────────────────────────────────────┐
│ function_name │ parameters                                                              │
│ ──            │ ──                                                                      │
│ Utf8          │ List<Utf8>                                                              │
╞═══════════════╪═════════════════════════════════════════════════════════════════════════╡
│ read_excel    │ [Utf8, Utf8, sheet_name: Utf8, infer_rows: UInt64, has_header: Boolean] │
└───────────────┴─────────────────────────────────────────────────────────────────────────┘

@universalmind303 universalmind303 enabled auto-merge (squash) January 8, 2024 21:35
Copy link
Contributor

@greyscaled greyscaled left a comment

Choose a reason for hiding this comment

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

Quick Q:

In the PR description, why is there two Utf8's in a row?

[Utf8, Utf8, sheet_name: Utf8, infer_rows: UInt64, has_header: Boolean]

The first seems to be for required path arg, but what's the second?

Comment on lines +27 to +33
let options: Fields = vec![
Field::new("sheet_name", DataType::Utf8, true),
Field::new("infer_rows", DataType::UInt64, true),
Field::new("has_header", DataType::Boolean, true),
]
.into_iter()
.collect();
Copy link
Contributor

Choose a reason for hiding this comment

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

From is implemented for Vec<Field> and Fields, so I think FromIterator handlers, which might make this simpler?

To be clear, this is fine, but I definitely stopped and read this three times because it looks wrong. "why are we making a vector, converting it to an iterator and collecting it back into a vector without doing anything else?" and while it compiles and does the thing, mds

If it's easy enough to change I think that would make it better and less likely to confuse other people in the future.

@universalmind303 universalmind303 merged commit 44c28f8 into main Jan 8, 2024
19 checks passed
@universalmind303 universalmind303 deleted the universalmind303/excel-signature branch January 8, 2024 21:45
@universalmind303
Copy link
Contributor Author

universalmind303 commented Jan 8, 2024

Quick Q:

In the PR description, why is there two UTF8's in a row?

Datafusion doesn't really give us that good formatting out of the box for the signatures.

so the first signature is Utf8 -> read_excel('path'), the second is Utf8, sheet_name: Utf8, infer_rows: UInt64, has_header: Boolean -> read_excel('path', options)

@greyscaled I agree that the formatting choices are not great though.

@greyscaled
Copy link
Contributor

Quick Q:
In the PR description, why is there two UTF8's in a row?

Datafusion doesn't really give us that good formatting out of the box for the signatures.

so the first signature is Utf8 -> read_excel('path'), the second is Utf8, sheet_name: Utf8, infer_rows: UInt64, has_header: Boolean -> read_excel('path', options)

@greyscaled I agree that the formatting choices are not great though.

all good, I appreciate the explanation

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.

Parameters for read_excel are empty
4 participants