Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-4367

enhance TRUNCATE syntax to drop data of external table

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.11.0
    • 4.0.0-alpha-1
    • Query Processor
    • None

    Description

      In my use case ,
      sometimes I have to remove data of external tables to free up storage space of the cluster .
      So it's necessary for to enhance the syntax like
      "TRUNCATE TABLE srcpart_truncate PARTITION (dt='201130412') FORCE;"
      to remove data from EXTERNAL table.

      And I add a configuration property to enable remove data to Trash
      <property>
      <name>hive.truncate.skiptrash</name>
      <value>false</value>
      <description>
      if true will remove data to trash, else false drop data immediately
      </description>
      </property>

      For example :
      hive (default)> TRUNCATE TABLE external1 partition (ds='11');
      FAILED: Error in semantic analysis: Cannot truncate non-managed table external1
      hive (default)> TRUNCATE TABLE external1 partition (ds='11') FORCE;
      [2013-04-16 17:15:52]: Compile Start
      [2013-04-16 17:15:52]: Compile End
      [2013-04-16 17:15:52]: OK
      [2013-04-16 17:15:52]: Time taken: 0.413 seconds

      hive (default)> set hive.truncate.skiptrash;
      hive.truncate.skiptrash=false

      hive (default)> set hive.truncate.skiptrash=true;
      hive (default)> TRUNCATE TABLE external1 partition (ds='12') FORCE;
      [2013-04-16 17:16:21]: Compile Start
      [2013-04-16 17:16:21]: Compile End
      [2013-04-16 17:16:21]: OK
      [2013-04-16 17:16:21]: Time taken: 0.143 seconds

      hive (default)> dfs -ls /user/test/.Trash/Current/;
      Found 1 items
      drwxr-xr-x -test supergroup 0 2013-04-16 17:06 /user/test/.Trash/Current/ds=11

      Attachments

        1. HIVE-4367-1.patch
          7 kB
          caofangkun
        2. HIVE-4367.7.patch
          9 kB
          Jason Dere
        3. HIVE-4367.6.patch
          9 kB
          Jason Dere
        4. HIVE-4367.5.patch
          9 kB
          Jason Dere
        5. HIVE-4367.4.patch
          9 kB
          Jason Dere
        6. HIVE-4367.3.patch
          9 kB
          Jason Dere
        7. HIVE-4367.2.patch.txt
          5 kB
          Navis Ryu

        Issue Links

          Activity

            People

              caofangkun caofangkun
              caofangkun caofangkun
              Votes:
              2 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: