-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: TableFunction extends Function, supports
LATERAL
prefix
- implements `Function`, extends `FromItem` - supports `LATERAL` prefix - fixes #1835 Signed-off-by: Andreas Reichel <[email protected]>
- Loading branch information
1 parent
41d705b
commit 3963600
Showing
5 changed files
with
107 additions
and
21 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
25 changes: 25 additions & 0 deletions
25
src/test/java/net/sf/jsqlparser/statement/select/TableFunctionTest.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,25 @@ | ||
package net.sf.jsqlparser.statement.select; | ||
|
||
import net.sf.jsqlparser.JSQLParserException; | ||
import net.sf.jsqlparser.test.TestUtils; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class TableFunctionTest { | ||
|
||
@Test | ||
void testLateralFlat() throws JSQLParserException { | ||
String sqlStr = "WITH t AS (\n" + | ||
" SELECT \n" + | ||
" 'ABC' AS dim, \n" + | ||
" ARRAY_CONSTRUCT('item1', 'item2', 'item3') AS user_items\n" + | ||
")\n" + | ||
"SELECT DIM, count(value) as COUNT_\n" + | ||
"FROM t a,\n" + | ||
"LATERAL FLATTEN(input => a.user_items) b\n" + | ||
"group by 1"; | ||
TestUtils.assertSqlCanBeParsedAndDeparsed(sqlStr, true); | ||
} | ||
|
||
} |