Hi.

Actually to make your data just a bit more compact you may
use org.apache.ignite.binary.BinaryRawWriter
and org.apache.ignite.binary.BinaryRawReader (writer.rawWriter() and
reader.rawReader()), but in this case you'll not be able to use SQL queries.

Binarylizable interface gives you a way to customize
marshalling/unmarshalling process, for example, do not store fields that
could be calculated, etc., just like Externalizable does. And of course if
you haven't serialized fields, you cannot query for them.

On Fri, Nov 18, 2016 at 2:56 PM, rishi007bansod <[email protected]>
wrote:

> I am trying to use Binarylizable interface in apache ignite for reducing
> memory utilization(for compact representation of data). Following is data
> class that I have made binarylizable.
>
> class order_line implements Binarylizable{
>         @QuerySqlField(index = true)
>         int ol_o_id;
>         @QuerySqlField(index = true)
>         int ol_d_id;
>         @QuerySqlField(index = true)
>         int ol_w_id;
>         @QuerySqlField(index = true)
>         int ol_number;
>         @QuerySqlField
>         int ol_i_id;
>         @QuerySqlField
>         int ol_supply_w_id;
>         @QuerySqlField
>         String ol_delivery_d;
>         @QuerySqlField
>         int ol_quantity;
>         @QuerySqlField
>         double ol_amount;
>         @QuerySqlField
>         String ol_dist_info;
>
>
>         private order_lineKey key;
>         public order_lineKey key()
>         {
>                 if(key == null)
>                         key = new order_lineKey(ol_w_id, ol_d_id, ol_o_id,
> ol_number);
>
>                 return key;
>
>         }
>         @Override
>         public void readBinary(BinaryReader reader) throws
> BinaryObjectException {
>                 // TODO Auto-generated method stub
>                 ol_o_id = reader.readInt("ol_o_id");
>                 ol_d_id = reader.readInt("ol_d_id");
>                 ol_w_id = reader.readInt("ol_w_id");
>                 ol_number = reader.readInt("ol_number");
>                 ol_i_id = reader.readInt("ol_i_id");
>                 ol_supply_w_id = reader.readInt("ol_supply_w_id");
>                 ol_delivery_d = reader.readString("ol_delivery_d");
>                 ol_quantity = reader.readInt("ol_quantity");
>                 ol_amount = reader.readDouble("ol_amount");
>                 ol_dist_info = reader.readString("ol_dist_info");
>
>
>         }
>         @Override
>         public void writeBinary(BinaryWriter writer) throws
> BinaryObjectException {
>                 // TODO Auto-generated method stub
>
>                 writer.writeInt("ol_o_id",ol_o_id);
>                 writer.writeInt("ol_d_id",ol_d_id);
>                 writer.writeInt("ol_w_id",ol_w_id);
>                 writer.writeInt("ol_number",ol_number);
>                 writer.writeInt("ol_i_id",ol_i_id);
>                 writer.writeInt("ol_supply_w_id",ol_supply_w_id);
>                 writer.writeString("ol_delivery_d",ol_delivery_d);
>                 writer.writeInt("ol_quantity",ol_quantity);
>                 writer.writeDouble("ol_amount", ol_amount);
>                 writer.writeString("ol_dist_info",ol_dist_info);
>
>         }
>
> }
>
>
> Is this the correct way for compact binary representation of data? Because
> I
> am not getting any improvement in memory consumption after using this
> interface. Also, in readBinary() and writeBinary() methods do we have to
> write writer.writeInt/String/Double and reader.readInt/String/Double
> methods
> for every field or only fields participating in SQL queries(Does this have
> any effect on memory consumption)?
>
>
>
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Binarylizable-interface-in-apache-ignite-tp9078.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Reply via email to