Skip to content
This repository was archived by the owner on Sep 23, 2024. It is now read-only.

Commit dfd1534

Browse files
ffissoreedenhill
authored andcommitted
Extended advanced test schema with a logical type, in order to test how avro schema is serialized to json
1 parent 69b04b5 commit dfd1534

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

tests/avro/adv_schema.avsc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@
5656
"type" : "map",
5757
"values" : "basicPerson"
5858
}
59+
},
60+
{
61+
"name": "timestamp",
62+
"type": [
63+
"null",
64+
{
65+
"type": "long",
66+
"logicalType": "timestamp-millis"
67+
}
68+
],
69+
"default": null
5970
}
6071
]
6172
}

tests/avro/data_gen.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import os
2323
import os.path
2424
import random
25+
from datetime import datetime, timezone
2526

2627
from avro import schema
2728
from avro.datafile import DataFileWriter
@@ -65,6 +66,7 @@ def create_adv_item(i):
6566
basic = create_basic_item(i)
6667
basic['family'] = dict(map(lambda bi: (bi['name'], bi), family))
6768
basic['friends'] = dict(map(lambda bi: (bi['name'], bi), friends))
69+
basic['timestamp'] = datetime(1970, 1, 1, 0, 0, tzinfo=timezone.utc)
6870
return basic
6971

7072

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy