You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Vlad Rozov (Jira)" <ji...@apache.org> on 2025/06/29 19:26:00 UTC

[jira] [Created] (HIVE-29054) Truncate table should not work for EXTERNAL tables

Vlad Rozov created HIVE-29054:
---------------------------------

             Summary: Truncate table should not work for EXTERNAL tables
                 Key: HIVE-29054
                 URL: https://issues.apache.org/jira/browse/HIVE-29054
             Project: Hive
          Issue Type: Bug
          Components: Hive
    Affects Versions: 4.1.0
            Reporter: Vlad Rozov


{code:java}
0: jdbc:hive2://> create table t1 (i int);
No rows affected (3.784 seconds)
0: jdbc:hive2://> insert into t1 values (1);
25/06/29 12:22:08 [HiveServer2-Background-Pool: Thread-686]: WARN ql.Driver: Hive-on-MR is deprecated in Hive 2 and may not be available in the future versions. Consider using a different execution engine (i.e. tez) or using Hive 1.X releases.
Query ID = vrozov_20250629122207_ba777397-52d7-4c3b-b60c-6372ab854bfe
Total jobs = 3
Launching Job 1 out of 3
Number of reduce tasks determined at compile time: 1
In order to change the average load for a reducer (in bytes):
  set hive.exec.reducers.bytes.per.reducer=<number>
In order to limit the maximum number of reducers:
  set hive.exec.reducers.max=<number>
In order to set a constant number of reducers:
  set mapreduce.job.reduces=<number>
25/06/29 12:22:08 [HiveServer2-Background-Pool: Thread-686]: WARN impl.MetricsSystemImpl: JobTracker metrics system already initialized!
25/06/29 12:22:08 [HiveServer2-Background-Pool: Thread-686]: WARN impl.MetricsSystemImpl: JobTracker metrics system already initialized!
25/06/29 12:22:08 [HiveServer2-Background-Pool: Thread-686]: WARN mapreduce.JobResourceUploader: Hadoop command-line option parsing not performed. Implement the Tool interface and execute your application with ToolRunner to remedy this.
Job running in-process (local Hadoop)
25/06/29 12:22:08 [pool-26-thread-1]: WARN impl.MetricsSystemImpl: JobTracker metrics system already initialized!
WARN  : Hive-on-MR is deprecated in Hive 2 and may not be available in the future versions. Consider using a different execution engine (i.e. tez) or using Hive 1.X releases.
2025-06-29 12:22:09,442 Stage-1 map = 100%,  reduce = 100%, Cumulative CPU 1.3 sec
MapReduce Total cumulative CPU time: 1 seconds 300 msec
Ended Job = job_local1375981122_0003
Stage-4 is selected by condition resolver.
Stage-3 is filtered out by condition resolver.
Stage-5 is filtered out by condition resolver.
Moving data to directory file:/user/hive/warehouse/t1/.hive-staging_hive_2025-06-29_12-22-07_950_7384495465674809150-1/-ext-10000
Time taken to move files:        1 ms
Loading data to table default.t1
25/06/29 12:22:09 [HiveServer2-Background-Pool: Thread-686]: WARN metadata.Hive: Cannot get a table snapshot for t1
Time taken to move files:        1 ms
25/06/29 12:22:09 [HiveServer2-Background-Pool: Thread-686]: WARN metadata.Hive: Cannot get a table snapshot for t1
StatsTask took 90
MapReduce Jobs Launched: 
Stage-Stage-1:  Cumulative CPU: 1.3 sec   HDFS Read: 0 HDFS Write: 0 SUCCESS
Total MapReduce CPU Time Spent: 1 seconds 300 msec
1 row affected (1.66 seconds)
0: jdbc:hive2://> describe formatted t1;
+-------------------------------+----------------------------------------------------+----------------------------------------------------+
|           col_name            |                     data_type                      |                      comment                       |
+-------------------------------+----------------------------------------------------+----------------------------------------------------+
| i                             | int                                                |                                                    |
|                               | NULL                                               | NULL                                               |
| # Detailed Table Information  | NULL                                               | NULL                                               |
| Database:                     | default                                            | NULL                                               |
| OwnerType:                    | USER                                               | NULL                                               |
| Owner:                        | vrozov                                             | NULL                                               |
| CreateTime:                   | Sun Jun 29 12:21:52 PDT 2025                       | NULL                                               |
| LastAccessTime:               | UNKNOWN                                            | NULL                                               |
| Retention:                    | 0                                                  | NULL                                               |
| Location:                     | file:/user/hive/warehouse/t1                       | NULL                                               |
| Table Type:                   | EXTERNAL_TABLE                                     | NULL                                               |
| Table Parameters:             | NULL                                               | NULL                                               |
|                               | COLUMN_STATS_ACCURATE                              | {\"BASIC_STATS\":\"true\",\"COLUMN_STATS\":{\"i\":\"true\"}} |
|                               | EXTERNAL                                           | TRUE                                               |
|                               | TRANSLATED_TO_EXTERNAL                             | TRUE                                               |
|                               | bucketing_version                                  | 2                                                  |
|                               | external.table.purge                               | TRUE                                               |
|                               | numFiles                                           | 1                                                  |
|                               | numRows                                            | 1                                                  |
|                               | rawDataSize                                        | 1                                                  |
|                               | totalSize                                          | 2                                                  |
|                               | transient_lastDdlTime                              | 1751224929                                         |
|                               | 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                                                  |
+-------------------------------+----------------------------------------------------+----------------------------------------------------+
33 rows selected (0.05 seconds)
0: jdbc:hive2://> truncate t1;
No rows affected (2.573 seconds)
0: jdbc:hive2://> select * from t1;
25/06/29 12:22:55 [f8b4b566-f7a5-432b-a49a-80211623cf4f main]: WARN optimizer.SimpleFetchOptimizer: Cannot determine basic stats for table: default@t1 from metastore. Falling back.
+-------+
| t1.i  |
+-------+
+-------+
No rows selected (0.077 seconds)
0: jdbc:hive2://>  {code}



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