Skip to content

Commit

Permalink
#31 POC for cython with fastavro impl
Browse files Browse the repository at this point in the history
  • Loading branch information
hiteshvpatel256 committed Aug 17, 2022
1 parent e43b353 commit 4e3c01b
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
1 change: 1 addition & 0 deletions protocolAggregator/anjunaEnclave/cython_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import fastavro_deserialisation
16 changes: 16 additions & 0 deletions protocolAggregator/anjunaEnclave/fastavro_deserialisation.pyx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import avro.schema
import convertCsvToJson
import datetime
from avro.datafile import DataFileReader, DataFileWriter
from avro.io import DatumReader, DatumWriter
from fastavro import writer, reader, parse_schema

start = datetime.datetime.now()

# Reading
with open('dataOutput.avro', 'rb') as fo:
for record in reader(fo):
print(record)

print(start)
print(datetime.datetime.now())
27 changes: 27 additions & 0 deletions protocolAggregator/anjunaEnclave/fastavro_schema.avsc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"type": "record",
"name": "AggregateInput",
"fields": [
{
"name": "anzsic06",
"type": "string"
},
{
"name": "Area",
"type": "string"
},
{
"name": "year",
"type": "string"
},
{
"name": "geo_count",
"type": "string"
},
{
"name": "ec_count",
"type": "string"
}
]

}
6 changes: 6 additions & 0 deletions protocolAggregator/anjunaEnclave/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from setuptools import setup
from Cython.Build import cythonize

setup(
ext_modules = cythonize("temp.pyx")
)

0 comments on commit 4e3c01b

Please sign in to comment.