AVRO-1918: Improve logical type documentation. Contributed by Gabor Szadovszky.
Project: http://git-wip-us.apache.org/repos/asf/avro/repo Commit: http://git-wip-us.apache.org/repos/asf/avro/commit/58c0aac5 Tree: http://git-wip-us.apache.org/repos/asf/avro/tree/58c0aac5 Diff: http://git-wip-us.apache.org/repos/asf/avro/diff/58c0aac5 Branch: refs/heads/branch-1.8 Commit: 58c0aac536e2ffbf1d1a0ff2f7855f34b036eedb Parents: 97e442c Author: Doug Cutting <[email protected]> Authored: Tue Sep 27 07:56:42 2016 -0700 Committer: Ryan Blue <[email protected]> Committed: Sat Nov 5 13:18:23 2016 -0700 ---------------------------------------------------------------------- CHANGES.txt | 2 ++ doc/src/content/xdocs/idl.xml | 24 ++++++++++++++++++++ .../java/org/apache/avro/specific/package.html | 6 +++++ 3 files changed, 32 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/avro/blob/58c0aac5/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 7a7e5ef..b9d863b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -26,6 +26,8 @@ Trunk (not yet released) AVRO-1919: Formalize the presence of build.sh. (Suraj Acharya via cutting) + AVRO-1918: Improve logical type documentation. (Gabor Szadovszky via cutting) + BUG FIXES AVRO-1741: Python3: Fix error when codec is not in the header. http://git-wip-us.apache.org/repos/asf/avro/blob/58c0aac5/doc/src/content/xdocs/idl.xml ---------------------------------------------------------------------- diff --git a/doc/src/content/xdocs/idl.xml b/doc/src/content/xdocs/idl.xml index bd74b09..c9a809f 100644 --- a/doc/src/content/xdocs/idl.xml +++ b/doc/src/content/xdocs/idl.xml @@ -206,6 +206,7 @@ error Kaboom { <p>A type reference in Avro IDL must be one of:</p> <ul> <li>A primitive type</li> + <li>A logical type</li> <li>A named schema defined prior to this usage in the same Protocol</li> <li>A complex type (array, map, or union)</li> </ul> @@ -218,6 +219,29 @@ error Kaboom { </p> </section> + <section id="logical_types"> + <title>Logical Types</title> + <p>Some of the logical types supported by Avro's JSON format are also supported by Avro IDL. + The currently supported types are: + </p> + <ul> + <li><code>decimal</code> (logical type <a href="spec.html#Decimal"><code>decimal</code></a>)</li> + <li><code>date</code> (logical type <a href="spec.html#Date"><code>date</code></a>)</li> + <li><code>time_ms</code> (logical type <a href="spec.html#Time+%28millisecond+precision%29"><code>time-millis</code></a>)</li> + <li><code>timestamp_ms</code> (logical type <a href="spec.html#Timestamp+%28millisecond+precision%29"><code>timestamp-millis</code></a>)</li> + </ul> + <p>For example:</p> + <source> +record Job { + string jobid; + date submitDate; + time_ms submitTime; + timestamp_ms finishTime; + decimal(9,2) finishRatio; +} + </source> + </section> + <section id="schema_references"> <title>References to Named Schemata</title> <p>If a named schema has already been defined in the same Avro IDL file, it may be referenced by name http://git-wip-us.apache.org/repos/asf/avro/blob/58c0aac5/lang/java/avro/src/main/java/org/apache/avro/specific/package.html ---------------------------------------------------------------------- diff --git a/lang/java/avro/src/main/java/org/apache/avro/specific/package.html b/lang/java/avro/src/main/java/org/apache/avro/specific/package.html index d9be484..b331592 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/specific/package.html +++ b/lang/java/avro/src/main/java/org/apache/avro/specific/package.html @@ -31,6 +31,12 @@ Generate specific Java classes for schemas and protocols. <li>Record, enum, and fixed schemas generate Java class definitions.</li> +<li>If a Conversion instance is available for the related logical type, + the value will be mapped to the object returned by that Conversion. The + logical type conversions for {@code date}, {@code time-millis}, {@code + timestamp-millis} and {@code decimal} are pre-defined in the class {@link + org.apache.avro.compiler.specific.SpecificCompiler SpecificCompiler}.</li> + <li>All other types are mapped as in the {@link org.apache.avro.generic generic} API.</li>
