Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-10202

Beeline outputs prompt+query on standard output when used in non-interactive mode

    XMLWordPrintableJSON

Details

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

    Description

      When passing a SQL script file to Hive CLI, the prompt+query is not sent to the standard output nor standard error. This is totally fine because users might want to send only the query results to the standard output, and parse the results from it.

      In the case of BeeLine, the promp+query is sent to the standard output causing extra parsing on the user scripts to avoid reading the prompt+query.

      Another drawback is in the security side. Sensitive queries are logged directly to the files where the standard output is redirected.

      How to reproduce:

      $ cat /tmp/query.sql 
      select * 
      from test
      limit 1;
      
      $ beeline --showheader=false --outputformat=tsv2 -u jdbc:hive2://localhost:10000 -f /tmp/query.sql > /tmp/output.log 2> /tmp/error.log
      
      $ cat /tmp/output.log
      0: jdbc:hive2://localhost:10000> select * 
      . . . . . . . . . . . . . . . .> from test
      . . . . . . . . . . . . . . . .> limit 1; 
      451	451.713	false	y2dh7	["866","528","936"]
      0: jdbc:hive2://localhost:10000>
      

      We should avoid sending the prompt+query to the standard output/error whenever a script file is passed to BeeLine.

      Attachments

        1. HIVE-10202.patch
          2 kB
          Naveen Gangam

        Issue Links

          Activity

            People

              ngangam Naveen Gangam
              spena Sergio Peña
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: