[ 
https://issues.apache.org/jira/browse/HIVE-24271?focusedWorklogId=501112&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-501112
 ]

ASF GitHub Bot logged work on HIVE-24271:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 15/Oct/20 14:27
            Start Date: 15/Oct/20 14:27
    Worklog Time Spent: 10m 
      Work Description: yongzhi commented on a change in pull request #1578:
URL: https://github.com/apache/hive/pull/1578#discussion_r505587450



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
##########
@@ -13212,7 +13212,7 @@ private void updateDefaultTblProps(Map<String, String> 
source, Map<String, Strin
         retValue.put(hive_metastoreConstants.TABLE_TRANSACTIONAL_PROPERTIES,
             TransactionalValidationListener.INSERTONLY_TRANSACTIONAL_PROPERTY);
       }
-      if (makeAcid || isTransactional) {
+      if (makeAcid || isTransactional || (isManaged && !makeInsertOnly)) {

Review comment:
       Do we have the case it is isTransaction = true, isManaged = true and 
makeInsertOnly is false (happen not to set TABLE_TRANSACTIONAL_PROPERTIES.) ?

##########
File path: ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
##########
@@ -13194,16 +13194,16 @@ private void updateDefaultTblProps(Map<String, 
String> source, Map<String, Strin
       }
     }
 
-    boolean makeInsertOnly = !isTemporaryTable && (isManaged && 
HiveConf.getBoolVar(
-        conf, ConfVars.HIVE_CREATE_TABLES_AS_INSERT_ONLY));
-    boolean makeAcid = !isTemporaryTable && !makeInsertOnly && makeAcid();
+    boolean makeInsertOnly = !isTemporaryTable && HiveConf.getBoolVar(
+        conf, ConfVars.HIVE_CREATE_TABLES_AS_INSERT_ONLY);
+    boolean makeAcid = !isTemporaryTable && makeAcid();
     // if not specify managed table and create.table.as.external is true
     // ignore makeInsertOnly and makeAcid.
     if (!isManaged && HiveConf.getBoolVar(conf, 
ConfVars.CREATE_TABLE_AS_EXTERNAL)) {
       makeInsertOnly = false;
       makeAcid = false;
     }
-    if ((makeInsertOnly || makeAcid || isTransactional)
+    if ((makeInsertOnly || makeAcid || isTransactional || isManaged)
         && !isExt  && !isMaterialization && 
StringUtils.isBlank(storageFormat.getStorageHandler())

Review comment:
       I do not understand the logic here: Why isManaged and without explicitly 
saying it is a transactional table, it is an insert-only one?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 501112)
    Time Spent: 0.5h  (was: 20m)

> Create managed table relies on hive.create.as.acid settings.
> ------------------------------------------------------------
>
>                 Key: HIVE-24271
>                 URL: https://issues.apache.org/jira/browse/HIVE-24271
>             Project: Hive
>          Issue Type: Sub-task
>          Components: HiveServer2
>    Affects Versions: 4.0.0
>            Reporter: Naveen Gangam
>            Assignee: Naveen Gangam
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> 0: jdbc:hive2://ngangam-3.ngangam.root.hwx.si> set hive.create.as.acid;
> +----------------------------+
> |            set             |
> +----------------------------+
> | hive.create.as.acid=false  |
> +----------------------------+
> 1 row selected (0.018 seconds)
> 0: jdbc:hive2://ngangam-3.ngangam.root.hwx.si> set hive.create.as.insert.only;
> +-----------------------------------+
> |                set                |
> +-----------------------------------+
> | hive.create.as.insert.only=false  |
> +-----------------------------------+
> 1 row selected (0.013 seconds)
> 0: jdbc:hive2://ngangam-3.ngangam.root.hwx.si> create managed table 
> mgd_table(a int);
> INFO  : Compiling 
> command(queryId=hive_20201014053526_9ba1ffa3-3aa2-47c3-8514-1fe58fe4f140): 
> create managed table mgd_table(a int)
> INFO  : Semantic Analysis Completed (retrial = false)
> INFO  : Created Hive schema: Schema(fieldSchemas:null, properties:null)
> INFO  : Completed compiling 
> command(queryId=hive_20201014053526_9ba1ffa3-3aa2-47c3-8514-1fe58fe4f140); 
> Time taken: 0.021 seconds
> INFO  : Executing 
> command(queryId=hive_20201014053526_9ba1ffa3-3aa2-47c3-8514-1fe58fe4f140): 
> create managed table mgd_table(a int)
> INFO  : Starting task [Stage-0:DDL] in serial mode
> INFO  : Completed executing 
> command(queryId=hive_20201014053526_9ba1ffa3-3aa2-47c3-8514-1fe58fe4f140); 
> Time taken: 0.048 seconds
> INFO  : OK
> No rows affected (0.107 seconds)
> 0: jdbc:hive2://ngangam-3.ngangam.root.hwx.si> describe formatted mgd_table;
> INFO  : Compiling 
> command(queryId=hive_20201014053533_8919be7d-41b0-41e5-b9eb-847801a9d8c5): 
> describe formatted mgd_table
> INFO  : Semantic Analysis Completed (retrial = false)
> INFO  : Created Hive schema: Schema(fieldSchemas:[FieldSchema(name:col_name, 
> type:string, comment:from deserializer), FieldSchema(name:data_type, 
> type:string, comment:from deserializer), FieldSchema(name:comment, 
> type:string, comment:from deserializer)], properties:null)
> INFO  : Completed compiling 
> command(queryId=hive_20201014053533_8919be7d-41b0-41e5-b9eb-847801a9d8c5); 
> Time taken: 0.037 seconds
> INFO  : Executing 
> command(queryId=hive_20201014053533_8919be7d-41b0-41e5-b9eb-847801a9d8c5): 
> describe formatted mgd_table
> INFO  : Starting task [Stage-0:DDL] in serial mode
> INFO  : Completed executing 
> command(queryId=hive_20201014053533_8919be7d-41b0-41e5-b9eb-847801a9d8c5); 
> Time taken: 0.03 seconds
> INFO  : OK
> +-------------------------------+----------------------------------------------------+----------------------------------------------------+
> |           col_name            |                     data_type               
>        |                      comment                       |
> +-------------------------------+----------------------------------------------------+----------------------------------------------------+
> | a                             | int                                         
>        |                                                    |
> |                               | NULL                                        
>        | NULL                                               |
> | # Detailed Table Information  | NULL                                        
>        | NULL                                               |
> | Database:                     | bothfalseonhs2                              
>        | NULL                                               |
> | OwnerType:                    | USER                                        
>        | NULL                                               |
> | Owner:                        | hive                                        
>        | NULL                                               |
> | CreateTime:                   | Wed Oct 14 05:35:26 UTC 2020                
>        | NULL                                               |
> | LastAccessTime:               | UNKNOWN                                     
>        | NULL                                               |
> | Retention:                    | 0                                           
>        | NULL                                               |
> | Location:                     | 
> hdfs://ngangam-3.ngangam.root.hwx.site:8020/warehouse/tablespace/external/hive/bothfalseonhs2.db/mgd_table
>  | NULL                                               |
> | Table Type:                   | EXTERNAL_TABLE                              
>        | NULL                                               |
> | Table Parameters:             | NULL                                        
>        | NULL                                               |
> |                               | COLUMN_STATS_ACCURATE                       
>        | {\"BASIC_STATS\":\"true\",\"COLUMN_STATS\":{\"a\":\"true\"}} |
> |                               | EXTERNAL                                    
>        | TRUE                                               |
> |                               | TRANSLATED_TO_EXTERNAL                      
>        | TRUE                                               |
> |                               | bucketing_version                           
>        | 2                                                  |
> |                               | external.table.purge                        
>        | TRUE                                               |
> |                               | numFiles                                    
>        | 0                                                  |
> |                               | numRows                                     
>        | 0                                                  |
> |                               | rawDataSize                                 
>        | 0                                                  |
> |                               | totalSize                                   
>        | 0                                                  |
> |                               | transient_lastDdlTime                       
>        | 1602653726                                         |
> |                               | NULL                                        
>        | NULL                                               |
> | # Storage Information         | NULL                                        
>        | NULL                                               |
> | SerDe Library:                | org.apache.hadoop.hive.ql.io.orc.OrcSerde   
>        | NULL                                               |
> | InputFormat:                  | 
> org.apache.hadoop.hive.ql.io.orc.OrcInputFormat    | NULL                     
>                           |
> | OutputFormat:                 | 
> org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat   | NULL                     
>                           |
> | Compressed:                   | No                                          
>        | NULL                                               |
> | Num Buckets:                  | -1                                          
>        | NULL                                               |
> | Bucket Columns:               | []                                          
>        | NULL                                               |
> | Sort Columns:                 | []                                          
>        | NULL                                               |
> | Storage Desc Params:          | NULL                                        
>        | NULL                                               |
> |                               | serialization.format                        
>        | 1                                                  |
> +-------------------------------+----------------------------------------------------+----------------------------------------------------+
> 33 rows selected (0.116 seconds)
> 0: jdbc:hive2://ngangam-3.ngangam.root.hwx.si> 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to