You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Jonathan mayer <jo...@yahoo.com> on 2018/05/08 03:05:44 UTC
BinaryObjectBuilder - setField - Boolean Type - Problem
Hi there, I am testing different Data Types and have come up against a problem with Boolean.
I have created the following table from within DBeaver:-
CREATE TABLE TEST ( F_ID varchar PRIMARY KEY, F_INT INTEGER, F_BOOLEAN BOOLEAN) WITH "CACHE_NAME=TEST, key_type=java.lang.String, value_type=TEST";
I am try to create Data via an IgniteDataStreamer.
snippet:
BinaryObjectBuilder binaryObjectBuilder = ignite.binary().builder("TEST");
binaryObjectBuilder.setField("F_BOOLEAN", true);
etc...
BinaryObject bo = binaryObjectBuilder.build();
String/Integer Types are working fine.
Getting the error message :
Wrong value has been set [typeName=TEST, fieldName=F_BOOLEAN, fieldType=Object, assignedValueType=boolean]
Any help would be appreciated
Jonathan
Re: BinaryObjectBuilder - setField - Boolean Type - Problem
Posted by aealexsandrov <ae...@gmail.com>.
Hi Jonathan,
I tested your example with last changes from ignite apache repository.
Everything looks ok. My steps:
1)Start server node
2)Connect to server node using sqlline tool:
sqlline.bat --color=true --verbose=true -u
jdbc:ignite:thin://127.0.0.1:10800
3)Create new table:
0: jdbc:ignite:thin://127.0.0.1:10800> CREATE TABLE TEST (
. . . . . . . . . . . . . . . . . . .> F_ID varchar PRIMARY KEY,
. . . . . . . . . . . . . . . . . . .> F_INT INTEGER,
. . . . . . . . . . . . . . . . . . .> F_BOOLEAN BOOLEAN
. . . . . . . . . . . . . . . . . . .> ) WITH "CACHE_NAME=TEST,
key_type=java.lang.String, value_type=TEST";
No rows affected (0,277 seconds)
4)Start the client node with next code:
IgniteConfiguration cfg = new IgniteConfiguration();
Ignite ignite;
cfg.setClientMode(true);
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
List<String> addrs = Arrays.asList("127.0.0.1:47500..47501");
ipFinder.setAddresses(addrs);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(ipFinder);
cfg.setDiscoverySpi(discoSpi);
ignite = Ignition.getOrStart(cfg);
BinaryObjectBuilder binaryObjectBuilder =
ignite.binary().builder("TEST");
binaryObjectBuilder.setField("F_BOOLEAN", true);
binaryObjectBuilder.setField("F_INT", 1);
binaryObjectBuilder.setField("F_ID", "SomeId");
BinaryObject bo = binaryObjectBuilder.build();
System.out.println("Binary object [" + bo.toString() + "]");
And got next output:
Binary object [TEST [idHash=445288316, hash=-886521494, F_INT=1,
F_BOOLEAN=true, F_ID=SomeId]]
Could you please clarify your ignite verstion and full code reproducer?
BR,
Andrei
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: BinaryObjectBuilder - setField - Boolean Type - Problem
Posted by Jonathan mayer <jo...@yahoo.com>.
Hi Guys,
Thank you both very much for your help.
Yes, a complete reboot did the trick. I had thought that dropping the table would have worked but now know better.
I am just starting on my journey with Ignite so I imagine I will be on this list quite frequently.
Regards,
Jonathan
On Tuesday, 8 May 2018, 19:26:47 GMT+10, Ilya Kasnacheev <il...@gmail.com> wrote:
Hello!
I assume this is because, previously, you managed to write a TEST where F_BOOLEAN was Object. This is cached so it comes back to haunt you.
The solution here is to remove ignite/work/marshaller/ on all nodes (and all data if it is persistent) and restart your cluster. Or change type TEST to TEST2 :)
Regards,
--
Ilya Kasnacheev
2018-05-08 6:05 GMT+03:00 Jonathan mayer <jo...@yahoo.com>:
Hi there, I am testing different Data Types and have come up against a problem with Boolean.
I have created the following table from within DBeaver:-
CREATE TABLE TEST ( F_ID varchar PRIMARY KEY, F_INT INTEGER, F_BOOLEAN BOOLEAN) WITH "CACHE_NAME=TEST, key_type=java.lang.String, value_type=TEST";
I am try to create Data via an IgniteDataStreamer.
snippet:
BinaryObjectBuilder binaryObjectBuilder = ignite.binary().builder("TEST" );
binaryObjectBuilder.setField(" F_BOOLEAN", true);
etc...
BinaryObject bo = binaryObjectBuilder.build();
String/Integer Types are working fine.
Getting the error message :
Wrong value has been set [typeName=TEST, fieldName=F_BOOLEAN, fieldType=Object, assignedValueType=boolean]
Any help would be appreciated
Jonathan
Re: BinaryObjectBuilder - setField - Boolean Type - Problem
Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!
I assume this is because, previously, you managed to write a TEST where
F_BOOLEAN was Object. This is cached so it comes back to haunt you.
The solution here is to remove ignite/work/marshaller/ on all nodes (and
all data if it is persistent) and restart your cluster. Or change type TEST
to TEST2 :)
Regards,
--
Ilya Kasnacheev
2018-05-08 6:05 GMT+03:00 Jonathan mayer <jo...@yahoo.com>:
> Hi there, I am testing different Data Types and have come up against a
> problem with Boolean.
>
> I have created the following table from within DBeaver:-
>
> CREATE TABLE TEST (
> F_ID varchar PRIMARY KEY,
> F_INT INTEGER,
> F_BOOLEAN BOOLEAN
> ) WITH "CACHE_NAME=TEST, key_type=java.lang.String, value_type=TEST";
>
>
> I am try to create Data via an IgniteDataStreamer.
>
> snippet:
>
> BinaryObjectBuilder binaryObjectBuilder = ignite.binary().builder("TEST");
>
> binaryObjectBuilder.setField("F_BOOLEAN", true);
> etc...
>
> BinaryObject bo = binaryObjectBuilder.build();
>
> String/Integer Types are working fine.
>
> Getting the error message :
>
> Wrong value has been set [typeName=TEST, fieldName=F_BOOLEAN,
> fieldType=Object, assignedValueType=boolean]
>
> Any help would be appreciated
>
> Jonathan
>