Closed giulianopz closed 1 year ago
Thanks for the info ! I will fix this asap. Did you check the scala connector and it gives the same error?
No, but I tried the Python bindings for delta-rs which seem to work:
import pathlib
from deltalake import DeltaTable
dt = DeltaTable("../delta-go/tests/golden/snapshot-data0")
print(dt.schema().json())
for f in dt.schema().fields:
print(f.name)
print(f.type)
--------------------
{'type': 'struct', 'fields': [{'name': 'col1', 'type': 'integer', 'nullable': True, 'metadata': {}}, {'name': 'col2', 'type': 'string', 'nullable': True, 'metadata': {}}]}
col1
PrimitiveType("integer")
col2
PrimitiveType("string")
@giulianopz i fixed this bug and merge it into master now.
When getting the schema from the metadata of a given delta table,
Metadata.Schema()
fails due to a type conversion error.To reproduce the error, run this slightly modified test in the repo:
This is the json schema which the lib fails to parse:
The problem is caused by the func
nameToType
expecting to match the string "int" toIntegerType
instead ofinteger
. The Delta protocol mentions "integer" as a primitive type, not "int". I know that this Go implementation closely mirrors the Scala native library, so I cannot really understand why this error happens. Additionally, as far as I know, no breaking changes altered the protocol with respect to the schema serialization format.