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

sqlline's return code is 0 even when it force exits due to failed sql command

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.0.0
    • None
    • None

    Description

      My SQL script looks like this:

      select * from sys.options limit 1;
      select * sys.options; <--- from clause is missing
      select * from sys.options limit 1;
      

      sqlline correctly exists (--force is set to true by default).
      However, return code is '0', which makes scripting challenging.
      It should be set to 1.

      [Wed May 13 17:49:39 root@~ ] # ${DRILL_HOME}/bin/sqlline -u "jdbc:drill:schema=dfs.ctas_parquet"  --run=/root/script.sql
      1/5          select * from sys.options limit 1;
      +------------+------------+------------+------------+------------+------------+------------+------------+
      |    name    |    kind    |    type    |   status   |  num_val   | string_val |  bool_val  | float_val  |
      +------------+------------+------------+------------+------------+------------+------------+------------+
      | drill.exec.rpc.bit.server.retry.delay | LONG       | BOOT       | BOOT       | 500        | null       | null       | null       |
      +------------+------------+------------+------------+------------+------------+------------+------------+
      1 row selected (0.247 seconds)
      2/5          
      3/5          select * sys.options;
      Error: PARSE ERROR: Encountered "." at line 1, column 13.
      Was expecting one of:
          "FROM" ...
          "," ...
      [Error Id: 9da00514-6a96-4d9a-b90a-c903d006c060 on atsqa4-133.qa.lab:31010] (state=,code=0)
      Aborting command set because "force" is false and command failed: "select * sys.options;"
      Closing: org.apache.drill.jdbc.DrillJdbc41Factory$DrillJdbc41Connection
      sqlline version 1.1.6
      [Wed May 13 17:53:56 root@~ ] # echo $?
      0
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            vicky Victoria Markman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: