diff --git a/doc/src/content/xdocs/spec.xml b/doc/src/content/xdocs/spec.xml index 947ae60854b..feb8e2bc0ee 100644 --- a/doc/src/content/xdocs/spec.xml +++ b/doc/src/content/xdocs/spec.xml @@ -546,7 +546,7 @@
Unions -

A union is encoded by first writing a long +

A union is encoded by first writing an int value indicating the zero-based position within the union of the schema of its value. The value is then encoded per the indicated schema within the union.

@@ -560,6 +560,8 @@ followed by the serialized string: 02 02 61 +

NOTE: Currently for C/C++ implementtions, the positions are practically an int, but theoretically a long. + In reality, we don't expect unions with 215M members

diff --git a/lang/perl/lib/Avro/BinaryDecoder.pm b/lang/perl/lib/Avro/BinaryDecoder.pm index c5308f26970..fa12fcf0710 100644 --- a/lang/perl/lib/Avro/BinaryDecoder.pm +++ b/lang/perl/lib/Avro/BinaryDecoder.pm @@ -328,7 +328,7 @@ sub skip_union { $class->skip($union_schema, $reader); } -## 1.3.2 A union is encoded by first writing a long value indicating the +## 1.3.2 A union is encoded by first writing an int value indicating the ## zero-based position within the union of the schema of its value. The value ## is then encoded per the indicated schema within the union. sub decode_union { diff --git a/lang/perl/lib/Avro/BinaryEncoder.pm b/lang/perl/lib/Avro/BinaryEncoder.pm index f47abd10bd3..d476f4b4a2f 100644 --- a/lang/perl/lib/Avro/BinaryEncoder.pm +++ b/lang/perl/lib/Avro/BinaryEncoder.pm @@ -234,7 +234,7 @@ sub encode_map { $class->encode_long(undef, 0, $cb); } -## 1.3.2 A union is encoded by first writing a long value indicating the +## 1.3.2 A union is encoded by first writing an int value indicating the ## zero-based position within the union of the schema of its value. The value ## is then encoded per the indicated schema within the union. sub encode_union { diff --git a/lang/py/avro/io.py b/lang/py/avro/io.py index b910ba56bce..e165db3a23f 100644 --- a/lang/py/avro/io.py +++ b/lang/py/avro/io.py @@ -846,7 +846,7 @@ def skip_map(self, writers_schema, decoder): def read_union(self, writers_schema, readers_schema, decoder): """ - A union is encoded by first writing a long value indicating + A union is encoded by first writing an int value indicating the zero-based position within the union of the schema of its value. The value is then encoded per the indicated schema within the union. """ @@ -1096,7 +1096,7 @@ def write_map(self, writers_schema, datum, encoder): def write_union(self, writers_schema, datum, encoder): """ - A union is encoded by first writing a long value indicating + A union is encoded by first writing an int value indicating the zero-based position within the union of the schema of its value. The value is then encoded per the indicated schema within the union. """ diff --git a/lang/py3/avro/io.py b/lang/py3/avro/io.py index 51f5a13b013..31623a9e0ad 100644 --- a/lang/py3/avro/io.py +++ b/lang/py3/avro/io.py @@ -636,7 +636,7 @@ def skip_map(self, writer_schema, decoder): def read_union(self, writer_schema, reader_schema, decoder): """ - A union is encoded by first writing a long value indicating + A union is encoded by first writing an int value indicating the zero-based position within the union of the schema of its value. The value is then encoded per the indicated schema within the union. """ @@ -866,7 +866,7 @@ def write_map(self, writer_schema, datum, encoder): def write_union(self, writer_schema, datum, encoder): """ - A union is encoded by first writing a long value indicating + A union is encoded by first writing an int value indicating the zero-based position within the union of the schema of its value. The value is then encoded per the indicated schema within the union. """