question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

timestamp-millis bug introduced in 0.14. Works in 0.13

See original GitHub issue

The following simple program worked perfectly in fastavro 0.13 and now fails on fastavro 0.14. I presume this is a bug?

from io import BytesIO

import datetime
import fastavro

avro_schema = {
  "type": "record",
  "name": "simple_record",
  "namespace": "org.test",
  "fields": [{
    "name": "name",
    "type": "string"
  }, {
    "name": "timestamp",
    "type": {
      "type": "long",
      "logicalType": "timestamp-millis"
    }
  }]
}

epoch = datetime.datetime.utcfromtimestamp(0)


def datetime_to_epoch_millis(dt):
    return long((dt - epoch).total_seconds() * 1.0e3)


def generate_avro():
    avro_dict = {
        "name": "abc",
        "timestamp": datetime_to_epoch_millis(datetime.datetime(2015, 6, 7, 15, 30, 0))
    }

    with BytesIO() as bytes_io:
        fastavro.schemaless_writer(bytes_io, avro_schema, avro_dict)
        return bytes_io.getvalue()


if __name__ == "__main__":
    print("generate_avro test...")
    avro_binary = generate_avro()
    print("done :)")
    print("length={}".format(len(avro_binary)))

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
tebekacommented, Jun 7, 2017

Thanks for reporting, will check.

1reaction
kkirsanovcommented, Jun 9, 2017

Thanks for testing.

Fixed in 0.14.2

Read more comments on GitHub >

github_iconTop Results From Across the Web

timestamp-millis bug introduced in 0.14. Works in 0.13 #81
The following simple program worked perfectly in fastavro 0.13 and now fails on fastavro 0.14. I presume this is a bug? from io...
Read more >
Serialization Formats - ksqlDB Documentation
Any statement that sets the key format to NONE and has key columns defined, will result in an error. If a CREATE TABLE...
Read more >
https://raw.githubusercontent.com/arangodb/arangod...
Fixed bug in error reporting when a database create did not work, ... In previous ArangoDB versions, query ids always started at value...
Read more >
Talend Component Kit Developer Reference Guide
Bug $. TCOMP-1839: Tomcat websocket server fails to start after tomcat 9.0.40 and meecrowave 1.2.10 · Work Item$. TCOMP-1836: Upgrade OpenWebBeans to 2.0.20....
Read more >
[Rust] [Parquet] Corrupt footer error on files produced by ...
I started to use rust parquet library for some basic reading of files ... event_time: OPTIONAL INT64 L:TIMESTAMP(MILLIS,true) R:0 D:1 city: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found