You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Dave Harvey <dh...@jobcase.com> on 2018/03/23 22:10:00 UTC

Determining BinaryObject field type

Once a BinaryObjectSchema is created, it is not possible to change the type
of a field for a known field name.

My question is whether there is any way to determine the type of that field
in the Schema.  

We are hitting a case were the way we get the data out of a different
database returns a TIMESTAMP, but our binary object wants a DATE.     In
this test case, I could figure out that, but in the general case,  I have a
BinaryObject type name, and a field name, and an exception if I try to put
the wrong type in that field.

The hokey general solutions I have come up with are:
1) Parse the exception message to see what type it wants
2) Have a list of conversions to try for the source type, and step through
them on each exception.
3) Get the field from an existing binary object of that type, and use the
class of the result.   But there is the chicken/egg problem.

I have found that I can create a cache on a cluster with persistence, with
some type definition, then delete that cache, the cluster will remember the
BinaryObjectSchema for that type, and refuse to allow me to change the
field's type.          If I  don't remember the field's type, how can I
build the binary object?

Is there any way to delete the schema without nuking some of the
binary-meta/marshaller files when the cluster is down?



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

Re: Determining BinaryObject field type

Posted by Pavel Vinokurov <vi...@gmail.com>.
Dave,

There is one way to delete meta data.
You could find typeId using ignite.binary().type("package.Employeee").typeId()
and remove <typeId>.bin files in all  *binary_meta* subfolders.
​

Re: Determining BinaryObject field type

Posted by David Harvey <dh...@jobcase.com>.
 I had stopped at BinaryObject, and didn't follow the indirection though
type() to BinaryType. I think I assumed that this had only information at
the higher level, and wouldn't drill down into the fields.
This also answers a question about how to enumerate the fields.

Thanks.
-DH

On Wed, Mar 28, 2018 at 3:10 AM, Pavel Vinokurov <vi...@gmail.com>
wrote:

> Dave,
>
> I suppose there isn't way to delete the schema.
> You could get the meta information about binary objects using Ignite#binary()
> method.
> For example ignite.binary().type("package.Employeee").
> fieldTypeName("name").
>
>
>
> Thanks,
> Pavel
>
> 2018-03-24 1:10 GMT+03:00 Dave Harvey <dh...@jobcase.com>:
>
>> Once a BinaryObjectSchema is created, it is not possible to change the
>> type
>> of a field for a known field name.
>>
>> My question is whether there is any way to determine the type of that
>> field
>> in the Schema.
>>
>> We are hitting a case were the way we get the data out of a different
>> database returns a TIMESTAMP, but our binary object wants a DATE.     In
>> this test case, I could figure out that, but in the general case,  I have
>> a
>> BinaryObject type name, and a field name, and an exception if I try to put
>> the wrong type in that field.
>>
>> The hokey general solutions I have come up with are:
>> 1) Parse the exception message to see what type it wants
>> 2) Have a list of conversions to try for the source type, and step through
>> them on each exception.
>> 3) Get the field from an existing binary object of that type, and use the
>> class of the result.   But there is the chicken/egg problem.
>>
>> I have found that I can create a cache on a cluster with persistence, with
>> some type definition, then delete that cache, the cluster will remember
>> the
>> BinaryObjectSchema for that type, and refuse to allow me to change the
>> field's type.          If I  don't remember the field's type, how can I
>> build the binary object?
>>
>> Is there any way to delete the schema without nuking some of the
>> binary-meta/marshaller files when the cluster is down?
>>
>>
>>
>> --
>> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>>
>
>
>
> --
>
> Regards
>
> Pavel Vinokurov
>

Disclaimer

The information contained in this communication from the sender is confidential. It is intended solely for use by the recipient and others authorized to receive it. If you are not the recipient, you are hereby notified that any disclosure, copying, distribution or taking action in relation of the contents of this information is strictly prohibited and may be unlawful.

This email has been scanned for viruses and malware, and may have been automatically archived by Mimecast Ltd, an innovator in Software as a Service (SaaS) for business. Providing a safer and more useful place for your human generated data. Specializing in; Security, archiving and compliance. To find out more visit the Mimecast website.

Re: Determining BinaryObject field type

Posted by Pavel Vinokurov <vi...@gmail.com>.
Dave,

I suppose there isn't way to delete the schema.
You could get the meta information about binary objects using Ignite#binary()
method.
For example ignite.binary().type("package.Employeee").fieldTypeName("name").



Thanks,
Pavel

2018-03-24 1:10 GMT+03:00 Dave Harvey <dh...@jobcase.com>:

> Once a BinaryObjectSchema is created, it is not possible to change the type
> of a field for a known field name.
>
> My question is whether there is any way to determine the type of that field
> in the Schema.
>
> We are hitting a case were the way we get the data out of a different
> database returns a TIMESTAMP, but our binary object wants a DATE.     In
> this test case, I could figure out that, but in the general case,  I have a
> BinaryObject type name, and a field name, and an exception if I try to put
> the wrong type in that field.
>
> The hokey general solutions I have come up with are:
> 1) Parse the exception message to see what type it wants
> 2) Have a list of conversions to try for the source type, and step through
> them on each exception.
> 3) Get the field from an existing binary object of that type, and use the
> class of the result.   But there is the chicken/egg problem.
>
> I have found that I can create a cache on a cluster with persistence, with
> some type definition, then delete that cache, the cluster will remember the
> BinaryObjectSchema for that type, and refuse to allow me to change the
> field's type.          If I  don't remember the field's type, how can I
> build the binary object?
>
> Is there any way to delete the schema without nuking some of the
> binary-meta/marshaller files when the cluster is down?
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>



-- 

Regards

Pavel Vinokurov