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

Planner#parser can't parse TIMESTAMP() function

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Duplicate
    • 1.30.0
    • 1.34.0
    • babel
    • None

    Description

      Both core and babel will parse fail.

            FrameworkConfig coreConfig = Frameworks.newConfigBuilder().build();
            Planner corePlanner = Frameworks.getPlanner(coreConfig);
            corePlanner.parse("SELECT TIMESTAMP('2022-05-21 08:00:00'");
            // Caused by: org.apache.calcite.sql.parser.babel.ParseException: Incorrect syntax near the keyword 'TIMESTAMP' at line 1, column 8.
      
            FrameworkConfig babelConfig = Frameworks.newConfigBuilder()
                .parserConfig(SqlParser.Config.DEFAULT.withParserFactory(
                    SqlBabelParserImpl.FACTORY))
                .build();
            Planner babelPlanner = Frameworks.getPlanner(babelConfig);
            babelPlanner.parse("SELECT TIMESTAMP('2022-05-21 08:00:00'");
            // Caused by: org.apache.calcite.sql.parser.babel.ParseException: Incorrect syntax near the keyword 'TIMESTAMP' at line 1, column 8
      

      Here are some databases that support TIMESTAMP function.

      select timestamp('2022-05-21 08:00:00')
      // result
      timestamp('2022-05-21 08:00:00') 
      2022-05-21 08:00:00
      

      Also, here are some databases that not support TIMESTAMP function:

      select timestamp('2022-05-21 08:00:00')
      //ORA-00923: FROM keyword not found where expected
      
      select timestamp('2022-05-21 08:00:00')
      // Msg 195 Level 15 State 10 Line 1
      // 'timestamp' is not a recognized built-in function name.

      Is it necessary for us to support it in babel module?

      Attachments

        Issue Links

          Activity

            People

              jiajunbernoulli Jiajun Xie
              jiajunbernoulli Jiajun Xie
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: