Skip to content

Move identifer case tests to sql_integ, add negative cases, Debug for DataFrame#2243

Merged
yjshen merged 4 commits intoapache:masterfrom
alamb:alamb/identifer_test
Apr 16, 2022
Merged

Move identifer case tests to sql_integ, add negative cases, Debug for DataFrame#2243
yjshen merged 4 commits intoapache:masterfrom
alamb:alamb/identifer_test

Conversation

@alamb
Copy link
Copy Markdown
Contributor

@alamb alamb commented Apr 15, 2022

Which issue does this PR close?

Closes #2227

Rationale for this change

Basically so that it is clear what types of identifier comparisons are meant to work

Also, Re cleaning up tests #743

What changes are included in this PR?

  1. Move normalized column identifier tests into sql_integration to hopefully make them more discoverable
  2. Add a negative case (where the query fails) adapted from the great one from @ReggieFan on fix: ‘Invalid identifier #xxx’ caused by Case-to-case conversion in SQL #2211 to make it clear this is expected behavior
  3. Add some Debug impls, so I can use unwrap_err()

Are there any user-facing changes?

Debug impl for DataFame and SessionContext

fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("SessionState")
.field("session_id", &self.session_id)
// TODO should we print out more?
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There are a lot of other fields on SessionState -- I wasn't sure the value of printing them, so I left it as a future todo

Ok(())
}

#[tokio::test]
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Moved out of context.rs and into datafusion/core/tests/sql/idenfifers.rs without change

}

#[tokio::test]
async fn case_insensitive_in_sql_errors() {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is a new test added in this PR, based on the one from @ReggieFan on #2211 to make it clear this is expected behavior

@yjshen yjshen merged commit f5592cf into apache:master Apr 16, 2022
@alamb alamb deleted the alamb/identifer_test branch August 8, 2023 20:12
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.

Add unit test for case-sensitive SQL identifiers

3 participants