This is an automated email from the ASF dual-hosted git repository.
mgrigorov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/avro.git
The following commit(s) were added to refs/heads/main by this push:
new 6ac501e070 [doc] Update _index.md fixing minor typo
6ac501e070 is described below
commit 6ac501e070b6033a98006b467992c78d2cf7e022
Author: Martin Tzvetanov Grigorov <[email protected]>
AuthorDate: Mon Oct 13 09:07:01 2025 +0300
[doc] Update _index.md fixing minor typo
Port
https://github.com/apache/avro/pull/3508/commits/5941c27d631997afa0e23a0a11f402407a318bb5
to ++version++
---
.../en/docs/++version++/Getting started (Java)/_index.md | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/doc/content/en/docs/++version++/Getting started (Java)/_index.md
b/doc/content/en/docs/++version++/Getting started (Java)/_index.md
index c2470518ba..44aeae4767 100644
--- a/doc/content/en/docs/++version++/Getting started (Java)/_index.md
+++ b/doc/content/en/docs/++version++/Getting started (Java)/_index.md
@@ -1,6 +1,6 @@
---
categories: []
-tags: ["java"]
+tags: ["java"]
title: "Getting Started (Java)"
linkTitle: "Getting Started (Java)"
weight: 2
@@ -74,7 +74,7 @@ As well as the Avro Maven plugin (for performing code
generation):
</configuration>
</plugin>
```
-
+
You may also build the required Avro jars from source. Building Avro is beyond
the scope of this guide; see the Build Documentation page in the wiki for more
information.
## Defining a schema
@@ -92,7 +92,7 @@ Avro schemas are defined using JSON or IDL (the latter
requires an extra depende
]
}
```
-
+
This schema defines a record representing a hypothetical user. (Note that a
schema file can only contain a single schema definition.) At minimum, a record
definition must include its type ("type": "record"), a name ("name": "User"),
and fields, in this case name, favorite_number, and favorite_color. We also
define a namespace ("namespace": "example.avro"), which together with the name
attribute defines the "full name" of the schema (example.avro.User in this
case).
Fields are defined via an array of objects, each of which defines a name and
type (other attributes are optional, see the record specification for more
details). The type attribute of a field is another schema object, which can be
either a primitive or complex type. For example, the name field of our User
schema is the primitive type string, whereas the favorite_number and
favorite_color fields are both unions, represented by JSON arrays. unions are a
complex type that can be any of the [...]
@@ -174,7 +174,7 @@ user = dataFileReader.next(user);
System.out.println(user);
}
```
-
+
This snippet will output:
```json
@@ -200,10 +200,10 @@ In release 1.9.0, we introduced a new approach to
generating code that speeds up
$ mvn -q exec:java -Dexec.mainClass=example.SpecificMain \
-Dorg.apache.avro.specific.use_custom_coders=true
-
+
Note that you do not have to recompile your Avro schema to have access to this
feature. The feature is compiled and built into your code, and you turn it on
and off at runtime using the feature flag. As a result, you can turn it on
during testing, for example, and then off in production. Or you can turn it on
in production, and quickly turn it off if something breaks.
-We encourage the Avro community to exercise this new feature early to help
build confidence. (For those paying one-demand for compute resources in the
cloud, it can lead to meaningful cost savings.) As confidence builds, we will
turn this feature on by default, and eventually eliminate the feature flag (and
the old code).
+We encourage the Avro community to exercise this new feature early to help
build confidence. (For those paying on demand for compute resources in the
cloud, it can lead to meaningful cost savings.) As confidence builds, we will
turn this feature on by default, and eventually eliminate the feature flag (and
the old code).
## Serializing and deserializing without code generation
Data in Avro is always stored with its corresponding schema, meaning we can
always read a serialized item regardless of whether we know the schema ahead of
time. This allows us to perform serialization and deserialization without code
generation.
@@ -277,7 +277,7 @@ This outputs:
{"name": "Alyssa", "favorite_number": 256, "favorite_color": null}
{"name": "Ben", "favorite_number": 7, "favorite_color": "red"}
```
-
+
Deserializing is very similar to serializing. We create a GenericDatumReader,
analogous to the GenericDatumWriter we used in serialization, which converts
in-memory serialized items into GenericRecords. We pass the DatumReader and the
previously created File to a DataFileReader, analogous to the DataFileWriter,
which reads both the schema used by the writer as well as the data from the
file on disk. The data will be read using the writer's schema included in the
file, and the reader's sc [...]
Next, we use the DataFileReader to iterate through the serialized users and
print the deserialized object to stdout. Note how we perform the iteration: we
create a single GenericRecord object which we store the current deserialized
user in, and pass this record object to every call of dataFileReader.next. This
is a performance optimization that allows the DataFileReader to reuse the same
record object rather than allocating a new GenericRecord for every iteration,
which can be very expen [...]