JiajunBernoulli commented on code in PR #3399:
URL: https://github.com/apache/calcite/pull/3399#discussion_r1336549292
##########
babel/src/test/java/org/apache/calcite/test/BabelParserTest.java:
##########
@@ -430,6 +431,23 @@ private void checkParseInfixCast(String sqlType) {
f.sql("DISCARD TEMP").same();
}
+ @Test void testSparkLeftAntiJoin() {
+ final SqlParserFixture f = fixture().withDialect(SparkSqlDialect.DEFAULT);
+ final String sql = "select a.cid, a.cname, count(1) as amount\n"
+ + "from geo.area1 as a\n"
+ + "left anti join (select distinct cid, cname\n"
+ + "from geo.area2\n"
+ + "where cname = 'cityA') as b on a.cid = b.cid\n"
+ + "group by a.cid, a.cname";
+ final String expected = "SELECT A.CID, A.CNAME, COUNT(1) AMOUNT\n"
+ + "FROM GEO.AREA1 A\n"
+ + "LEFT ANTI JOIN (SELECT DISTINCT CID, CNAME\n"
+ + "FROM GEO.AREA2\n"
+ + "WHERE (CNAME = 'cityA')) B ON (A.CID = B.CID)\n"
+ + "GROUP BY A.CID, A.CNAME";
+ f.sql(sql).ok(expected);
Review Comment:
This is arbitrary, but unit test needs to demonstrate to demonstrate.
##########
babel/src/test/java/org/apache/calcite/test/BabelParserTest.java:
##########
@@ -430,6 +431,23 @@ private void checkParseInfixCast(String sqlType) {
f.sql("DISCARD TEMP").same();
}
+ @Test void testSparkLeftAntiJoin() {
+ final SqlParserFixture f = fixture().withDialect(SparkSqlDialect.DEFAULT);
+ final String sql = "select a.cid, a.cname, count(1) as amount\n"
+ + "from geo.area1 as a\n"
+ + "left anti join (select distinct cid, cname\n"
+ + "from geo.area2\n"
+ + "where cname = 'cityA') as b on a.cid = b.cid\n"
+ + "group by a.cid, a.cname";
+ final String expected = "SELECT A.CID, A.CNAME, COUNT(1) AMOUNT\n"
+ + "FROM GEO.AREA1 A\n"
+ + "LEFT ANTI JOIN (SELECT DISTINCT CID, CNAME\n"
+ + "FROM GEO.AREA2\n"
+ + "WHERE (CNAME = 'cityA')) B ON (A.CID = B.CID)\n"
+ + "GROUP BY A.CID, A.CNAME";
+ f.sql(sql).ok(expected);
Review Comment:
This is arbitrary, but unit test needs to demonstrate.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]