Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

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


+
Juliet Hougland 2013-06-10, 23:56
Copy link to this message
-
Re: Error parsing an 'array<union{record1, record2}>' in an avdl file
Juliet Hougland 2013-06-11, 00:09
Never mind, just fixed the unclosed comment. Arrays of unions work fine in
an avdl file.
Hope I didn't waste anyone's time!
Best,
Juliet
On Mon, Jun 10, 2013 at 4:56 PM, Juliet Hougland <[EMAIL PROTECTED]>wrote:

> 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
>