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

RPAD/LPAD functions fails when padded string is not specified

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0.0
    • 0.4.0
    • Functions - Drill
    • None

    Description

      In oracle and postgres, rpad and lpad functions defaults to spaces when str2 is not specified - rpad(str1, length [, str2]). For example in oracle:

      SQL> select rpad(name,20) from voter where voter_id=10;

      RPAD(NAME,20)
      --------------------
      tom underhill

      SQL> select lpad(name,20) from voter where voter_id=10;

      LPAD(NAME,20)
      --------------------
      tom underhill

      In drill, the queries fail because the str2 parameter is required:

      0: jdbc:drill:schema=dfs> relect lpad(name, 20) from voter where voter_id=10;
      Query failed: org.apache.drill.exec.rpc.RpcException: Remote failure while running query.[error_id: "dde5cf1c-1d05-46c4-902a-c4bd6621c065"
      endpoint {
      address: "qa-node57.qa.lab"
      user_port: 31010
      control_port: 31011
      data_port: 31012
      }
      error_type: 0
      message: "Failure while parsing sql. < SqlParseException:[ Non-query expression encountered in illegal context ] < EigenbaseException:[ Non-query expression encountered in illegal context ]"
      ]

      Attachments

        1. DRILL-575.patch
          3 kB
          Mehant Baid

        Activity

          People

            Unassigned Unassigned
            knguyen Krystal
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: