Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: move truncate to DDL

...

  • INSERT OVERWRITE statements to directories, local directories and tables (or partitions) can all be used together within the same query.
  • INSERT OVERWRITE statements to HDFS filesystem directories is the best way to extract large amounts of data from Hive. Hive can write to HDFS directories in parallel from within a map-reduce job.
  • The directory is, as you would expect, OVERWRITten, in other words, if the specified path exists, it is clobbered and replaced with the output.

Truncating tables

Info
titleVersion information

As of Hive 0.10.0 (HIVE-446)

Syntax
Code Block

TRUNCATE TABLE table_name [PARTITION partition_spec];

partition_spec:
  : (partition_col = partition_col_value, partition_col = partiton_col_value, ...)
Synopsis
  • Removes all rows from a table or partition(s).
  • Table should be native/managed table (or exception will be thrown).
Notes
  • User can specify partial partition spec for truncating multiple partitions at once.
  • Without partition spec, all partitions in the table will be truncated.