You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by takumi <bl...@kss.biglobe.ne.jp> on 2017/08/31 13:32:15 UTC
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/
Re: UPDATE SQL for nested BinaryObject throws exception.
Posted by afedotov <al...@gmail.com>.
Hi,
Currently referencing nested object's fields from SQL isn't supported for
both regular Java objects and for BinaryObject-s.
In other words, having
class B {
private String field1;
}
class A {
private B bField;
}
you cannot update it like `update A set bField.field1=?`
Kind regards,
Alex.
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: UPDATE SQL for nested BinaryObject throws exception.
Posted by afedotov <al...@gmail.com>.
Hi,
FYI. Created tickets related to the subject:
1) https://issues.apache.org/jira/browse/IGNITE-6265
2) https://issues.apache.org/jira/browse/IGNITE-6266
3) https://issues.apache.org/jira/browse/IGNITE-6268
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: UPDATE SQL for nested BinaryObject throws exception.
Posted by afedotov <al...@gmail.com>.
Unfortunately, there is neither documentation nor tests for the subject.
I'll create tickets for adding a corresponding section to the
BinaryMarshaller documentation
as well as for tests covering this part of the functionality.
Kind regards,
Alex
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: UPDATE SQL for nested BinaryObject throws exception.
Posted by Dmitriy Setrakyan <ds...@apache.org>.
On Mon, Sep 4, 2017 at 7:40 AM, afedotov <al...@gmail.com>
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?
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>
Re: UPDATE SQL for nested BinaryObject throws exception.
Posted by afedotov <al...@gmail.com>.
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.
Kind regards,
Alex
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: UPDATE SQL for nested BinaryObject throws exception.
Posted by Dmitriy Setrakyan <ds...@apache.org>.
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 <bl...@kss.biglobe.ne.jp> 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.
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>
Re: UPDATE SQL for nested BinaryObject throws exception.
Posted by Dmitriy Setrakyan <ds...@apache.org>.
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 <bl...@kss.biglobe.ne.jp> 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.
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>
Re: UPDATE SQL for nested BinaryObject throws exception.
Posted by takumi <bl...@kss.biglobe.ne.jp>.
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/
Re: UPDATE SQL for nested BinaryObject throws exception.
Posted by Andrey Mashenkov <an...@gmail.com>.
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 <bl...@kss.biglobe.ne.jp> 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