|
38 | 38 | from pyiceberg.catalog.rest import RestCatalog
|
39 | 39 | from pyiceberg.catalog.sql import SqlCatalog
|
40 | 40 | from pyiceberg.exceptions import NoSuchTableError
|
| 41 | +from pyiceberg.expressions import In |
41 | 42 | from pyiceberg.io.pyarrow import _dataframe_to_data_files
|
42 | 43 | from pyiceberg.partitioning import PartitionField, PartitionSpec
|
43 | 44 | from pyiceberg.schema import Schema
|
44 | 45 | from pyiceberg.table import TableProperties
|
45 | 46 | from pyiceberg.transforms import IdentityTransform
|
46 |
| -from pyiceberg.types import IntegerType, LongType, NestedField |
| 47 | +from pyiceberg.types import IntegerType, LongType, NestedField, StringType |
47 | 48 | from utils import _create_table
|
48 | 49 |
|
49 | 50 |
|
@@ -1309,3 +1310,27 @@ def test_table_v1_with_null_nested_namespace(session_catalog: Catalog, arrow_tab
|
1309 | 1310 |
|
1310 | 1311 | # We expect no error here
|
1311 | 1312 | session_catalog.drop_table(identifier)
|
| 1313 | + |
| 1314 | + |
| 1315 | +@pytest.mark.integration |
| 1316 | +def test_overwrite_all_data_with_filter(session_catalog: Catalog) -> None: |
| 1317 | + schema = Schema( |
| 1318 | + NestedField(1, "id", StringType(), required=True), |
| 1319 | + NestedField(2, "name", StringType(), required=False), |
| 1320 | + identifier_field_ids=[1], |
| 1321 | + ) |
| 1322 | + |
| 1323 | + data = pa.Table.from_pylist( |
| 1324 | + [ |
| 1325 | + {"id": "1", "name": "Amsterdam"}, |
| 1326 | + {"id": "2", "name": "San Francisco"}, |
| 1327 | + {"id": "3", "name": "Drachten"}, |
| 1328 | + ], |
| 1329 | + schema=schema.as_arrow(), |
| 1330 | + ) |
| 1331 | + |
| 1332 | + identifier = "default.test_overwrite_all_data_with_filter" |
| 1333 | + tbl = _create_table(session_catalog, identifier, data=[data], schema=schema) |
| 1334 | + tbl.overwrite(data, In("id", ["1", "2", "3"])) |
| 1335 | + |
| 1336 | + assert len(tbl.scan().to_arrow()) == 3 |
0 commit comments