Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-6566

JDBC adapter should generate PI function with parentheses in most dialects

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • 1.39.0
    • None

    Description

      Now In Calcite, support the PI function:

      select PI;
      return 3.141592653589793
      

      Jdbc will generate:

      SELECT PI AS "PI" FROM (VALUES (0)) AS "t" ("ZERO");

      However, they always need parentheses when I test in different data sources.

      Spark:

      select PI();
      return 3.141592653589793
      select PI;
      Error in query: cannot resolve '`PI`' given input columns: []; line 1 pos 7;

      Hive:

      select PI();
      return 3.141592653589793
      select PI;
      SemanticException [Error 10004]: Line 1:7 Invalid table alias or column reference 'PI': (possible column names are: ) (state=42000,code=10004)

      Postgresql:

      select PI();
      return 3.141592653589793
      select PI;
      ERROR: column "pi" does not exist

      MySQL:

      select PI();
      return 3.141593
      select PI;
      ERROR 1054 (42S22) at line 1: Unknown column 'PI' in 'field list'

      SQLServer:

      select PI();
      3.1415926535897931
      select PI;

      So I will generate PI() in Jdbc Dialect.

      Attachments

        Issue Links

          Activity

            People

              nobigo xiong duan
              nobigo xiong duan
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated: