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 EXISTS tests #68

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
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 @@ -38,7 +38,7 @@
},
"operator": {
"type": "other",
"name": "like"
"name": "_like"
},
"value": {
"type": "scalar",
Expand Down
2 changes: 0 additions & 2 deletions crates/ndc-sqlserver/tests/query_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ mod predicates {
insta::assert_json_snapshot!(result);
}

/*
// fix exists implementation
#[tokio::test]
async fn select_where_unrelated_exists() {
Expand All @@ -110,7 +109,6 @@ mod predicates {
let result = run_query("select_where_related_exists").await;
insta::assert_json_snapshot!(result);
}
*/
}

mod sorting {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ expression: result
{
"rows": [
{
"title": "Santana",
"albums": {
"rows": [
{
Expand All @@ -18,8 +19,7 @@ expression: result
"title": "Santana Live"
}
]
},
"title": "Santana"
}
}
]
}
Expand Down
6 changes: 3 additions & 3 deletions crates/query-engine/sql/src/sql/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ impl Join {
sql.append_syntax(")");
sql.append_syntax(" AS ");
join.alias.to_sql(sql);
sql.append_syntax(" ON ('true') ");
sql.append_syntax(" ON (1 = 1) ");
Copy link
Contributor

Choose a reason for hiding this comment

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

yum

Copy link
Contributor

Choose a reason for hiding this comment

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

would just 1 work?

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 had hoped so, but no.

}
Join::CrossJoin(join) => {
sql.append_syntax(" CROSS JOIN ");
Expand Down Expand Up @@ -411,8 +411,8 @@ impl Value {
Value::Character(s) => sql.append_param(Param::String(s.clone())),
Value::String(s) => sql.append_param(Param::String(s.clone())),
Value::Variable(v) => sql.append_param(Param::Variable(v.clone())),
Value::Bool(true) => sql.append_syntax("true"),
Value::Bool(false) => sql.append_syntax("false"),
Value::Bool(true) => sql.append_syntax("1 = 1"),
Value::Bool(false) => sql.append_syntax("1 = 0"),
Value::Null => sql.append_syntax("null"),
Value::Array(items) => {
sql.append_syntax("ARRAY [");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ FROM
WHERE
(
(
true
1 = 1
AND ([1_artist].[Name] = cast(@P1 as varchar))
)
AND ([0_album].[ArtistId] = [1_artist].[ArtistId])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ FROM
[0_Track].[AlbumId] = [9_BOOLEXP_Album].[AlbumId]
)
)
) AS [9_BOOLEXP_Album] ON ('true')
) AS [9_BOOLEXP_Album] ON (1 = 1)
INNER JOIN (
SELECT
*
Expand All @@ -73,7 +73,7 @@ FROM
[0_Track].[AlbumId] = [10_BOOLEXP_Album].[AlbumId]
)
)
) AS [10_BOOLEXP_Album] ON ('true')
) AS [10_BOOLEXP_Album] ON (1 = 1)
INNER JOIN (
SELECT
*
Expand All @@ -88,7 +88,7 @@ FROM
[10_BOOLEXP_Album].[ArtistId] = [11_BOOLEXP_Artist].[ArtistId]
)
)
) AS [11_BOOLEXP_Artist] ON ('true')
) AS [11_BOOLEXP_Artist] ON (1 = 1)
WHERE
(
[9_BOOLEXP_Album].[AlbumId] > [11_BOOLEXP_Artist].[ArtistId]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ FROM
(
[0_Artist].[ArtistId] = [5_BOOLEXP_Album].[ArtistId]
)
) AS [5_BOOLEXP_Album] ON ('true')
) AS [5_BOOLEXP_Album] ON (1 = 1)
WHERE
(
[5_BOOLEXP_Album].[Title] LIKE cast(@P1 as varchar)
Expand Down