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

Allow RelBuilder to make calls to EXTRACT

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 1.12.0, 1.11.0
    • None
    • core
    • None

    Description

      EXTRACT_DATE was originally intended to be an internal function, always created by translating a call to EXTRACT.

      Currently this makes the EXTRACT_DATE function rather awkward to use:

      SqlOperator op = new SqlSpecialOperator("EXTRACT_DATE", SqlKind.EXTRACT, 2, true, ReturnTypes.INTEGER, null, null);
      builder.call(op, builder.getRexBuilder().makeFlag(TimeUnitRange.YEAR), builder.field(1, 0, "my_date"));
      

      julianhyde suggests calling EXTRACT directly and then have RelBuilder invoke a convertlet to translate into calls to EXTRACT_DATE or date-time arithmetic.

      Mailing list discussion:
      http://mail-archives.apache.org/mod_mbox/calcite-dev/201705.mbox/%3CCAPSgeET9OVWkvGsGXAezqhqP3Zd2dmXxs0k-J92WZM32%2BMq3kw%40mail.gmail.com%3E

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              chris-baynes Chris Baynes
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: