Skip to content

Commit 5318811

Browse files
committed
refactor: Remove max_cell_length from DataframeDisplayConfig and related tests
1 parent e7bb5e1 commit 5318811

2 files changed

Lines changed: 0 additions & 29 deletions

File tree

python/datafusion/context.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ def __init__(
8989
self,
9090
max_table_bytes: Optional[int] = None,
9191
min_table_rows: Optional[int] = None,
92-
max_cell_length: Optional[int] = None,
9392
max_table_rows_in_repr: Optional[int] = None,
9493
) -> None:
9594
"""Create a new :py:class:`DataframeDisplayConfig` instance.
@@ -99,8 +98,6 @@ def __init__(
9998
(default: 2MB)
10099
min_table_rows: Minimum number of table rows to display
101100
(default: 20)
102-
max_cell_length: Maximum length of a cell before it gets minimized
103-
(default: 25)
104101
max_table_rows_in_repr: Maximum number of rows to display in repr
105102
string output (default: 10)
106103
"""
@@ -109,14 +106,11 @@ def __init__(
109106
self._validate_positive(max_table_bytes, "max_table_bytes")
110107
if min_table_rows is not None:
111108
self._validate_positive(min_table_rows, "min_table_rows")
112-
if max_cell_length is not None:
113-
self._validate_positive(max_cell_length, "max_cell_length")
114109
if max_table_rows_in_repr is not None:
115110
self._validate_positive(max_table_rows_in_repr, "max_table_rows_in_repr")
116111
self.config_internal = DataframeDisplayConfigInternal(
117112
max_table_bytes=max_table_bytes,
118113
min_table_rows=min_table_rows,
119-
max_cell_length=max_cell_length,
120114
max_table_rows_in_repr=max_table_rows_in_repr,
121115
)
122116

@@ -155,16 +149,6 @@ def min_table_rows(self, value: int) -> None:
155149
self._validate_positive(value, "min_table_rows")
156150
self.config_internal.min_table_rows = value
157151

158-
@property
159-
def max_cell_length(self) -> int:
160-
"""Get the maximum length of a cell before it gets minimized."""
161-
return self.config_internal.max_cell_length
162-
163-
@max_cell_length.setter
164-
def max_cell_length(self, value: int) -> None:
165-
"""Set the maximum length of a cell before it gets minimized."""
166-
self._validate_positive(value, "max_cell_length")
167-
self.config_internal.max_cell_length = value
168152

169153
@property
170154
def max_table_rows_in_repr(self) -> int:
@@ -612,7 +596,6 @@ def with_display_config(
612596
self,
613597
max_table_bytes: Optional[int] = None,
614598
min_table_rows: Optional[int] = None,
615-
max_cell_length: Optional[int] = None,
616599
max_table_rows_in_repr: Optional[int] = None,
617600
) -> SessionContext:
618601
"""Configure the display options for DataFrames.
@@ -622,8 +605,6 @@ def with_display_config(
622605
(default: 2MB)
623606
min_table_rows: Minimum number of table rows to display
624607
(default: 20)
625-
max_cell_length: Maximum length of a cell before it gets minimized
626-
(default: 25)
627608
max_table_rows_in_repr: Maximum number of rows to display in repr
628609
string output (default: 10)
629610
@@ -633,7 +614,6 @@ def with_display_config(
633614
display_config = DataframeDisplayConfig(
634615
max_table_bytes=max_table_bytes,
635616
min_table_rows=min_table_rows,
636-
max_cell_length=max_cell_length,
637617
max_table_rows_in_repr=max_table_rows_in_repr,
638618
)
639619

python/tests/test_dataframe.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,24 +71,20 @@ def test_display_config():
7171
config = DataframeDisplayConfig(
7272
max_table_bytes=1024,
7373
min_table_rows=10,
74-
max_cell_length=15,
7574
max_table_rows_in_repr=5,
7675
)
7776

7877
assert config.max_table_bytes == 1024
7978
assert config.min_table_rows == 10
80-
assert config.max_cell_length == 15
8179
assert config.max_table_rows_in_repr == 5
8280

8381
# Test property setters
8482
config.max_table_bytes = 2048
8583
config.min_table_rows = 20
86-
config.max_cell_length = 30
8784
config.max_table_rows_in_repr = 10
8885

8986
assert config.max_table_bytes == 2048
9087
assert config.min_table_rows == 20
91-
assert config.max_cell_length == 30
9288
assert config.max_table_rows_in_repr == 10
9389

9490
# Test property setter validation
@@ -98,9 +94,6 @@ def test_display_config():
9894
with pytest.raises(ValueError, match="min_table_rows must be greater than 0"):
9995
config.min_table_rows = -1
10096

101-
with pytest.raises(ValueError, match="max_cell_length must be greater than 0"):
102-
config.max_cell_length = 0
103-
10497
with pytest.raises(
10598
ValueError, match="max_table_rows_in_repr must be greater than 0"
10699
):
@@ -140,7 +133,6 @@ def test_display_config_in_init(data, clean_formatter_state):
140133
display_config = DataframeDisplayConfig(
141134
max_table_bytes=1024,
142135
min_table_rows=5,
143-
max_cell_length=10,
144136
max_table_rows_in_repr=3,
145137
)
146138

@@ -152,7 +144,6 @@ def test_display_config_in_init(data, clean_formatter_state):
152144
ctx2 = ctx.with_display_config(
153145
max_table_bytes=1024,
154146
min_table_rows=5,
155-
max_cell_length=10,
156147
max_table_rows_in_repr=3,
157148
)
158149
df2 = ctx2.from_pylist(data)

0 commit comments

Comments
 (0)