You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@asterixdb.apache.org by AsterixDB Code Review <do...@asterix-gerrit.ics.uci.edu> on 2026/07/13 23:47:53 UTC
[S] Change in asterixdb[trinity]: [ASTERIXDB-3718][COMP] Fixing the result of object_put function
From Shahrzad Shirazi <sh...@ucr.edu>:
Attention is currently required from: Ali Alsuliman.
Hello Ali Alsuliman, Jenkins,
I'd like you to do a code review.
Please visit
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21427?usp=email
to review the following change.
Change subject: [ASTERIXDB-3718][COMP] Fixing the result of object_put function
......................................................................
[ASTERIXDB-3718][COMP] Fixing the result of object_put function
- user model changes: no
- storage format changes: no
- interface changes: no
Ext-ref: MB-70835
Change-Id: I434142a9b9cd2d1fc941b4e4f4503f8403a734ec
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21005
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Ali Alsuliman <al...@gmail.com>
(cherry picked from commit bbf35e83939207dd77ed3f00b73e69fccd02f91a)
---
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object_put/object_put.8.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object_put/object_put.8.adm
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordPutEvaluator.java
3 files changed, 40 insertions(+), 3 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/27/21427/1
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object_put/object_put.8.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object_put/object_put.8.query.sqlpp
new file mode 100644
index 0000000..a606506
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object_put/object_put.8.query.sqlpp
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*
+ * Description : Testing object_put under different queries.
+ * Expected Res : Success
+ */
+
+use TestDataverse;
+
+
+SELECT VALUE {
+
+ "t1c": object_put({"a": 1, "b": 2}, "a", missing),
+ "t2c": object_put({"a": 1, "b": 2}, "a", 3),
+ "t3c": object_put({"a": 1, "b": 2}, "b", 3),
+ "t4c": object_put({"a": 1, "b": 2}, "d", 3),
+ "t5c": object_put({"a": 1, "b": 2, "c": 7}, "b", 3)
+};
+
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object_put/object_put.8.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object_put/object_put.8.adm
new file mode 100644
index 0000000..9872250
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object_put/object_put.8.adm
@@ -0,0 +1 @@
+{ "t1c": { "b": 2 }, "t2c": { "a": 3, "b": 2 }, "t3c": { "a": 1, "b": 3 }, "t4c": { "a": 1, "b": 2, "d": 3 }, "t5c": { "a": 1, "b": 3, "c": 7 } }
\ No newline at end of file
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordPutEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordPutEvaluator.java
index 3a9f3f8..d5551c9 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordPutEvaluator.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordPutEvaluator.java
@@ -44,13 +44,13 @@
for (int i = 0, fieldCount = fieldNames.size(); i < fieldCount; i++) {
final IVisitablePointable fieldName = fieldNames.get(i);
final IVisitablePointable fieldValue = fieldValues.get(i);
- if (!newFieldFound && !PointableHelper.isEqual(fieldName, newFieldNamePointable, stringBinaryComparator)) {
- addField(fieldName, fieldValue);
- } else {
+ if (PointableHelper.isEqual(fieldName, newFieldNamePointable, stringBinaryComparator)) {
newFieldFound = true;
if (!newFieldValueIsMissing) {
addField(newFieldNamePointable, newFieldValuePointable);
}
+ } else {
+ addField(fieldName, fieldValue);
}
}
if (!newFieldFound) {
--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21427?usp=email
To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: asterixdb
Gerrit-Branch: trinity
Gerrit-Change-Id: I434142a9b9cd2d1fc941b4e4f4503f8403a734ec
Gerrit-Change-Number: 21427
Gerrit-PatchSet: 1
Gerrit-Owner: Shahrzad Shirazi <sh...@ucr.edu>
Gerrit-Reviewer: Ali Alsuliman <al...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Attention: Ali Alsuliman <al...@gmail.com>