+1 for this (obviously, since I am on it). FYI, we have also run our
UPDATE user model and syntax by Yannis P (father of SQL++) and Don C
(father of SQL) for their input prior to posting this APE. :-) We've
needed this feature for quite some time in order to conveniently express
small(-ish) changes to arbitrary (possibly large) schema-less documents.
Discussion welcome!
Cheers,
Mike
On 10/18/24 3:18 PM, Abhishek Jindal wrote:
Hi All,
I'm initiating a discussion thread proposing the SQL++ UPDATE statement in
AsterixDB.
*Feature:* Adding support for SQL++ UPDATE statement.
*Details:* AsterixDB currently does not support UPDATE operations without having
to pass an entire new object to replace an existing record in a collection.
The following proposal discusses syntax and semantics of the UPDATE statement
as part of
SQL++ for AsterixDB.
We plan to implement this feature by rewriting the UPDATE statement into its
equivalent
UPSERT form, allowing us to reuse the existing LSM-tree UPSERT machinery to
handle the transformed incoming record.
To apply transformations to an incoming record, we employ the following
approach:
1. We recursively traverse the hierarchy of transformations as specified by the
user in the query.
2. At each hierarchical level, we rewrite the transformation to the equivalent
record-merge() built-in function.
3. These rewritten record-merge() transformations are then combined in a
bottom-up manner, finally producing the final transformation function.
APE
:https://cwiki.apache.org/confluence/display/ASTERIXDB/APE+9%3A+UPDATE+Statement