Skip to content

Commit

Permalink
chore: add duckdb delta test (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
eakmanrq authored Aug 31, 2024
1 parent 75f3e2d commit 13f1c11
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 0 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{"commitInfo":{"timestamp":1725137989496,"operation":"WRITE","operationParameters":{"mode":"ErrorIfExists","partitionBy":"[]"},"isolationLevel":"Serializable","isBlindAppend":true,"operationMetrics":{"numFiles":"6","numOutputRows":"5","numOutputBytes":"7800"},"engineInfo":"Apache-Spark/3.5.2 Delta-Lake/3.2.0","txnId":"17633aa0-b065-49d6-9893-022103f7364e"}}
{"metaData":{"id":"73709a6c-bb75-4ac7-a78e-635400886d74","format":{"provider":"parquet","options":{}},"schemaString":"{\"type\":\"struct\",\"fields\":[{\"name\":\"employee_id\",\"type\":\"integer\",\"nullable\":true,\"metadata\":{}},{\"name\":\"fname\",\"type\":\"string\",\"nullable\":true,\"metadata\":{}},{\"name\":\"lname\",\"type\":\"string\",\"nullable\":true,\"metadata\":{}},{\"name\":\"age\",\"type\":\"integer\",\"nullable\":true,\"metadata\":{}},{\"name\":\"store_id\",\"type\":\"integer\",\"nullable\":true,\"metadata\":{}}]}","partitionColumns":[],"configuration":{},"createdTime":1725137987547}}
{"protocol":{"minReaderVersion":1,"minWriterVersion":2}}
{"add":{"path":"part-00002-3fed7f18-370f-4b16-b232-504d6194eb52-c000.snappy.parquet","partitionValues":{},"size":1437,"modificationTime":1725137989427,"dataChange":true,"stats":"{\"numRecords\":1,\"minValues\":{\"employee_id\":1,\"fname\":\"Jack\",\"lname\":\"Shephard\",\"age\":37,\"store_id\":1},\"maxValues\":{\"employee_id\":1,\"fname\":\"Jack\",\"lname\":\"Shephard\",\"age\":37,\"store_id\":1},\"nullCount\":{\"employee_id\":0,\"fname\":0,\"lname\":0,\"age\":0,\"store_id\":0}}"}}
{"add":{"path":"part-00004-143c5da1-d5ab-4706-8e84-0d2a324c6894-c000.snappy.parquet","partitionValues":{},"size":1417,"modificationTime":1725137989428,"dataChange":true,"stats":"{\"numRecords\":1,\"minValues\":{\"employee_id\":2,\"fname\":\"John\",\"lname\":\"Locke\",\"age\":65,\"store_id\":1},\"maxValues\":{\"employee_id\":2,\"fname\":\"John\",\"lname\":\"Locke\",\"age\":65,\"store_id\":1},\"nullCount\":{\"employee_id\":0,\"fname\":0,\"lname\":0,\"age\":0,\"store_id\":0}}"}}
{"add":{"path":"part-00006-64f07e25-c30e-4075-acc6-b3c69c4ce80b-c000.snappy.parquet","partitionValues":{},"size":1424,"modificationTime":1725137989428,"dataChange":true,"stats":"{\"numRecords\":1,\"minValues\":{\"employee_id\":3,\"fname\":\"Kate\",\"lname\":\"Austen\",\"age\":37,\"store_id\":2},\"maxValues\":{\"employee_id\":3,\"fname\":\"Kate\",\"lname\":\"Austen\",\"age\":37,\"store_id\":2},\"nullCount\":{\"employee_id\":0,\"fname\":0,\"lname\":0,\"age\":0,\"store_id\":0}}"}}
{"add":{"path":"part-00008-89ccad8d-df73-4ad5-8850-82ef3884db60-c000.snappy.parquet","partitionValues":{},"size":1459,"modificationTime":1725137989427,"dataChange":true,"stats":"{\"numRecords\":1,\"minValues\":{\"employee_id\":4,\"fname\":\"Claire\",\"lname\":\"Littleton\",\"age\":27,\"store_id\":2},\"maxValues\":{\"employee_id\":4,\"fname\":\"Claire\",\"lname\":\"Littleton\",\"age\":27,\"store_id\":2},\"nullCount\":{\"employee_id\":0,\"fname\":0,\"lname\":0,\"age\":0,\"store_id\":0}}"}}
{"add":{"path":"part-00010-812b3382-8c7f-4c4e-9bcd-09ce8664f6e0-c000.snappy.parquet","partitionValues":{},"size":1417,"modificationTime":1725137989428,"dataChange":true,"stats":"{\"numRecords\":1,\"minValues\":{\"employee_id\":5,\"fname\":\"Hugo\",\"lname\":\"Reyes\",\"age\":29,\"store_id\":100},\"maxValues\":{\"employee_id\":5,\"fname\":\"Hugo\",\"lname\":\"Reyes\",\"age\":29,\"store_id\":100},\"nullCount\":{\"employee_id\":0,\"fname\":0,\"lname\":0,\"age\":0,\"store_id\":0}}"}}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
16 changes: 16 additions & 0 deletions tests/integration/engines/duck/test_duckdb_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,19 @@ def test_employee_extra_line_csv_multiple(duckdb_session: DuckDBSession):
),
Row(**{"employee_id": 5, "fname": "Hugo", "lname": "Reyes", "age": 29, "store_id": 100}),
]


def test_employee_delta(duckdb_session: DuckDBSession):
df = duckdb_session.read.load(
"tests/fixtures/employee_delta",
format="delta",
)
assert df.collect() == [
Row(**{"employee_id": 1, "fname": "Jack", "lname": "Shephard", "age": 37, "store_id": 1}),
Row(**{"employee_id": 2, "fname": "John", "lname": "Locke", "age": 65, "store_id": 1}),
Row(**{"employee_id": 3, "fname": "Kate", "lname": "Austen", "age": 37, "store_id": 2}),
Row(
**{"employee_id": 4, "fname": "Claire", "lname": "Littleton", "age": 27, "store_id": 2}
),
Row(**{"employee_id": 5, "fname": "Hugo", "lname": "Reyes", "age": 29, "store_id": 100}),
]

0 comments on commit 13f1c11

Please sign in to comment.