Skip to content

Commit

Permalink
chore: remove duplicate get files
Browse files Browse the repository at this point in the history
  • Loading branch information
ion-elgreco committed Aug 20, 2024
1 parent 9825361 commit bc783cf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 26 deletions.
3 changes: 0 additions & 3 deletions python/deltalake/_internal.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ class RawDeltaTable:
def protocol_versions(self) -> List[Any]: ...
def load_version(self, version: int) -> None: ...
def load_with_datetime(self, ds: str) -> None: ...
def files_by_partitions(
self, partitions_filters: Optional[FilterType]
) -> List[str]: ...
def files(self, partition_filters: Optional[FilterType]) -> List[str]: ...
def file_uris(self, partition_filters: Optional[FilterType]) -> List[str]: ...
def vacuum(
Expand Down
10 changes: 8 additions & 2 deletions python/deltalake/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,12 +700,18 @@ def schema(self) -> DeltaSchema:
"""
return self._table.schema

def files_by_partitions(self, partition_filters: Optional[FilterType]) -> List[str]:
def files_by_partitions(self, partition_filters: FilterType) -> List[str]:
"""
Get the files for each partition
"""
return self._table.files_by_partitions(partition_filters)
warnings.warn(
"files_by_partitions is deprecated, please use DeltaTable.files() instead.",
category=DeprecationWarning,
stacklevel=2,
)

return self.files(partition_filters) # type: ignore

def metadata(self) -> Metadata:
"""
Expand Down
22 changes: 1 addition & 21 deletions python/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,26 +270,6 @@ impl RawDeltaTable {
})
}

pub fn files_by_partitions(
&self,
py: Python,
partitions_filters: Vec<(PyBackedStr, PyBackedStr, PartitionFilterValue)>,
) -> PyResult<Vec<String>> {
py.allow_threads(|| {
let partition_filters = convert_partition_filters(partitions_filters);
match partition_filters {
Ok(filters) => Ok(self
._table
.get_files_by_partitions(&filters)
.map_err(PythonError::from)?
.into_iter()
.map(|p| p.to_string())
.collect()),
Err(err) => Err(PythonError::from(err).into()),
}
})
}

pub fn files(
&self,
py: Python,
Expand Down Expand Up @@ -961,7 +941,7 @@ impl RawDeltaTable {
) -> PyResult<Vec<(String, Option<Bound<'py, PyAny>>)>> {
let path_set = match partition_filters {
Some(filters) => Some(HashSet::<_>::from_iter(
self.files_by_partitions(py, filters)?.iter().cloned(),
self.files(py, Some(filters))?.iter().cloned(),
)),
None => None,
};
Expand Down

0 comments on commit bc783cf

Please sign in to comment.