Adding fields without adding to sql table DDL

classic Classic list List threaded Threaded
6 messages Options
ssansoy ssansoy
Reply | Threaded
Open this post in threaded view
|

Adding fields without adding to sql table DDL

Hi, we define our caches via a create table statement, and specify our
various columns/fields.

We would like to add some additional fields, that are not exposed as part of
the DDL, so not visible in a select statement. Is this possible?

If I try and get a BinaryObjectBuilder for my type, and add a field using
setField, this doesn't seem to work. I do this outside of a transaction, and
then invoke an entry processor which sets a value for this field on an
existing entry in the cache. This gives me the following exception:

org.apache.ignite.internal.UnregisteredBinaryTypeException: Attempted to
update binary metadata inside a critical synchronization block (will be
automatically retried).

Is there any way around this? I have a need to store information for each
field about what the previous value of the field was (e.g. each column
specified in my create table statement needs to have a duplicate column
called previous_<column_name>). I'd rather not add this to the sql table as
it would make selects very confusing to the end users as this meta data is
only required for internal processing.

Thanks!
Sham



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

Re: Adding fields without adding to sql table DDL

Hello!

I think you have just discovered that you can't add fields inside an entry processor. Try using a regular put for this. Then, you can also use these fields inside entry processor.

Regards,
--
Ilya Kasnacheev


пт, 13 нояб. 2020 г. в 17:21, ssansoy <[hidden email]>:
Hi, we define our caches via a create table statement, and specify our
various columns/fields.

We would like to add some additional fields, that are not exposed as part of
the DDL, so not visible in a select statement. Is this possible?

If I try and get a BinaryObjectBuilder for my type, and add a field using
setField, this doesn't seem to work. I do this outside of a transaction, and
then invoke an entry processor which sets a value for this field on an
existing entry in the cache. This gives me the following exception:

org.apache.ignite.internal.UnregisteredBinaryTypeException: Attempted to
update binary metadata inside a critical synchronization block (will be
automatically retried).

Is there any way around this? I have a need to store information for each
field about what the previous value of the field was (e.g. each column
specified in my create table statement needs to have a duplicate column
called previous_<column_name>). I'd rather not add this to the sql table as
it would make selects very confusing to the end users as this meta data is
only required for internal processing.

Thanks!
Sham



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

Re: Adding fields without adding to sql table DDL

Thanks for the tip!
Is there documentation anywhere about how this would appear in a select?
would the new field be added to the table schema as well? (we don't want
this)



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

Re: Adding fields without adding to sql table DDL

Hello!

No, it would not appear in select and in table schema.

The only way of adding a field to table schema is by invoking ALTER TABLE ADD COLUMN.

Regards,
--
Ilya Kasnacheev


пт, 13 нояб. 2020 г. в 17:37, ssansoy <[hidden email]>:
Thanks for the tip!
Is there documentation anywhere about how this would appear in a select?
would the new field be added to the table schema as well? (we don't want
this)



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

Re: Adding fields without adding to sql table DDL

Last question.... would this work with datastreamer? e.g. adding a field
inside the transformation?
Thanks!



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

Re: Adding fields without adding to sql table DDL

Hello!

I have no idea and I think it depends on the StreamReceived/allowOverwrite. Please try it and see.

Regards,
--
Ilya Kasnacheev


пт, 13 нояб. 2020 г. в 18:06, ssansoy <[hidden email]>:
Last question.... would this work with datastreamer? e.g. adding a field
inside the transformation?
Thanks!



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