UPDATE SQL for nested BinaryObject throws exception.

classic Classic list List threaded Threaded
10 messages Options
takumi takumi
Reply | Threaded
Open this post in threaded view
|

UPDATE SQL for nested BinaryObject throws exception.

I use SqlQuery for nested BinaryObject.
The BinaryObject instance is following structure.

   BinaryObjectBuilder bb2 = binary.builder("nested2
hoge").setField("field2", "old", String.class);
   BinaryObjectBuilder bb = binary.builder("nested hoge").setField("field1",
bb2);
   binary.builder("hoge").setField("field0", bb);

The sample SQL to throw an exception is "update " + CACHE_NAME + " set
field2 = 'new'".

The cause to throw an exception to is that I update a field of BinaryObject
which is child of nested BinaryObject .
When I update a field of BinaryObject which is nested BinaryObject, it do
not throw an exception.

Should I not use this SQL for child of nested BinaryObject?



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Andrew Mashenkov Andrew Mashenkov
Reply | Threaded
Open this post in threaded view
|

Re: UPDATE SQL for nested BinaryObject throws exception.

Does this work for regular objects?


BWT: looks like a type when you set a builder to field instead of binary object itself "bb.build()"

On Thu, Aug 31, 2017 at 4:32 PM, takumi <[hidden email]> wrote:
I use SqlQuery for nested BinaryObject.
The BinaryObject instance is following structure.

   BinaryObjectBuilder bb2 = binary.builder("nested2
hoge").setField("field2", "old", String.class);
   BinaryObjectBuilder bb = binary.builder("nested hoge").setField("field1",
bb2);
   binary.builder("hoge").setField("field0", bb);

The sample SQL to throw an exception is "update " + CACHE_NAME + " set
field2 = 'new'".

The cause to throw an exception to is that I update a field of BinaryObject
which is child of nested BinaryObject .
When I update a field of BinaryObject which is nested BinaryObject, it do
not throw an exception.

Should I not use this SQL for child of nested BinaryObject?



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/



--
Best regards,
Andrey V. Mashenkov
Regards,
Andrew.
afedotov afedotov
Reply | Threaded
Open this post in threaded view
|

Re: UPDATE SQL for nested BinaryObject throws exception.

This post has NOT been accepted by the mailing list yet.
CONTENTS DELETED
The author has deleted this message.
afedotov afedotov
Reply | Threaded
Open this post in threaded view
|

Re: UPDATE SQL for nested BinaryObject throws exception.

In reply to this post by Andrew Mashenkov
CONTENTS DELETED
The author has deleted this message.
takumi takumi
Reply | Threaded
Open this post in threaded view
|

Re: UPDATE SQL for nested BinaryObject throws exception.

In reply to this post by Andrew Mashenkov
This is a part of the real code that I wrote.

-----------------------------
  List<QueryEntity> entities = new ArrayList<>();
  QueryEntity qe = new QueryEntity(String.class.getName(), "cache");
  qe.addQueryField("attribute.prop1", Double.class.getName(), "prop3");
  qe.addQueryField("attribute.prop2", String.class.getName(), "prop4");
  qe.addQueryField("attribute.prop.prop1", Double.class.getName(), "prop5");
  qe.addQueryField("attribute.prop.prop2", String.class.getName(), "prop6");

  BinaryObject bo  =ib.builder("cache").setField("attribute",
        ib.builder("cache.attribute")
          .setField("prop",
                ib.builder("cache.attribute.prop")
            .setField("prop1", 50.0, Double.class)
                   .setField("prop2", "old", String.class))
          .setField("prop1", 50.0, Double.class)
          .setField("prop2", "old", String.class)).build();

  cache.put("key1", bo);
  cache.query(new SqlFieldsQuery("update cache set prop4 = 'new'  where
prop3 >= 20.0"));//OK
  cache.query(new SqlFieldsQuery("update cache set prop6 = 'new'  where
prop5 >= 20.0"));//NG
-----------------------------

I can update 'prop4' by SQL, but I do not update 'prop6' by SQL.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
dsetrakyan dsetrakyan
Reply | Threaded
Open this post in threaded view
|

Re: UPDATE SQL for nested BinaryObject throws exception.

Cross sending to dev@

Igniters, up until version 1.9, the nested fields were supported by flattening the names. Do we still support it? I cannot seem to find documentation for it.

D.

On Thu, Aug 31, 2017 at 7:12 AM, takumi <[hidden email]> wrote:
This is a part of the real code that I wrote.

-----------------------------
  List<QueryEntity> entities = new ArrayList<>();
  QueryEntity qe = new QueryEntity(String.class.getName(), "cache");
  qe.addQueryField("attribute.prop1", Double.class.getName(), "prop3");
  qe.addQueryField("attribute.prop2", String.class.getName(), "prop4");
  qe.addQueryField("attribute.prop.prop1", Double.class.getName(), "prop5");
  qe.addQueryField("attribute.prop.prop2", String.class.getName(), "prop6");

  BinaryObject bo  =ib.builder("cache").setField("attribute",
        ib.builder("cache.attribute")
          .setField("prop",
                ib.builder("cache.attribute.prop")
                   .setField("prop1", 50.0, Double.class)
                   .setField("prop2", "old", String.class))
          .setField("prop1", 50.0, Double.class)
          .setField("prop2", "old", String.class)).build();

  cache.put("key1", bo);
  cache.query(new SqlFieldsQuery("update cache set prop4 = 'new'  where
prop3 >= 20.0"));//OK
  cache.query(new SqlFieldsQuery("update cache set prop6 = 'new'  where
prop5 >= 20.0"));//NG
-----------------------------

I can update 'prop4' by SQL, but I do not update 'prop6' by SQL.

afedotov afedotov
Reply | Threaded
Open this post in threaded view
|

Re: UPDATE SQL for nested BinaryObject throws exception.

CONTENTS DELETED
The author has deleted this message.
dsetrakyan dsetrakyan
Reply | Threaded
Open this post in threaded view
|

Re: UPDATE SQL for nested BinaryObject throws exception.



On Mon, Sep 4, 2017 at 7:40 AM, afedotov <[hidden email]> wrote:
Hi,

Actually, flattening the nested properties with aliases works only for one
level as for now.
Looks like it's a bug. I'll file a JIRA ticket for this.


Alex, maybe one level nesting will be enough for some use cases. Is there an example in documentation somewhere we can all look at? If not, should we add such documentation?
 

afedotov afedotov
Reply | Threaded
Open this post in threaded view
|

Re: UPDATE SQL for nested BinaryObject throws exception.

CONTENTS DELETED
The author has deleted this message.
afedotov afedotov
Reply | Threaded
Open this post in threaded view
|

Re: UPDATE SQL for nested BinaryObject throws exception.

CONTENTS DELETED
The author has deleted this message.