Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-11293

Add COMPACT command for Iceberg tables

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Won't Fix
    • None
    • None
    • Frontend
    • ghx-label-14

    Description

      Currently Impala cannot compact Iceberg tables.

      The following INSERT OVERWRITE statement could be used in the simple cases, i.e. when the following conditions meet:

      • all data files use the same partition spec (i.e. no partition evolution)
      • no bucket partitioning (we currently forbid INSERT OVERWRITE for bucket partitioning)
      INSERT OVERWRITE t SELECT * FROM t;

      We could have a command that compacts the Iceberg table (syntax needs to be the same with Hive), e.g.:

      ALTER TABLE t EXECUTE compaction();

      At first, the compact command could be just rewritten to the INSERT OVERWRITE command, but it would also check that there's no partition evolution.

      The "no bucket" partitioning condition could be relaxed in this case, because the result would be deterministic. I.e. the only condition we need to check is that there was no partition evolution.

      Later, we could do compaction by

      TRUNCATE TABLE t;
      INSERT INTO t SELECT * FROM t FOR SYSTEM_TIME AS OF ...;

      Currently time-travel queries are not optimized, but we could workaround it by doing planning at first of:

      Create the plan for:
      TRUNCATE TABLE t;
      INSERT INTO t SELECT * FROM t;

      Then execute them:

      Actually execute:
      TRUNCATE TABLE t;
      INSERT INTO t SELECT * FROM t; (no need for time-travel, plan was created before TRUNCATE)

      This could workaround the planning overhead of time-travel queries.

      Also, we might add some locking for the table if possible.

      Attachments

        Issue Links

          Activity

            People

              tmate Tamas Mate
              boroknagyz Zoltán Borók-Nagy
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: