@@ -1809,78 +1809,25 @@ public void joinWithGroupByShouldThrowException() throws SqlParseException {
18091809 }
18101810
18111811 @ Test
1812- public void joinWithCountFunctionShouldThrowException () throws SqlParseException {
1813- expectJoinAggregationException ();
1814-
1815- String query =
1816- String .format (
1817- Locale .ROOT ,
1818- "SELECT COUNT(*) FROM %s/account a "
1819- + "JOIN %s/account b ON a.account_number = b.account_number" ,
1820- TestsConstants .TEST_INDEX_ACCOUNT ,
1821- TestsConstants .TEST_INDEX_ACCOUNT );
1822-
1823- parser .parseJoinSelect ((SQLQueryExpr ) queryToExpr (query ));
1824- }
1825-
1826- @ Test
1827- public void joinWithSumFunctionShouldThrowException () throws SqlParseException {
1828- expectJoinAggregationException ();
1829-
1830- String query =
1831- String .format (
1832- Locale .ROOT ,
1833- "SELECT SUM(a.balance) FROM %s/account a "
1834- + "JOIN %s/account b ON a.account_number = b.account_number" ,
1835- TestsConstants .TEST_INDEX_ACCOUNT ,
1836- TestsConstants .TEST_INDEX_ACCOUNT );
1837-
1838- parser .parseJoinSelect ((SQLQueryExpr ) queryToExpr (query ));
1839- }
1840-
1841- @ Test
1842- public void joinWithAvgFunctionShouldThrowException () throws SqlParseException {
1843- expectJoinAggregationException ();
1844-
1845- String query =
1846- String .format (
1847- Locale .ROOT ,
1848- "SELECT AVG(a.age) FROM %s/account a "
1849- + "JOIN %s/account b ON a.account_number = b.account_number" ,
1850- TestsConstants .TEST_INDEX_ACCOUNT ,
1851- TestsConstants .TEST_INDEX_ACCOUNT );
1852-
1853- parser .parseJoinSelect ((SQLQueryExpr ) queryToExpr (query ));
1854- }
1812+ public void joinWithAggregateFunctionsShouldThrowException () throws SqlParseException {
1813+ String [] aggregateFunctions = {
1814+ "COUNT(*)" , "SUM(a.balance)" , "AVG(a.age)" , "MAX(a.balance)" , "MIN(a.age)"
1815+ };
18551816
1856- @ Test
1857- public void joinWithMaxFunctionShouldThrowException () throws SqlParseException {
1858- expectJoinAggregationException ();
1817+ for (String aggregateFunction : aggregateFunctions ) {
1818+ expectJoinAggregationException ();
18591819
1860- String query =
1861- String .format (
1862- Locale .ROOT ,
1863- "SELECT MAX(a.balance) FROM %s/account a "
1864- + "JOIN %s/account b ON a.account_number = b.account_number" ,
1865- TestsConstants .TEST_INDEX_ACCOUNT ,
1866- TestsConstants .TEST_INDEX_ACCOUNT );
1867-
1868- parser .parseJoinSelect ((SQLQueryExpr ) queryToExpr (query ));
1869- }
1870-
1871- @ Test
1872- public void joinWithMinFunctionShouldThrowException () throws SqlParseException {
1873- expectJoinAggregationException ();
1874-
1875- String query =
1876- String .format (
1877- Locale .ROOT ,
1878- "SELECT MIN(a.age) FROM %s/account a "
1879- + "JOIN %s/account b ON a.account_number = b.account_number" ,
1880- TestsConstants .TEST_INDEX_ACCOUNT ,
1881- TestsConstants .TEST_INDEX_ACCOUNT );
1820+ String query =
1821+ String .format (
1822+ Locale .ROOT ,
1823+ "SELECT %s FROM %s/account a "
1824+ + "JOIN %s/account b ON a.account_number = b.account_number" ,
1825+ aggregateFunction ,
1826+ TestsConstants .TEST_INDEX_ACCOUNT ,
1827+ TestsConstants .TEST_INDEX_ACCOUNT );
18821828
1883- parser .parseJoinSelect ((SQLQueryExpr ) queryToExpr (query ));
1829+ parser .parseJoinSelect ((SQLQueryExpr ) queryToExpr (query ));
1830+ }
18841831 }
18851832
18861833 @ Test
0 commit comments