File tree Expand file tree Collapse file tree 3 files changed +26
-1
lines changed
main/java/net/sf/jsqlparser/statement/select
test/java/net/sf/jsqlparser/statement/piped Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -132,6 +132,8 @@ javadoc {
132132 options. addBooleanOption(' html5' , true )
133133 }
134134 options. addBooleanOption(" Xdoclint:none" , true )
135+ options. addStringOption(' J-Xmx4g' )
136+ options. addStringOption(' J-Xss2m' )
135137}
136138
137139jar {
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ private static Alias getAliasFromItem(FromItem fromItem) {
7979 TableFunction t = (TableFunction ) fromItem ;
8080 return new Alias (t .getName (), true );
8181 } else {
82- return new Alias (fromItem .getAlias ().getName (), true );
82+ return fromItem . getAlias ()!= null ? new Alias (fromItem .getAlias ().getName (), true ) : null ;
8383 }
8484 }
8585
Original file line number Diff line number Diff line change 1+ package net .sf .jsqlparser .statement .piped ;
2+
3+ import net .sf .jsqlparser .JSQLParserException ;
4+ import net .sf .jsqlparser .test .TestUtils ;
5+ import org .junit .jupiter .api .Test ;
6+
7+ class AsPipeOperatorTest {
8+
9+ @ Test
10+ void testParseAndDeparse () throws JSQLParserException {
11+ String sqlStr ="(\n " +
12+ " SELECT '000123' AS id, 'apples' AS item, 2 AS sales\n " +
13+ " UNION ALL\n " +
14+ " SELECT '000456' AS id, 'bananas' AS item, 5 AS sales\n " +
15+ ") AS sales_table\n " +
16+ "|> AGGREGATE SUM(sales) AS total_sales GROUP BY id, item\n " +
17+ "|> AS t1\n " +
18+ "|> JOIN (SELECT 456 AS id, 'yellow' AS color) AS t2\n " +
19+ " ON CAST(t1.id AS INT64) = t2.id\n " +
20+ "|> SELECT t2.id, total_sales, color;" ;
21+ TestUtils .assertSqlCanBeParsedAndDeparsed (sqlStr , true );
22+ }
23+ }
You can’t perform that action at this time.
0 commit comments