Skip to content

[BUGFIX] Compare type dict column name with actual column name with casefold. … #11064

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ def _validate(
actual_column_type = [
type_dict["type"]
for type_dict in actual_column_types_list
if type_dict["name"] == column_name
if type_dict["name"].casefold() == column_name.casefold()
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for contributing. I agree that an IndexError is onerous for a user to debug and we should make this easier. I don't this this is a viable solution though because a table can have column names where casing matters. For example, a postgres database may have a table, MyTable, with quoted columns of different types called "MyColumn" and "mycolumn". These column names would be identical using casefold.
Different databases may use different quoting characters for column names, eg ", ', `. Also, in pandas column names are case sensitive and spark can be configurable to have case sensitive column names.

To fix this, making a better error message might be easier than changing the behavior of the expectation.

][0]

if isinstance(execution_engine, PandasExecutionEngine):
Expand Down
Loading