Only difference I can see is the null default/union possibly not being
handled well by avro_record_set
or avro_record(schema)

Without reading the source I'd expect avro_record(schema) to default
the default union values to null
leading to some sort of let's keep reading this memory issue because
we don't know where the end is.

You can test if that's not happening by setting hours in your original
program, and/or explicitly setting
the fields to null types.

Probably room for improvement on the C++ side (should validate/throw
if the avro_dataum_t isn't valid
or matching the writer schema instead of doing whatever it's doing, in
addition to having the null/union
default work for avro_record(schema)).

On Thu, Jan 16, 2020 at 11:33 AM Titouan Christophe
<[email protected]> wrote:
>
> Hello everyone,
>
> I am new to the avro-c library, and trying to get some experience with
> it. At the moment, I wrote a very simple program that is supposed to
> write a single record of a simple schema to a file.
>
> The program source is over there:
> https://gist.github.com/titouanc/0df61b807d06ca7611cc6708f12fc938.
>
> When I run my program, I obtain the following output:
>
> Unable to write Avro record to file: Datum too large for file block size
>
> which is produced by
> https://gist.github.com/titouanc/0df61b807d06ca7611cc6708f12fc938#file-test-avro-c-L34
> . The only reference to a similar error message is
> http://apache-avro.679487.n3.nabble.com/Value-too-large-for-file-block-size-td4028424.html
> but i really doubt I have the same issue, as the size of my record
> should be much more lower than 16kiB.
>
>
> To write this small piece of code, I draw inspiration from the quickstop
> example
> (https://github.com/apache/avro/blob/release-1.9.1/lang/c/examples/quickstop.c).
> If I compile and run this example, it runs just fine.
>
>
> Finally, I made a small modification to my program to use the same
> schema as the quickstop example. Here is the modified version:
> https://gist.github.com/titouanc/b18c0c54657db4e1f0361e0be9f710f3.
> This one actually works perfectly !
>
>
> Could anyone help me to understand this issue ?
>
> Best regards,
>
> Titouan Christophe

Reply via email to