[ https://issues.apache.org/jira/browse/HIVE-25963?focusedWorklogId=771080&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-771080 ]
ASF GitHub Bot logged work on HIVE-25963: ----------------------------------------- Author: ASF GitHub Bot Created on: 17/May/22 00:20 Start Date: 17/May/22 00:20 Worklog Time Spent: 10m Work Description: github-actions[bot] closed pull request #3040: HIVE-25963: Create temporary table with not null constraint gets converted to external table URL: https://github.com/apache/hive/pull/3040 Issue Time Tracking ------------------- Worklog Id: (was: 771080) Time Spent: 3h (was: 2h 50m) > Temporary table creation with not null constraint gets converted to external > table > ----------------------------------------------------------------------------------- > > Key: HIVE-25963 > URL: https://issues.apache.org/jira/browse/HIVE-25963 > Project: Hive > Issue Type: Bug > Components: HiveServer2, Standalone Metastore > Reporter: Sourabh Goyal > Assignee: Sourabh Goyal > Priority: Major > Labels: pull-request-available > Time Spent: 3h > Remaining Estimate: 0h > > When creating a temporary table with not null, constraint it gets covered to > external table. For example: > create temporary table t2 (a int not null); > table t2' metadata looks like: > {code:java} > +-------------------------------+----------------------------------------------------+----------------------------------------------------+ > | col_name | data_type > | comment | > +-------------------------------+----------------------------------------------------+----------------------------------------------------+ > | a | int > | | > | | NULL > | NULL | > | # Detailed Table Information | NULL > | NULL | > | Database: | default > | NULL | > | OwnerType: | USER > | NULL | > | Owner: | sourabh > | NULL | > | CreateTime: | Tue Feb 15 15:20:13 PST 2022 > | NULL | > | LastAccessTime: | UNKNOWN > | NULL | > | Retention: | 0 > | NULL | > | Location: | > hdfs://localhost:9000/tmp/hive/sourabh/80d374a8-cd7a-4fcf-ae72-51b04ff9c3d8/_tmp_space.db/4574446d-c144-48f9-b4b6-2e9ee0ce5be4 > | 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 > | 1644967213 | > | | NULL > | NULL | > | # Storage Information | NULL > | NULL | > | SerDe Library: | > org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe | NULL > | > | InputFormat: | org.apache.hadoop.mapred.TextInputFormat > | NULL | > | OutputFormat: | > org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat | NULL > | > | Compressed: | No > | NULL | > | Num Buckets: | -1 > | NULL | > | Bucket Columns: | [] > | NULL | > | Sort Columns: | [] > | NULL | > | Storage Desc Params: | NULL > | NULL | > | | serialization.format > | 1 | > | | NULL > | NULL | > | # Constraints | NULL > | NULL | > | | NULL > | NULL | > | # Not Null Constraints | NULL > | NULL | > | Table: | default.t2 > | NULL | > | Constraint Name: | nn_157620106_1644967213860_0 > | NULL | > | Column Name: | a > | NULL | > | | NULL > | NULL | > +-------------------------------+----------------------------------------------------+----------------------------------------------------+ > {code} > However if a temporary table is created *without,* not null constraint, it > works as expected. For example: > create temporary table t5 (a int); > > {code:java} > +-------------------------------+----------------------------------------------------+----------------------------------------------------+ > | col_name | data_type > | comment | > +-------------------------------+----------------------------------------------------+----------------------------------------------------+ > | a | int > | | > | | NULL > | NULL | > | # Detailed Table Information | NULL > | NULL | > | Database: | default > | NULL | > | OwnerType: | USER > | NULL | > | Owner: | sourabh > | NULL | > | CreateTime: | Tue Feb 15 15:34:44 PST 2022 > | NULL | > | LastAccessTime: | UNKNOWN > | NULL | > | Retention: | 0 > | NULL | > | Location: | > hdfs://localhost:9000/tmp/hive/sourabh/22fcb5c1-b9a6-4d51-8efc-86d7c167a242/_tmp_space.db/0515167f-ca1a-4c53-a1de-e4385fc96079 > | NULL | > | Table Type: | MANAGED_TABLE > | NULL | > | Table Parameters: | NULL > | NULL | > | | COLUMN_STATS_ACCURATE > | {\"BASIC_STATS\":\"true\",\"COLUMN_STATS\":{\"a\":\"true\"}} | > | | bucketing_version > | 2 | > | | numFiles > | 0 | > | | numRows > | 0 | > | | rawDataSize > | 0 | > | | totalSize > | 0 | > | | NULL > | NULL | > | # Storage Information | NULL > | NULL | > | SerDe Library: | > org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe | NULL > | > | InputFormat: | org.apache.hadoop.mapred.TextInputFormat > | NULL | > | OutputFormat: | > org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat | NULL > | > | Compressed: | No > | NULL | > | Num Buckets: | -1 > | NULL | > | Bucket Columns: | [] > | NULL | > | Sort Columns: | [] > | NULL | > | Storage Desc Params: | NULL > | NULL | > | | serialization.format > | 1 | > +-------------------------------+----------------------------------------------------+----------------------------------------------------+ > > {code} > Temporary tables are managed tables as HS2 keeps them in memory. Their > metadata is not persisted in HMS. > But the above temp table t2 got converted into external table metadata for > which gets persisted into HMS which is not the desired behavior. > -- This message was sent by Atlassian Jira (v8.20.7#820007)