xiong duan created CALCITE-7335:
-----------------------------------

             Summary: RelToSqlConverter generate sql containing Scala 
subqueries includes redundant parentheses
                 Key: CALCITE-7335
                 URL: https://issues.apache.org/jira/browse/CALCITE-7335
             Project: Calcite
          Issue Type: Bug
            Reporter: xiong duan


The UT in RelToSqlConverterTest:
{code:java}
@Test void testScalarSubqueryInSelectList() {
  final String sql2 = "" +
      "select\n" +
      "        (SELECT\n" +
      "          COUNT(*)\n" +
      "        FROM\n" +
      "           \"employee\"" +
      "        WHERE\n" +
      "           v.\"product_id\" >= 2), 3\n" +
      "from \"product\" as v";
  final String expected = "SELECT (((SELECT COUNT(*)\nFROM 
\"foodmart\".\"employee\"\nWHERE \"product\".\"product_id\" >= 2))), 3\n" +
      "FROM \"foodmart\".\"product\"";
  sql(sql2).ok(expected);
} {code}
{code:java}
(((SELECT COUNT(*)\nFROM \"foodmart\".\"employee\"\nWHERE 
\"product\".\"product_id\" >= 2)))
{code}
should be:
{code:java}
(SELECT COUNT(*)\nFROM \"foodmart\".\"employee\"\nWHERE 
\"product\".\"product_id\" >= 2){code}
The result with redundant parentheses is correct but not sufficiently 
standardized.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to