Skip to content

Commit

Permalink
parquet.py and base.py changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Revan1017 committed Feb 12, 2025
1 parent 21bb162 commit ef8b038
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
17 changes: 8 additions & 9 deletions src/pydiverse/pipedag/backend/table/cache/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,18 @@ def retrieve_table_obj(
return self._retrieve_table_obj(table, as_type)

def _retrieve_table_obj(self, table: Table, as_type: type[T]) -> T:
# try:
if True:
try:
hook = self.get_r_table_hook(as_type)
obj = hook.retrieve(self, table, table.stage.name, as_type)
self.logger.info("Retrieved table from local table cache", table=table)
return obj
# except Exception as e:
# self.logger.error(
# "Failed to retrieve table from local table cache",
# table=table,
# cause=str(e),
# )
# return None
except Exception as e:
self.logger.error(
"Failed to retrieve table from local table cache",
table=table,
cause=str(e),
)
return None

@abstractmethod
def _has_table(self, table: Table, as_type: type) -> bool:
Expand Down
3 changes: 2 additions & 1 deletion src/pydiverse/pipedag/backend/table/cache/parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ def retrieve(

raise ValueError(f"Invalid type {as_type}")


@ParquetTableCache.register_table(pdt_new)
class PydiverseTransformTableHookNew(TableHook[ParquetTableCache]):
@classmethod
Expand Down Expand Up @@ -311,4 +312,4 @@ def retrieve(
df = hook.retrieve(store, table, stage_name, pd.DataFrame)
return pdt.Table(df)

raise ValueError(f"Invalid type {as_type}")
raise ValueError(f"Invalid type {as_type}")

0 comments on commit ef8b038

Please sign in to comment.