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

Fast return when database exists and IF NOT EXISTS clause is enabled

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 4.1.0
    • Hive

    Description

      When use beeline for testing purpose:

      beeline -u jdbc:hive2://
      

      CREATE TABLE IF NOT EXISTS will not print AlreadyExistsException, but CREATE DATABASE IF NOT EXISTS will.
      The error log may be confused because the sql actually execute successfully.
       
      The root cause is that SemanticAnalyzer will fast-return if table exists:
      https://github.com/apache/hive/blob/98d9d22398370f817fe64449368671b978fff096/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java#L14163-L14174

      Attachments

        1. create_database.png
          373 kB
          Wechar
        2. create_table.png
          15 kB
          Wechar

        Issue Links

          Activity

            People

              wechar Wechar
              wechar Wechar
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: