Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use Spark for tests
  • Loading branch information
Fokko committed Mar 18, 2024
commit 99df81e634192354b54822f9af08a44f69d13f3f
2 changes: 1 addition & 1 deletion pyiceberg/table/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3061,7 +3061,7 @@ def snapshots(self) -> "pa.Table":
additional_properties = None

snapshots.append({
'committed_at': datetime.datetime.fromtimestamp(snapshot.timestamp_ms / 1000.0),
'committed_at': datetime.datetime.utcfromtimestamp(snapshot.timestamp_ms / 1000.0),
'snapshot_id': snapshot.snapshot_id,
'parent_id': snapshot.parent_snapshot_id,
'operation': str(operation),
Expand Down
15 changes: 15 additions & 0 deletions tests/integration/test_writes.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.
# pylint:disable=redefined-outer-name
import math
import os
import time
import uuid
Expand Down Expand Up @@ -720,3 +721,17 @@ def test_inspect_snapshots(
('total-position-deletes', '0'),
('total-equality-deletes', '0'),
]

lhs = spark.table(f"{identifier}.snapshots").toPandas()
rhs = df.to_pandas()
for column in df.column_names:
for left, right in zip(lhs[column].to_list(), rhs[column].to_list()):
if column == 'summary':
# Arrow returns a list of tuples, instead of a dict
right = dict(right)

if isinstance(left, float) and math.isnan(left) and isinstance(right, float) and math.isnan(right):
# NaN != NaN in Python
continue

assert left == right, f"Difference in column {column}: {left} != {right}"