You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cassandra.apache.org by Joseph Stein <cr...@gmail.com> on 2011/07/02 17:40:20 UTC

thrift generated java changes

So I am working on https://issues.apache.org/jira/browse/CASSANDRA-2833

And when I generate the cassandra.thrift file I am getting weird results and
differences

Should I be modifying the CounterColumn.java by hand?

I am using thrift 0.5.0 and doing

thrift -gen java cassandra.thrift from the command line

some of the issues (as an example)

-    tmpMap.put(_Fields.VALUE, new
org.apache.thrift.meta_data.FieldMetaData("value",
org.apache.thrift.TFieldRequirementType.REQUIRED,
-        new
org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+    Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields,
FieldMetaData>(_Fields.class);
+    tmpMap.put(_Fields.NAME, new FieldMetaData("name",
TFieldRequirementType.REQUIRED,

   public CounterColumn setName(byte[] name) {
-    setName(name == null ? (ByteBuffer)null : ByteBuffer.wrap(name));
+    setName(ByteBuffer.wrap(name));
     return this;
   }

-  /** Returns true if field name is set (has been assigned a value) and
false otherwise */
+  /** Returns true if field name is set (has been asigned a value) and
false otherwise */

this last ones makes me suspect I am using the wrong thrift version and
maybe not the right commands?
http://wiki.apache.org/cassandra/InstallThriftleads me to what I did
but if there is something different or wrong with
what I am doing please let me know and I can update the wiki and get back on
track.

and all I did to the cassandra.thrift was:

-    2: required i64 value
+   2: optional i64 value,
+   3: optional double operand


Thanks!

/*
Joe Stein
http://www.linkedin.com/in/charmalloc
Twitter: @allthingshadoop <http://www.twitter.com/allthingshadoop>
*/

Re: thrift generated java changes

Posted by Eric Evans <ee...@rackspace.com>.
On Sat, 2011-07-02 at 22:29 -0400, Joseph Stein wrote:
> right now I just manually put this function back in since it is the
> only thing (well the license too of course) that the generation
> changed from what is in source besides my change required. 

I wouldn't worry much about this.  Do the best you can when it comes to
matching thrift compiler to the currently supported version, and then
put any changes to generated files in a separate patch (the important
change here is the IDL).  If the person committing is concerned about
what was generated, then they can always regenerate using their own
compiler.

-- 
Eric Evans
eevans@rackspace.com


Re: thrift generated java changes

Posted by Joseph Stein <cr...@gmail.com>.
using 0.6.1 it went better, almost perfect

the diff is still removing this code though and not sure why

   @Override
   public int hashCode() {
-    HashCodeBuilder builder = new HashCodeBuilder();
-
-    boolean present_name = true && (isSetName());
-    builder.append(present_name);
-    if (present_name)
-      builder.append(name);
-
-    boolean present_value = true;
-    builder.append(present_value);
-    if (present_value)
-      builder.append(value);
-
-    return builder.toHashCode();
+    return 0;
   }

right now I just manually put this function back in since it is the only
thing (well the license too of course) that the generation changed from what
is in source besides my change required.


On Sat, Jul 2, 2011 at 12:26 PM, Jake Luciani <ja...@gmail.com> wrote:

> 0.8 uses thrift 0.6
>
>
>
> On Jul 2, 2011, at 11:40 AM, Joseph Stein <cr...@gmail.com> wrote:
>
> > So I am working on https://issues.apache.org/jira/browse/CASSANDRA-2833
> >
> > And when I generate the cassandra.thrift file I am getting weird results
> and
> > differences
> >
> > Should I be modifying the CounterColumn.java by hand?
> >
> > I am using thrift 0.5.0 and doing
> >
> > thrift -gen java cassandra.thrift from the command line
> >
> > some of the issues (as an example)
> >
> > -    tmpMap.put(_Fields.VALUE, new
> > org.apache.thrift.meta_data.FieldMetaData("value",
> > org.apache.thrift.TFieldRequirementType.REQUIRED,
> > -        new
> >
> org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
> > +    Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields,
> > FieldMetaData>(_Fields.class);
> > +    tmpMap.put(_Fields.NAME, new FieldMetaData("name",
> > TFieldRequirementType.REQUIRED,
> >
> >   public CounterColumn setName(byte[] name) {
> > -    setName(name == null ? (ByteBuffer)null : ByteBuffer.wrap(name));
> > +    setName(ByteBuffer.wrap(name));
> >     return this;
> >   }
> >
> > -  /** Returns true if field name is set (has been assigned a value) and
> > false otherwise */
> > +  /** Returns true if field name is set (has been asigned a value) and
> > false otherwise */
> >
> > this last ones makes me suspect I am using the wrong thrift version and
> > maybe not the right commands?
> > http://wiki.apache.org/cassandra/InstallThriftleads me to what I did
> > but if there is something different or wrong with
> > what I am doing please let me know and I can update the wiki and get back
> on
> > track.
> >
> > and all I did to the cassandra.thrift was:
> >
> > -    2: required i64 value
> > +   2: optional i64 value,
> > +   3: optional double operand
> >
> >
> > Thanks!
> >
> > /*
> > Joe Stein
> > http://www.linkedin.com/in/charmalloc
> > Twitter: @allthingshadoop <http://www.twitter.com/allthingshadoop>
> > */
>



-- 

/*
Joe Stein
http://www.linkedin.com/in/charmalloc
Twitter: @allthingshadoop <http://www.twitter.com/allthingshadoop>
*/

Re: thrift generated java changes

Posted by Jake Luciani <ja...@gmail.com>.
0.8 uses thrift 0.6

 

On Jul 2, 2011, at 11:40 AM, Joseph Stein <cr...@gmail.com> wrote:

> So I am working on https://issues.apache.org/jira/browse/CASSANDRA-2833
> 
> And when I generate the cassandra.thrift file I am getting weird results and
> differences
> 
> Should I be modifying the CounterColumn.java by hand?
> 
> I am using thrift 0.5.0 and doing
> 
> thrift -gen java cassandra.thrift from the command line
> 
> some of the issues (as an example)
> 
> -    tmpMap.put(_Fields.VALUE, new
> org.apache.thrift.meta_data.FieldMetaData("value",
> org.apache.thrift.TFieldRequirementType.REQUIRED,
> -        new
> org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
> +    Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields,
> FieldMetaData>(_Fields.class);
> +    tmpMap.put(_Fields.NAME, new FieldMetaData("name",
> TFieldRequirementType.REQUIRED,
> 
>   public CounterColumn setName(byte[] name) {
> -    setName(name == null ? (ByteBuffer)null : ByteBuffer.wrap(name));
> +    setName(ByteBuffer.wrap(name));
>     return this;
>   }
> 
> -  /** Returns true if field name is set (has been assigned a value) and
> false otherwise */
> +  /** Returns true if field name is set (has been asigned a value) and
> false otherwise */
> 
> this last ones makes me suspect I am using the wrong thrift version and
> maybe not the right commands?
> http://wiki.apache.org/cassandra/InstallThriftleads me to what I did
> but if there is something different or wrong with
> what I am doing please let me know and I can update the wiki and get back on
> track.
> 
> and all I did to the cassandra.thrift was:
> 
> -    2: required i64 value
> +   2: optional i64 value,
> +   3: optional double operand
> 
> 
> Thanks!
> 
> /*
> Joe Stein
> http://www.linkedin.com/in/charmalloc
> Twitter: @allthingshadoop <http://www.twitter.com/allthingshadoop>
> */