Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Avro >> mail # user >> Error parsing an 'array<union{record1, record2}>' in an avdl file


Copy link to this message
-
Error parsing an 'array<union{record1, record2}>' in an avdl file
Hi Avro-ers,
I have an avdl file that I am getting the following parse error in:"
org.apache.avro.compiler.idl.ParseException: Encountered " "record"
"record "" at line <Pointer to the line of the first record after
'AndFilter' record def>." The relevant section of my avdl file looks like:

  record ColumnRangeFilter {
    /** The minimum qualifier bound. null means none.*/
    union{null, string} min_qualifier;

    /** Whether to include the lower bound. */
    boolean min_included;

    /** The maximum qualifier bound. null means none.*/
    union{null, string} max_qualifier;

    /** Whether to include the upper bound. */
    boolean max_included;
  }

  /**
   * Specification of a RegexQualifierFilter.
   */
   record RegexQualifierFilter {
     /** The regular expression for qualifiers that should be
      *  accepted by this filter. The expression is matched against the
full qualifier (as
      *  if it implicitly starts with '^' and ends with '$'.
      */
      string regex;
   }

  /**
   * Specification of an 'and' filter.
   */
  record AndFilter {
    /** A List of filters to apply the logical operator to.
    array<union{RegexQualifierFilter, ColumnRangeFilter}> filter_list;
  }

When I remove the "AndFilter" record declaration from my file, the file is
parsed correctly and all of the classes are generated. Is there a
different/better way to declare an array of union type in an avdl file? My
(hopefully temporary) solution is to make another record with one field
that is of type 'union{RegexQualifierFilter, ColumnRangeFilter}' and use
that to parameterize the array.
Thanks,
Juliet
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB