[
https://issues.apache.org/jira/browse/CASSANDRA-11424?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15366055#comment-15366055
]
Sylvain Lebresne commented on CASSANDRA-11424:
----------------------------------------------
To be clear, I'm not really against the {{IGNORE_OMITTED}} approach, but I just
want to explore all the options.
In fact, *if* our default had been to left omitted columns unset, then I'd have
insisted more on that column idea since getting null for omitted values could
have bee then done with {{INSERT INTO t( *) JSON ...}}, which is kind of
consistent, but as that's not the case and it's too late to change, a simple
flag is probably the most pragmatic option.
That said, to bikkeshed on syntax, we don't use underscore for keywords in CQL,
and having it after the value reads a bit better imo, so:
{noformat}
INSERT INTO t JSON '{"k":"v"}' IGNORE OMITTED
{noformat}
In fact, to bikkeshed even further, an alternative would be to call it
{{DEFAULT UNSET}} (as in, by default, columns are unset), and to also support
{{DEFAULT NULL}}, which would be the default, but that you could add if you
like explicitness. I have a slight preference for that later option but that's
arguably totally subjective.
Anyway, [~thobbs] might also have an opinion since he added the JSON support
and so may have though about this already.
> Add support to "unset" JSON fields in prepared statements
> ---------------------------------------------------------
>
> Key: CASSANDRA-11424
> URL: https://issues.apache.org/jira/browse/CASSANDRA-11424
> Project: Cassandra
> Issue Type: Improvement
> Reporter: Ralf Steppacher
>
> CASSANDRA-7304 introduced the ability to distinguish between {{NULL}} and
> {{UNSET}} prepared statement parameters.
> When inserting JSON objects it is not possible to profit from this as a
> prepared statement only has one parameter that is bound to the JSON object as
> a whole. There is no way to control {{NULL}} vs {{UNSET}} behavior for
> columns omitted from the JSON object.
> Please extend on CASSANDRA-7304 to include JSON support.
> {color:grey}
> (My personal requirement is to be able to insert JSON objects with optional
> fields without incurring the overhead of creating a tombstone of every column
> not covered by the JSON object upon initial(!) insert.)
> {color}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)