You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by ssansoy <s....@cmcmarkets.com> on 2020/11/13 14:21:16 UTC

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/

Re: Adding fields without adding to sql table DDL

Posted by Ilya Kasnacheev <il...@gmail.com>.
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 <s....@cmcmarkets.com>:

> 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/
>

Re: Adding fields without adding to sql table DDL

Posted by ssansoy <s....@cmcmarkets.com>.
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/

Re: Adding fields without adding to sql table DDL

Posted by Ilya Kasnacheev <il...@gmail.com>.
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 <s....@cmcmarkets.com>:

> 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/
>

Re: Adding fields without adding to sql table DDL

Posted by ssansoy <s....@cmcmarkets.com>.
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/

Re: Adding fields without adding to sql table DDL

Posted by Ilya Kasnacheev <il...@gmail.com>.
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 <s....@cmcmarkets.com>:

> 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/
>