Skip to content

Commit

Permalink
Polars read and scan Hive partitioned table: path no longer needs a g…
Browse files Browse the repository at this point in the history
…lob pattern after version bump
  • Loading branch information
VillePuuska authored Sep 21, 2024
1 parent e06ba6e commit ed86456
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions uchelper/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,8 @@ def read_table(table: Table) -> pl.DataFrame:
if len(partition_cols) == 0:
df = pl.read_parquet(source=path)
else:
# TODO: There HAS to be a nicer way to do this. Try with Polars >1.0?
df = pl.read_parquet(
source=os.path.join(
path, *["**" for _ in range(len(partition_cols))], "*.parquet"
),
source=path,
hive_partitioning=True,
hive_schema={
col.name: uc_type_to_polars_type(col.data_type)
Expand Down Expand Up @@ -239,11 +236,8 @@ def scan_table(table: Table) -> pl.LazyFrame:
if len(partition_cols) == 0:
df = pl.scan_parquet(source=path)
else:
# TODO: There HAS to be a nicer way to do this. Try with Polars >1.0?
df = pl.scan_parquet(
source=os.path.join(
path, *["**" for _ in range(len(partition_cols))], "*.parquet"
),
source=path,
hive_partitioning=True,
hive_schema={
col.name: uc_type_to_polars_type(col.data_type)
Expand Down

0 comments on commit ed86456

Please sign in to comment.