Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-1505

Generic comparator features definable in avro schema

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 1.7.6
    • None
    • java
    • same as for hadoop 2.3.0

    • hadoop avro

    Description

      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

      Attachments

        1. TestGenericComparator.java
          10 kB
          Dr. Martin Menzel
        2. GenericData.java
          43 kB
          Dr. Martin Menzel
        3. CompoundDataExportKeyExtended2.avsc
          6 kB
          Dr. Martin Menzel
        4. GenericComparator.java
          4 kB
          Dr. Martin Menzel
        5. AVRO-1505.patch.gz
          19 kB
          Dr. Martin Menzel

        Activity

          People

            Unassigned Unassigned
            woopi Dr. Martin Menzel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified