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

Switch to Plain View
Avro >> mail # user >> 1.7.3 regression?


+
Alex Kozlov 2013-02-11, 01:21
+
Doug Cutting 2013-02-12, 01:37
+
Doug Cutting 2013-02-12, 02:11
Copy link to this message
-
Re: 1.7.3 regression?
Yes, it does compile from the command line with avro-1.7.3.jar in the
classpath.  Maven seems to pull a previous version of the library from
dependencies even though I configured it as per
http://avro.apache.org/docs/1.7.3/gettingstartedjava.html.

Thank  you!

On Mon, Feb 11, 2013 at 6:11 PM, Doug Cutting <[EMAIL PROTECTED]> wrote:
> Alex,
>
> Is it possible that you're compiling the schema to Java with Avro
> 1.7.3, then compiling the Java with javac against the Avro 1.7.2 jar
> file?
>
> Doug
>
> On Mon, Feb 11, 2013 at 5:37 PM, Doug Cutting <[EMAIL PROTECTED]> wrote:
>> This was done as a part of AVRO-1199.
>>
>> http://svn.apache.org/viewvc?view=revision&revision=1409542
>>
>> The deepCopy() method is now generic.  This works for me in Java 7.
>> Do others see this problem in Java 6?  If so, please file a bug in
>> Jira.
>>
>> Thanks,
>>
>> Doug
>>
>> On Sun, Feb 10, 2013 at 5:21 PM, Alex Kozlov <[EMAIL PROTECTED]> wrote:
>>> When trying to compile generated code for the following schema:
>>>
>>> {code}
>>>  {
>>>   "type" : "record",
>>>   "namespace" : "com.mycompany.hadoop",
>>>   "name" : "AvroDisk",
>>>   "fields" : [ {
>>>     "name" : "serial_num",
>>>     "type" : [ "null", "string" ],
>>>     "doc" : "Serial Number"
>>>   }, {
>>>     "name" : "seq",
>>>     "type" : [ "null", "long" ],
>>>     "doc" : "Sequence #"
>>>   }, {
>>>     "name" : "attributes",
>>>     "type" : [ "null", {
>>>       "type" : "map",
>>>       "values" : "string"
>>>     } ],
>>>     "doc" : "Attributes of a disk"
>>>   } ]
>>> }
>>> {code}
>>>
>>> I get errors:
>>>
>>> {code}
>>> [ERROR] /Users/akozlov/.../AvroDisk.java:[137,41] incompatible types
>>> [ERROR] found   : java.lang.Object
>>> [ERROR] required: java.lang.CharSequence
>>> [ERROR] /Users/akozlov/.../AvroDisk.java:[141,34] incompatible types
>>> [ERROR] found   : java.lang.Object
>>> [ERROR] required: java.lang.Long
>>> [ERROR] /Users/akozlov/.../AvroDisk.java:[145,41] incompatible types
>>> [ERROR] found   : java.lang.Object
>>> [ERROR] required: java.util.Map<java.lang.CharSequence,java.lang.CharSequence>
>>> {code}
>>>
>>> It appears that the 1.7.3 code is missing an explicit cast to
>>> ((java.lang.{CharSequence, Long,Map}) in the Builder method:
>>>
>>> {code}
>>>   133     /** Creates a Builder by copying an existing AvroDisk instance */
>>>     134     private Builder(com.seagate.hadoop.avro.AvroDisk other) {
>>>     135             super(com.seagate.hadoop.avro.AvroDisk.SCHEMA$);
>>>     136       if (isValidValue(fields()[0], other.serial_num)) {
>>>     137         this.serial_num >>> data().deepCopy(fields()[0].schema(), other.serial_num);
>>>     138         fieldSetFlags()[0] = true;
>>>     139       }
>>>     140       if (isValidValue(fields()[1], other.seq)) {
>>>     141         this.seq = data().deepCopy(fields()[1].schema(), other.seq);
>>>     142         fieldSetFlags()[1] = true;
>>>     143       }
>>>     144       if (isValidValue(fields()[2], other.attributes)) {
>>>     145         this.attributes >>> data().deepCopy(fields()[2].schema(), other.attributes);
>>>     146         fieldSetFlags()[2] = true;
>>>     147       }
>>>     148     }
>>> {code}
>>>
>>> The compiler works fine for 1.7.1 and 1.7.2 versions.  The java
>>> version I am using is:
>>>
>>> $ java -version
>>> java version "1.6.0_37"
>>> Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-11M3909)
>>> Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode)
>>>
>>> Has anyone else seen this error?
>>>
>>> Thx,
>>>
>>> --
>>> Alex Kozlov
>>> (408) 507-4987
>>> (408) 830-9982 fax
>>> (650) 887-2135 efax
>>> [EMAIL PROTECTED]