Repository: avro Updated Branches: refs/heads/master bc3fffb06 -> 2b1639ce5
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/a92c8f54 Tree: http://git-wip-us.apache.org/repos/asf/avro/tree/a92c8f54 Diff: http://git-wip-us.apache.org/repos/asf/avro/diff/a92c8f54 Branch: refs/heads/master Commit: a92c8f5413e537c116e6b09021b7ed9944467e32 Parents: 1296ce9 Author: Doug Cutting <[email protected]> Authored: Tue Sep 27 07:56:42 2016 -0700 Committer: Doug Cutting <[email protected]> Committed: Tue Sep 27 07:56:42 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/a92c8f54/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index d9b72ed..a32c88b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -29,6 +29,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/a92c8f54/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/a92c8f54/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>
