Search code examples
c++avro

Avro: Is local-timestamp-millis supported in the C++ library?


The simple version of the question is: does the C++ Avro library support the Logical Type local-timestamp-millis?

More details:

I'm using the Apache Avro C++ library version 1.11 and trying to create a file with the logical type local-timestamp-millis. When I try to compile a JSON schema with a logical type of local-timestamp-millis, the compileJsonSchema function is not setting a logical type; it comes back NONE. Changing the local-timestamp-millis to timestamp-millis sets the logical type correctly. The library does not have a LogicalType enum value for the local timestamp but I was thinking it may still take it in the schema as a LogicalType::TIMESTAMP_MILLIS.

Below is the small code I have for compiling the schema from JSON and the JSON input I'm using is below that.

    std::istringstream ist(json);
    avro::ValidSchema schema;
    avro::compileJsonSchema(ist, schema);

JSON input:

{ "type": "record", "name": "Test", "fields": [{ "type": "string", "name": "textField"},{ "type": {"type": "long", "logicalType": "local-timestamp-millis"}, "name": "DATE"}]}


Solution

  • Simple answer: No it doesn't. Like you say, the interface does not offer the enum for local-timestamp-millis.