-
Notifications
You must be signed in to change notification settings - Fork 590
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(source): Avro with AWS Glue Schema Registry (#17605)
- Loading branch information
1 parent
3765be3
commit a1c735a
Showing
13 changed files
with
652 additions
and
145 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
control substitution on | ||
|
||
system ok | ||
rpk topic delete 'glue-sample-my-event' | ||
|
||
system ok | ||
rpk topic create 'glue-sample-my-event' | ||
|
||
system ok | ||
rpk topic produce -f '%v{hex}\n' 'glue-sample-my-event' <<EOF | ||
03005af405ef11b5444281a2e0563e5a734606666f6f80868dc8ebd98404 | ||
EOF | ||
|
||
statement ok | ||
create source t with ( | ||
connector = 'kafka', | ||
properties.bootstrap.server='${RISEDEV_KAFKA_BOOTSTRAP_SERVERS}', | ||
topic = 'glue-sample-my-event') | ||
format plain encode avro ( | ||
aws.glue.schema_arn = 'arn:aws:glue:ap-southeast-1:123456123456:schema/default-registry/MyEvent', | ||
aws.glue.mock_config = '{ | ||
"by_id":{ | ||
"5af405ef-11b5-4442-81a2-e0563e5a7346": { | ||
"type": "record", | ||
"name": "MyEvent", | ||
"fields": [ | ||
{ | ||
"name": "f1", | ||
"type": "string" | ||
}, | ||
{ | ||
"name": "f2", | ||
"type": { | ||
"type": "long", | ||
"logicalType": "timestamp-micros" | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
"arn_to_latest_id":{ | ||
"arn:aws:glue:ap-southeast-1:123456123456:schema/default-registry/MyEvent": "5af405ef-11b5-4442-81a2-e0563e5a7346" | ||
} | ||
}'); | ||
|
||
query TT | ||
select * from t; | ||
---- | ||
foo 2006-01-02 22:04:05.123456+00:00 | ||
|
||
statement ok | ||
alter source t format plain encode avro ( | ||
aws.glue.schema_arn = 'arn:aws:glue:ap-southeast-1:123456123456:schema/default-registry/MyEvent', | ||
aws.glue.mock_config = '{ | ||
"by_id":{ | ||
"5af405ef-11b5-4442-81a2-e0563e5a7346": { | ||
"type": "record", | ||
"name": "MyEvent", | ||
"fields": [ | ||
{ | ||
"name": "f1", | ||
"type": "string" | ||
}, | ||
{ | ||
"name": "f2", | ||
"type": { | ||
"type": "long", | ||
"logicalType": "timestamp-micros" | ||
} | ||
} | ||
] | ||
}, | ||
"4516411b-b1e7-4e67-839f-3ef1b8c29280": { | ||
"type": "record", | ||
"name": "MyEvent", | ||
"fields": [ | ||
{ | ||
"name": "f1", | ||
"type": "string" | ||
}, | ||
{ | ||
"name": "f2", | ||
"type": { | ||
"type": "long", | ||
"logicalType": "timestamp-micros" | ||
} | ||
}, | ||
{ | ||
"name": "f3", | ||
"type": ["null", "bytes"], | ||
"default": null | ||
} | ||
] | ||
} | ||
}, | ||
"arn_to_latest_id":{ | ||
"arn:aws:glue:ap-southeast-1:123456123456:schema/default-registry/MyEvent": "4516411b-b1e7-4e67-839f-3ef1b8c29280" | ||
} | ||
}'); | ||
|
||
query TTT | ||
select * from t; | ||
---- | ||
foo 2006-01-02 22:04:05.123456+00:00 NULL | ||
|
||
system ok | ||
rpk topic produce -f '%v{hex}\n' 'glue-sample-my-event' <<EOF | ||
03004516411bb1e74e67839f3ef1b8c292800441428089b5e9a886ee050208deadbeef | ||
EOF | ||
|
||
query TTT | ||
select * from t order by 2; | ||
---- | ||
foo 2006-01-02 22:04:05.123456+00:00 NULL | ||
AB 2022-04-08 00:00:00.123456+00:00 \xdeadbeef | ||
|
||
statement ok | ||
drop source t; | ||
|
||
system ok | ||
rpk topic delete 'glue-sample-my-event' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.