Skip to content

Commit a0a581f

Browse files
committed
fix formatting
1 parent 15cdc2b commit a0a581f

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

python/datafusion/context.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545

4646
import pandas as pd
4747
import polars as pl
48-
import pyarrow as pa
4948

5049
from datafusion.plan import ExecutionPlan, LogicalPlan
5150

@@ -1169,17 +1168,23 @@ def _convert_table_partition_cols(
11691168
elif data_type == "int":
11701169
converted_data_type = pa.int32()
11711170
else:
1172-
raise ValueError(
1173-
f"Unsupported literal data type '{data_type}' for partition column. Supported types are 'string' and 'int'"
1171+
message = (
1172+
f"Unsupported literal data type '{data_type}' for partition "
1173+
"column. Supported types are 'string' and 'int'"
11741174
)
1175+
raise ValueError(message)
11751176
else:
11761177
converted_data_type = data_type
11771178

11781179
converted_table_partition_cols.append((col, converted_data_type))
11791180

11801181
if warn:
1182+
message = (
1183+
"using literals for table_partition_cols data types is deprecated,"
1184+
"use pyarrow types instead"
1185+
)
11811186
warnings.warn(
1182-
"using literals for table_partition_cols data types is deprecated, use pyarrow types instead",
1187+
message,
11831188
category=DeprecationWarning,
11841189
stacklevel=2,
11851190
)

python/tests/test_sql.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,9 @@ def test_register_parquet(ctx, tmp_path):
157157
assert result.to_pydict() == {"cnt": [100]}
158158

159159

160-
@pytest.mark.parametrize("path_to_str,legacy_data_type", [(True, False), (False, False), (False, True)] )
160+
@pytest.mark.parametrize(
161+
("path_to_str", "legacy_data_type"), [(True, False), (False, False), (False, True)]
162+
)
161163
def test_register_parquet_partitioned(ctx, tmp_path, path_to_str, legacy_data_type):
162164
dir_root = tmp_path / "dataset_parquet_partitioned"
163165
dir_root.mkdir(exist_ok=False)
@@ -177,7 +179,7 @@ def test_register_parquet_partitioned(ctx, tmp_path, path_to_str, legacy_data_ty
177179

178180
dir_root = str(dir_root) if path_to_str else dir_root
179181

180-
partition_data_type = 'string' if legacy_data_type else pa.string()
182+
partition_data_type = "string" if legacy_data_type else pa.string()
181183

182184
ctx.register_parquet(
183185
"datapp",

0 commit comments

Comments
 (0)