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

Type inference for SqlLeadLagAggFunction is incorrect

    XMLWordPrintableJSON

Details

    Description

      Currently the LeadLag operator does not use the default value when inferring the type of a column.

      For the following example:

      SELECT lead(c * 2, 1, -1.4) OVER (PARTITION BY x ORDER BY c) FROM t
      

      The column 'c' has type INTEGER, and Calcite infers a type of INTEGER for the result. However, the default value for the lead is -1.4, which is DECIMAL, so the result type should be DECIMAL.

      Currently Calcite only uses the nullability of the default value, but not its type in the result type inference.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mbudiu Mihai Budiu
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: