Implement conversion from JSON Structure to Iceberg schema - #90
Conversation
Additional RequirementsDocumentationThe README.md file needs to be updated to include documentation for this new conversion feature, following the pattern established for existing conversions. TestingAll tests must follow the established testing patterns:
This follows the pattern established for the Avro conversion tests in the repository. |
| actual_schema = pa.ipc.read_schema(f) | ||
|
|
||
| # Compare the schemas | ||
| self.assertEqual( |
There was a problem hiding this comment.
@copilot I am slightly skeptical that this assertion works on schemas, does it?
There was a problem hiding this comment.
You're right to be skeptical. I've verified that PyArrow schema comparison does work with ==, but I've updated the test to use the more explicit .equals() method instead of assertEqual() for clarity (commit ffa8c65).
The comparison works correctly:
- Uses
schema.equals()which compares field names, types, and nullability - Ignores field metadata (like auto-incremented field IDs), which is desirable for our use case
- Properly detects differences (verified with test cases)
- All 11 tests still pass
|
@copilot give an assessment of the feature coverage against the core spec https://json-structure.github.io/core/draft-vasters-json-structure-core.html |
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: clemensv <542030+clemensv@users.noreply.github.com>
Co-authored-by: clemensv <542030+clemensv@users.noreply.github.com>
Co-authored-by: clemensv <542030+clemensv@users.noreply.github.com>
ffa8c65 to
52d1240
Compare
|
@copilot explain how you created the reference schemas |
The reference schemas were created by running the
The reference files are serialized PyArrow schemas that contain:
These serve as the expected output for regression testing. The test suite reads both the reference and newly-generated schemas using |
Implementation Complete ✓
This PR implements the
s2ibcommand to convert JSON Structure schemas to Apache Iceberg schemas.Changes Made
Module Implementation (commit 6898c35):
avrotize/structuretoiceberg.pyfollowing patterns fromavrotoiceberg.pys2ibcommand incommands.jsonTesting (commits 6898c35, 77548dd, latest):
test/test_structuretoiceberg.pywith 11 test cases.struct-ref.iceberg) for all 10 test struct files.equals()methodDocumentation (commit 77548dd):
s2ibto README table of contentsa2ibpatternVerification
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.