asterixdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Taewoo Kim (Code Review)" <do-not-re...@asterix-gerrit.ics.uci.edu>
Subject Change in asterixdb[master]: Fixed ASTERIXDB-1072 issue - string-concat Change-Id: Id0dd4...
Date Sun, 16 Aug 2015 02:07:27 GMT
Taewoo Kim has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/356

Change subject: Fixed ASTERIXDB-1072 issue - string-concat Change-Id: Id0dd46f983e0275c3f68329f7cfd52cc43363a76
......................................................................

Fixed ASTERIXDB-1072 issue - string-concat
Change-Id: Id0dd46f983e0275c3f68329f7cfd52cc43363a76
---
A asterix-app/src/test/resources/runtimets/queries/string/concat_03/concat_03.1.ddl.aql
A asterix-app/src/test/resources/runtimets/queries/string/concat_03/concat_03.2.update.aql
A asterix-app/src/test/resources/runtimets/queries/string/concat_03/concat_03.3.query.aql
A asterix-app/src/test/resources/runtimets/results/string/concat_03/concat_03.1.adm
M asterix-app/src/test/resources/runtimets/testsuite.xml
M asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringConcatDescriptor.java
6 files changed, 40 insertions(+), 0 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/56/356/1

diff --git a/asterix-app/src/test/resources/runtimets/queries/string/concat_03/concat_03.1.ddl.aql
b/asterix-app/src/test/resources/runtimets/queries/string/concat_03/concat_03.1.ddl.aql
new file mode 100644
index 0000000..f55117e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/concat_03/concat_03.1.ddl.aql
@@ -0,0 +1,8 @@
+/*
+ * Description    : Test concat-string function with heterogenous elements in a list
+ * Success        : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/concat_03/concat_03.2.update.aql
b/asterix-app/src/test/resources/runtimets/queries/string/concat_03/concat_03.2.update.aql
new file mode 100644
index 0000000..eee8b2c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/concat_03/concat_03.2.update.aql
@@ -0,0 +1,6 @@
+/*
+ * Description    : Test concat-string function with heterogenous elements in a list
+ * Success        : Yes
+ */
+
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/concat_03/concat_03.3.query.aql
b/asterix-app/src/test/resources/runtimets/queries/string/concat_03/concat_03.3.query.aql
new file mode 100644
index 0000000..d36530a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/concat_03/concat_03.3.query.aql
@@ -0,0 +1,11 @@
+/*
+ * Description    : Test concat-string function with nulls in the list which is passed as
an argument.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+let $k := [{"a":1, "b":"hello"}, {"a":2, "b":{"k": [1,2,2]}}]
+for $x in $k
+where $x.a = 1
+return string-concat([$x.b, " world"])
diff --git a/asterix-app/src/test/resources/runtimets/results/string/concat_03/concat_03.1.adm
b/asterix-app/src/test/resources/runtimets/results/string/concat_03/concat_03.1.adm
new file mode 100644
index 0000000..e481059
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/string/concat_03/concat_03.1.adm
@@ -0,0 +1,2 @@
+[ "hello world"
+ ]
diff --git a/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterix-app/src/test/resources/runtimets/testsuite.xml
index 898d847..b62645d 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -4741,6 +4741,11 @@
             </compilation-unit>
         </test-case>
         <test-case FilePath="string">
+            <compilation-unit name="concat_03">
+                <output-dir compare="Text">concat_03</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="string">
             <compilation-unit name="constructor">
                 <output-dir compare="Text">constructor</output-dir>
             </compilation-unit>
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringConcatDescriptor.java
b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringConcatDescriptor.java
index c11563a..8c2092b 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringConcatDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringConcatDescriptor.java
@@ -93,6 +93,11 @@
                                 for (int i = 0; i < listAccessor.size(); i++) {
                                     int itemOffset = listAccessor.getItemOffset(i);
                                     ATypeTag itemType = listAccessor.getItemType(itemOffset);
+                                    // Increase the offset by 1 if the give list has heterogeneous
elements,
+                                    // since the item itself has a typetag.
+                                    if (listAccessor.itemsAreSelfDescribing()) {
+                                        itemOffset += 1;
+                                    }
                                     if (itemType != ATypeTag.STRING) {
                                         if (itemType == ATypeTag.NULL) {
                                             nullSerde.serialize(ANull.NULL, out);
@@ -107,6 +112,9 @@
                                 StringUtils.writeUTF8Len(utf8Len, out);
                                 for (int i = 0; i < listAccessor.size(); i++) {
                                     int itemOffset = listAccessor.getItemOffset(i);
+                                    if (listAccessor.itemsAreSelfDescribing()) {
+                                        itemOffset += 1;
+                                    }
                                     utf8Len = UTF8StringPointable.getUTFLength(listBytes,
itemOffset);
                                     for (int j = 0; j < utf8Len; j++) {
                                         out.writeByte(listBytes[2 + itemOffset + j]);

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/356
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id0dd46f983e0275c3f68329f7cfd52cc43363a76
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Taewoo Kim <wangsaeu@gmail.com>

Mime
View raw message