forked from OpenLineage/OpenLineage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: add parsing delete statement (OpenLineage#923)
Signed-off-by: Maciej Obuchowski <obuchowski.maciej@gmail.com> Signed-off-by: Will Johnson <will@willj.co>
- Loading branch information
1 parent
ba1ae51
commit 400dedc
Showing
5 changed files
with
66 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright 2018-2022 contributors to the OpenLineage project | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#[macro_use] | ||
mod test_utils; | ||
|
||
use openlineage_sql::SqlMeta; | ||
use test_utils::*; | ||
|
||
#[test] | ||
fn delete_from() { | ||
assert_eq!( | ||
test_sql("DELETE FROM a.b WHERE x = 0",), | ||
SqlMeta { | ||
in_tables: vec![], | ||
out_tables: table("a.b") | ||
} | ||
); | ||
} | ||
|
||
#[test] | ||
fn delete_from_using() { | ||
assert_eq!( | ||
test_sql( | ||
"DELETE FROM a.b AS t | ||
USING ( | ||
SELECT col | ||
FROM b.c | ||
WHERE col = 'x' | ||
) AS duplicates | ||
WHERE a.b.col = duplicates.col", | ||
), | ||
SqlMeta { | ||
in_tables: table("b.c"), | ||
out_tables: table("a.b") | ||
} | ||
); | ||
} |