-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:
ParenthesedSelect
can have Alias
Signed-off-by: Andreas Reichel <[email protected]>
- Loading branch information
1 parent
a510f13
commit b5b242a
Showing
3 changed files
with
26 additions
and
1 deletion.
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
23 changes: 23 additions & 0 deletions
23
src/test/java/net/sf/jsqlparser/statement/piped/AsPipeOperatorTest.java
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,23 @@ | ||
package net.sf.jsqlparser.statement.piped; | ||
|
||
import net.sf.jsqlparser.JSQLParserException; | ||
import net.sf.jsqlparser.test.TestUtils; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class AsPipeOperatorTest { | ||
|
||
@Test | ||
void testParseAndDeparse() throws JSQLParserException { | ||
String sqlStr="(\n" + | ||
" SELECT '000123' AS id, 'apples' AS item, 2 AS sales\n" + | ||
" UNION ALL\n" + | ||
" SELECT '000456' AS id, 'bananas' AS item, 5 AS sales\n" + | ||
") AS sales_table\n" + | ||
"|> AGGREGATE SUM(sales) AS total_sales GROUP BY id, item\n" + | ||
"|> AS t1\n" + | ||
"|> JOIN (SELECT 456 AS id, 'yellow' AS color) AS t2\n" + | ||
" ON CAST(t1.id AS INT64) = t2.id\n" + | ||
"|> SELECT t2.id, total_sales, color;"; | ||
TestUtils.assertSqlCanBeParsedAndDeparsed(sqlStr, true); | ||
} | ||
} |