[ https://issues.apache.org/jira/browse/HIVE-28307?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Wechar updated HIVE-28307: -------------------------- Description: When use beeline for testing purpose: {code:bash} beeline -u jdbc:hive2:// {code} {{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] was: When use beeline for testing purpose: {code:bash} beeline -u jdbc:hive2:// {code} {{CREATE TABLE IF NOT EXISTS}} will not print {{AlreadyExistsException}}, but {{CREATE DATABASE IF NOT EXISTS}} will. 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 > Fast return when database exists and IF NOT EXISTS clause is enabled > -------------------------------------------------------------------- > > Key: HIVE-28307 > URL: https://issues.apache.org/jira/browse/HIVE-28307 > Project: Hive > Issue Type: Bug > Components: Hive > Reporter: Wechar > Assignee: Wechar > Priority: Major > Attachments: create_database.png, create_table.png > > > When use beeline for testing purpose: > {code:bash} > beeline -u jdbc:hive2:// > {code} > {{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] -- This message was sent by Atlassian Jira (v8.20.10#820010)