Skip to content

Commit

Permalink
Fix EXISTS tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljharvey committed Nov 14, 2023
1 parent ba3c1ef commit 1a69e90
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 13 deletions.
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) ");
}
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

0 comments on commit 1a69e90

Please sign in to comment.