Venugopal Reddy K created HIVE-27215:
----------------------------------------

             Summary: On DB with defaultTableType property, create external 
table with transactional property as true creates a managed table
                 Key: HIVE-27215
                 URL: https://issues.apache.org/jira/browse/HIVE-27215
             Project: Hive
          Issue Type: Bug
            Reporter: Venugopal Reddy K


*Description:*

On Database created with defaultTableType property, create external table with 
transactional property as true creates a managed table.

*Steps to reproduce:*

Create database with db property defaultTableType either as external or acid. 
And create external table with transactional property set to true or with 
transactional property set to true and transactional_properties=insert_only. 
Table is created as managed table.
{code:java}
0: jdbc:hive2://localhost:10000> create database mydbext with 
dbproperties('defaultTableType'='external');
0: jdbc:hive2://localhost:10000> use mydbext;
0: jdbc:hive2://localhost:10000> create external table test_ext_txn(i string) 
stored as orc tblproperties('transactional'='true');
0: jdbc:hive2://localhost:10000> desc formatted test_ext_txn;

+-------------------------------+----------------------------------------------------+----------------------------------------------------+
|           col_name            |                     data_type                 
     |                      comment                       |
+-------------------------------+----------------------------------------------------+----------------------------------------------------+
| i                             | string                                        
     |                                                    |
|                               | NULL                                          
     | NULL                                               |
| # Detailed Table Information  | NULL                                          
     | NULL                                               |
| Database:                     | mydbext                                       
     | NULL                                               |
| OwnerType:                    | USER                                          
     | NULL                                               |
| Owner:                        | hive                                          
     | NULL                                               |
| CreateTime:                   | Mon Apr 03 23:24:07 IST 2023                  
     | NULL                                               |
| LastAccessTime:               | UNKNOWN                                       
     | NULL                                               |
| Retention:                    | 0                                             
     | NULL                                               |
| Location:                     | 
file:/tmp/warehouse/managed/mydbext.db/test_ext_txn | NULL                      
                         |
| Table Type:                   | MANAGED_TABLE                                 
     | NULL                                               |
| Table Parameters:             | NULL                                          
     | NULL                                               |
|                               | COLUMN_STATS_ACCURATE                         
     | {\"BASIC_STATS\":\"true\",\"COLUMN_STATS\":{\"i\":\"true\"}} |
|                               | bucketing_version                             
     | 2                                                  |
|                               | numFiles                                      
     | 0                                                  |
|                               | numRows                                       
     | 0                                                  |
|                               | rawDataSize                                   
     | 0                                                  |
|                               | totalSize                                     
     | 0                                                  |
|                               | transactional                                 
     | true                                               |
|                               | transactional_properties                      
     | default                                            |
|                               | transient_lastDdlTime                         
     | 1680544447                                         |
|                               | 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                                               |
+-------------------------------+----------------------------------------------------+----------------------------------------------------+
30 rows selected (0.326 seconds)
0: jdbc:hive2://localhost:10000> 
0: jdbc:hive2://localhost:10000> create external table test_ext_txn_ins(i 
string) stored as orc tblproperties('transactional'='true', 
"transactional_properties"="insert_only");
0: jdbc:hive2://localhost:10000> desc formatted test_ext_txn_ins;
+-------------------------------+----------------------------------------------------+----------------------------------------------------+
|           col_name            |                     data_type                 
     |                      comment                       |
+-------------------------------+----------------------------------------------------+----------------------------------------------------+
| i                             | string                                        
     |                                                    |
|                               | NULL                                          
     | NULL                                               |
| # Detailed Table Information  | NULL                                          
     | NULL                                               |
| Database:                     | mydbext                                       
     | NULL                                               |
| OwnerType:                    | USER                                          
     | NULL                                               |
| Owner:                        | hive                                          
     | NULL                                               |
| CreateTime:                   | Mon Apr 03 23:30:21 IST 2023                  
     | NULL                                               |
| LastAccessTime:               | UNKNOWN                                       
     | NULL                                               |
| Retention:                    | 0                                             
     | NULL                                               |
| Location:                     | 
file:/tmp/warehouse/managed/mydbext.db/test_ext_txn_ins | NULL                  
                             |
| Table Type:                   | MANAGED_TABLE                                 
     | NULL                                               |
| Table Parameters:             | NULL                                          
     | NULL                                               |
|                               | COLUMN_STATS_ACCURATE                         
     | {\"BASIC_STATS\":\"true\",\"COLUMN_STATS\":{\"i\":\"true\"}} |
|                               | bucketing_version                             
     | 2                                                  |
|                               | numFiles                                      
     | 0                                                  |
|                               | numRows                                       
     | 0                                                  |
|                               | rawDataSize                                   
     | 0                                                  |
|                               | totalSize                                     
     | 0                                                  |
|                               | transactional                                 
     | true                                               |
|                               | transactional_properties                      
     | insert_only                                        |
|                               | transient_lastDdlTime                         
     | 1680544821                                         |
|                               | 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                                                  |
+-------------------------------+----------------------------------------------------+----------------------------------------------------+
32 rows selected (0.361 seconds)
0: jdbc:hive2://localhost:10000> {code}
 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to