### Question:
RelToSqlConverter extends SqlImplementor implements ReflectiveVisitor { private SqlCall as(SqlNode e, String alias) { return SqlStdOperatorTable.AS.createCall(POS, e, new SqlIdentifier(alias, POS)); } RelToSqlConverter(SqlDialect dialect); @Override Result visitInput(RelNode parent, int i, boolean anon,
      boolean ignoreClauses, Set<Clause> expectedClauses); Result visit(RelNode e); Result visit(Join e); Result visit(Correlate e); Result visit(Filter e); Result visit(Project e); Result visit(Window e); Result visit(Aggregate e); Result visit(TableScan e); Result visit(Union e); Result visit(Intersect e); Result visit(Minus e); Result visit(Calc e); Result visit(Values e); Result visit(Sort e); boolean hasTrickyRollup(Sort e, Aggregate aggregate); Result visit(TableModify modify); Result visit(Match e); Result visit(Uncollect e); Result visit(TableFunctionScan e); List<SqlNode> createAsFullOperands(RelDataType rowType, SqlNode leftOperand,
      String alias); @Override void addSelect(List<SqlNode> selectList, SqlNode node,
      RelDataType rowType);  }### Answer:
@Test void testSum0BecomesCoalesce() { final Function<RelBuilder, RelNode> fn = b -> b.scan("EMP") .aggregate(b.groupKey(), b.aggregateCall(SqlStdOperatorTable.SUM0, b.field(3)) .as("s")) .build(); final String expectedMysql = "SELECT COALESCE(SUM(`MGR`), 0) AS `s`\n" + "FROM `scott`.`EMP`"; final String expectedPostgresql = "SELECT COALESCE(SUM(\"MGR\"), 0) AS \"s\"\n" + "FROM \"scott\".\"EMP\""; relFn(fn) .withPostgresql() .ok(expectedPostgresql) .withMysql() .ok(expectedMysql); }