这是indexloc提供的服务,不要输入任何密码
Skip to content

escape field names in relation mappings when necessary #113

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

Conversation

hallettj
Copy link
Collaborator

@hallettj hallettj commented Oct 8, 2024

Previously on attempts to join on field names that require escaping the request would fail with an error saying that a name was not valid. This change does the necessary escaping to make the join work.

This is the last change that was needed to get rid of safe_name which was the quick-and-easy fail-on-problematic-names solution that we used early on.

Comment on lines +899 to +900
#[tokio::test]
async fn filters_by_field_nested_in_object_in_related_collection() -> Result<(), anyhow::Error>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I found this ancient, forgotten test so I uncommented it.

Comment on lines +70 to +73
// If there is a single column mapping, and the source and target field references can be
// expressed as match keys (we don't need to escape field names), then we can use a concise
// correlated subquery. Otherwise we need to fall back to an uncorrelated subquery.
let safe_single_column_mapping = if column_mapping.len() == 1 {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The meat of the changes starts here

Copy link
Contributor

@daniel-chambers daniel-chambers left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -35,6 +36,12 @@ fn get_connector_chinook_url() -> anyhow::Result<Url> {
Ok(url)
}

fn get_connector_test_cases_url() -> anyhow::Result<Url> {
let input = env::var(CONNECTOR_TEST_CASES_URL).map_err(|_| anyhow!("please set {CONNECTOR_TEST_CASES_URL} to the the base URL of a running MongoDB connector instance"))?;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
let input = env::var(CONNECTOR_TEST_CASES_URL).map_err(|_| anyhow!("please set {CONNECTOR_TEST_CASES_URL} to the the base URL of a running MongoDB connector instance"))?;
let input = env::var(CONNECTOR_TEST_CASES_URL).map_err(|_| anyhow!("please set {CONNECTOR_TEST_CASES_URL} to the base URL of a running MongoDB connector instance"))?;

@hallettj hallettj merged commit 91987d9 into main Oct 9, 2024
1 check passed
@hallettj hallettj deleted the jessehallett/eng-973-use-columnref-instead-of-safe_name-to-produce-lookup-stages branch October 9, 2024 23:38
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