|
36 | 36 | from hive_metastore.ttypes import ( |
37 | 37 | AlreadyExistsException, |
38 | 38 | CheckLockRequest, |
| 39 | + EnvironmentContext, |
39 | 40 | FieldSchema, |
40 | 41 | InvalidOperationException, |
41 | 42 | LockComponent, |
|
135 | 136 | DEFAULT_LOCK_CHECK_MIN_WAIT_TIME = 0.1 # 100 milliseconds |
136 | 137 | DEFAULT_LOCK_CHECK_MAX_WAIT_TIME = 60 # 1 min |
137 | 138 | DEFAULT_LOCK_CHECK_RETRIES = 4 |
| 139 | +DO_NOT_UPDATE_STATS = "DO_NOT_UPDATE_STATS" |
| 140 | +TRUE = "true" |
138 | 141 |
|
139 | 142 | logger = logging.getLogger(__name__) |
140 | 143 |
|
@@ -539,7 +542,12 @@ def commit_table( |
539 | 542 | metadata_location=updated_staged_table.metadata_location, |
540 | 543 | previous_metadata_location=current_table.metadata_location, |
541 | 544 | ) |
542 | | - open_client.alter_table(dbname=database_name, tbl_name=table_name, new_tbl=hive_table) |
| 545 | + open_client.alter_table_with_environment_context( |
| 546 | + dbname=database_name, |
| 547 | + tbl_name=table_name, |
| 548 | + new_tbl=hive_table, |
| 549 | + environment_context=EnvironmentContext(properties={DO_NOT_UPDATE_STATS: TRUE}), |
| 550 | + ) |
543 | 551 | else: |
544 | 552 | # Table does not exist, create it. |
545 | 553 | hive_table = self._convert_iceberg_into_hive( |
@@ -626,7 +634,12 @@ def rename_table(self, from_identifier: Union[str, Identifier], to_identifier: U |
626 | 634 | tbl = open_client.get_table(dbname=from_database_name, tbl_name=from_table_name) |
627 | 635 | tbl.dbName = to_database_name |
628 | 636 | tbl.tableName = to_table_name |
629 | | - open_client.alter_table(dbname=from_database_name, tbl_name=from_table_name, new_tbl=tbl) |
| 637 | + # open_client.alter_table_with_environment_context( |
| 638 | + # dbname=from_database_name, |
| 639 | + # tbl_name=from_table_name, |
| 640 | + # new_tbl=tbl, |
| 641 | + # environment_context=EnvironmentContext(properties={DO_NOT_UPDATE_STATS: TRUE}), |
| 642 | + # ) |
630 | 643 | except NoSuchObjectException as e: |
631 | 644 | raise NoSuchTableError(f"Table does not exist: {from_table_name}") from e |
632 | 645 | except InvalidOperationException as e: |
|
0 commit comments