Skip to content

Commit

Permalink
dt/datalake: update schema_evolution_test.py
Browse files Browse the repository at this point in the history
  • Loading branch information
oleiman committed Jan 17, 2025
1 parent 7d0f340 commit 5c61d98
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions tests/rptest/tests/datalake/schema_evolution_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,15 @@
"name": "VerifierRecord",
"fields": [
{
"name": "verifier_string",
"type": "string"
"name": "another",
"type": [
"null",
"float"
]
},
{
"name": "ordinal",
"type": "long"
},
{
"name": "another",
"type": "float"
}
]
}
Expand Down Expand Up @@ -174,9 +173,12 @@ def get_qe():
return dl.trino()

self._create_schema("schema_avro", schema_avro)
# drop a field, add an optional field, change order
self._create_schema("legal_evo_schema_avro", legal_evo_schema_avro)
# drop the optional field, reintroduce the previously dropped one (it should get a fresh ID)
self._create_schema("legal_evo_schema_avro_2",
legal_evo_schema_avro_2)
# illegal type promotion string -> double
self._create_schema("illegal_evo_schema_avro",
illegal_evo_schema_avro)

Expand All @@ -198,22 +200,21 @@ def run_verifier(schema: str, mapping: str):
verifier.wait()

run_verifier("schema_avro",
mapping=f"""
mapping="""
root.verifier_string = uuid_v4()
root.ordinal = counter()
""")

# again w/ a new schema (extra field and promoted ordinal)
run_verifier("legal_evo_schema_avro",
mapping=f"""
root.verifier_string = uuid_v4()
mapping="""
root.another = {"float": 12.0}
root.ordinal = counter()
root.another = 12.0
""")

# remove the extra field and do it one more time
run_verifier("legal_evo_schema_avro_2",
mapping=f"""
mapping="""
root.verifier_string = uuid_v4()
root.ordinal = counter()
""")
Expand Down

0 comments on commit 5c61d98

Please sign in to comment.