Skip to content

Commit

Permalink
Add more tests for json logical type conversion (#8725)
Browse files Browse the repository at this point in the history
  • Loading branch information
tuliren committed Dec 12, 2021
1 parent 6843bc1 commit 5adb1d1
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -706,5 +706,77 @@
"active": "true"
}
}
},
{
"schemaName": "logical_type_date_time_fields",
"namespace": "namespace15",
"appendAirbyteFields": false,
"jsonSchema": {
"type": "object",
"properties": {
"date_time_field": {
"type": "string",
"format": "date-time"
},
"date_field": {
"type": "string",
"format": "date"
},
"time_field": {
"type": "string",
"format": "time"
}
}
},
"jsonObject": {
"date_time_field": "2021-01-01T01:01:01+01:00",
"date_field": "2021-01-01",
"time_field": "12:23:01.541"
},
"avroSchema": {
"type": "record",
"name": "logical_type_date_time_fields",
"namespace": "namespace15",
"fields": [
{
"name": "date_time_field",
"type": [
"null",
{ "type": "long", "logicalType": "timestamp-micros" },
"string"
],
"default": null
},
{
"name": "date_field",
"type": [
"null",
{ "type": "int", "logicalType": "date" },
"string"
],
"default": null
},
{
"name": "time_field",
"type": [
"null",
{ "type": "long", "logicalType": "time-micros" },
"string"
],
"default": null
},
{
"name": "_airbyte_additional_properties",
"type": ["null", { "type": "map", "values": "string" }],
"default": null
}
]
},
"avroObject": {
"date_time_field": 1609459261000000,
"date_field": 18628,
"time_field": 44581541000,
"_airbyte_additional_properties": null
}
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,41 @@
"oneOf": [{ "type": "string" }, { "type": "integer" }]
},
"avroFieldType": ["null", "string", "int"]
},
{
"fieldName": "logical_type_date_time",
"jsonFieldSchema": {
"type": "string",
"format": "date-time"
},
"avroFieldType": [
"null",
{ "type": "long", "logicalType": "timestamp-micros" },
"string"
]
},
{
"fieldName": "logical_type_date",
"jsonFieldSchema": {
"type": "string",
"format": "date"
},
"avroFieldType": [
"null",
{ "type": "int", "logicalType": "date" },
"string"
]
},
{
"fieldName": "logical_type_time",
"jsonFieldSchema": {
"type": "string",
"format": "time"
},
"avroFieldType": [
"null",
{ "type": "long", "logicalType": "time-micros" },
"string"
]
}
]

0 comments on commit 5adb1d1

Please sign in to comment.