Dr. Martin Menzel created AVRO-1505:
---------------------------------------
Summary: Generic comparator features definable in avro schema
Key: AVRO-1505
URL: https://issues.apache.org/jira/browse/AVRO-1505
Project: Avro
Issue Type: New Feature
Components: java
Affects Versions: 1.7.6
Environment: same as for hadoop 2.3.0
Reporter: Dr. Martin Menzel
Priority: Minor
Fix For: 1.7.7
Attachments: AVRO-1505.patch.gz, CompoundDataExportKeyExtended2.avsc,
GenericComparator.java, GenericData.java, TestGenericComparator.java
This patch allows to add additional optional comparator informations to the
avro schema for record types.
An example is included in the patch
CompoundDataExportKeyExtended2.avsc
...snip...
{"name": "seqNo", "type": "int", "comparators" : [
{
"name":"default", "compareIdx" : 3, "order":"ascending" },
{
"name":"grouping1", "compareIdx" : 3, "order":"ignore" } ,
{
"name":"grouping2", "compareIdx" : 3, "order":"ignore" }
]},
...snip...
in the comparators property of a field definition multiple compartor
informations can be defined. Often used when defining GroupingCompartors with
compound keys is order="ignore" so that the keys are just compared with respect
to some special (not ignored fields)
The necessary changes are made in GenericData class with a fall back to the
standard behavior if no comparators are defined.
An example generic Compartor is delivered with this patch called:
org.woopi.avro.GenericComparator
Maybe this class can be included in the avro bundle. In this case the package
can be adapted to org.apache.
The TestCase tests several different situations and is called.
TestGenericComparator.java
--
This message was sent by Atlassian JIRA
(v6.2#6252)