Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-6370

Mod operator % is documented, but not available

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 1.13.0
    • None
    • None

    Description

      The Operators page in the documentation states that the % operator does modulo division. The first issue is that % is listed in the precedence table, but not the math operator table.

      Suppose we try to use the operator:

      SELECT 10 % 3 FROM (VALUES(1));
      
      Error: PARSE ERROR: Percent remainder '%' is not allowed under the
        current SQL conformance level
      

      It seems that if we list the operator, we should support it. Or, failing that, add a note to say that the % operator is not currently supported.

      The workaround is to use the mod() function:

      SELECT mod(10, 3) FROM (VALUES(1));
      +---------+
      | EXPR$0  |
      +---------+
      | 1       |
      +---------+
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            paul-rogers Paul Rogers
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: