Skip to content

Commit 9a65e83

Browse files
authored
chore: fix Multimodal Gemini modifies input DF (#1467)
* chore: add experimental blob url tests * fix * chore: fix Multimodal Gemini modifies input DF * fix
1 parent be50982 commit 9a65e83

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

bigframes/core/convert.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def to_bf_series(
5454
bigframes.pandas.Series
5555
"""
5656
if isinstance(obj, series.Series):
57-
return obj
57+
return obj.copy()
5858

5959
if session is None:
6060
session = global_session.get_global_session()
@@ -118,7 +118,7 @@ def to_bf_dataframe(
118118
session: Optional[session.Session] = None,
119119
) -> dataframe.DataFrame:
120120
if isinstance(obj, dataframe.DataFrame):
121-
return obj
121+
return obj.copy()
122122

123123
if isinstance(obj, pd.DataFrame):
124124
if session is None:

tests/system/small/core/test_convert.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,7 @@ def test_to_bf_dataframe(input, session):
5656
def test_to_bf_dataframe_with_bf_dataframe(session):
5757
bf = dataframe.DataFrame({"test": [1, 2, 3]}, session=session)
5858

59-
assert convert.to_bf_dataframe(bf, None, session) is bf
59+
testing.assert_frame_equal(
60+
convert.to_bf_dataframe(bf, None, session).to_pandas(),
61+
bf.to_pandas(),
62+
)

tests/unit/ml/test_golden_sql.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def mock_y(mock_session):
6666
mock_y._session = mock_session
6767
mock_y.columns = pd.Index(["input_column_label"])
6868
mock_y.cache.return_value = mock_y
69+
mock_y.copy.return_value = mock_y
6970

7071
return mock_y
7172

@@ -98,6 +99,7 @@ def mock_X(mock_y, mock_session):
9899
)
99100

100101
mock_X.cache.return_value = mock_X
102+
mock_X.copy.return_value = mock_X
101103

102104
return mock_X
103105

0 commit comments

Comments
 (0)