You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by al...@apache.org on 2019/07/19 16:58:27 UTC
[asterixdb] branch master updated: [NO ISSUE][COMP] Fix error in
StaticTypeCastUtil
This is an automated email from the ASF dual-hosted git repository.
alsuliman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git
The following commit(s) were added to refs/heads/master by this push:
new 893db28 [NO ISSUE][COMP] Fix error in StaticTypeCastUtil
893db28 is described below
commit 893db2874bd107d46fed1e4180422df9af0b679b
Author: Dmitry Lychagin <dm...@couchbase.com>
AuthorDate: Thu Jul 18 16:46:28 2019 -0700
[NO ISSUE][COMP] Fix error in StaticTypeCastUtil
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
- Fix ArrayIndexOutOfBoundsException in StaticTypeCastUtil
Change-Id: I4bbd3f8680cc71fcf04b2e88fe155e7236ace54c
Reviewed-on: https://asterix-gerrit.ics.uci.edu/3505
Contrib: Jenkins <je...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Dmitry Lychagin <dm...@couchbase.com>
Reviewed-by: Till Westmann <ti...@apache.org>
---
.../rules/typecast/StaticTypeCastUtil.java | 3 ++-
.../query-ASTERIXDB-2529.2.query.sqlpp | 23 ++++++++++++++++++++++
.../query-ASTERIXDB-2529.2.adm | 1 +
3 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/typecast/StaticTypeCastUtil.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/typecast/StaticTypeCastUtil.java
index eee53e2..19cc680 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/typecast/StaticTypeCastUtil.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/typecast/StaticTypeCastUtil.java
@@ -458,7 +458,8 @@ public class StaticTypeCastUtil {
for (int i = openFields.nextSetBit(0); i >= 0; i = openFields.nextSetBit(i + 1)) {
newArguments.add(arguments.get(i * 2));
Mutable<ILogicalExpression> expRef = arguments.get(i * 2 + 1);
- injectCastToRelaxType(expRef, inputFieldTypes[i], env);
+ IAType expType = (IAType) env.getType(expRef.getValue());
+ injectCastToRelaxType(expRef, expType, env);
newArguments.add(expRef);
}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/query-ASTERIXDB-2529/query-ASTERIXDB-2529.2.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/query-ASTERIXDB-2529/query-ASTERIXDB-2529.2.query.sqlpp
new file mode 100644
index 0000000..9aecebe
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/query-ASTERIXDB-2529/query-ASTERIXDB-2529.2.query.sqlpp
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+
+FROM [
+ {"id": 1, "t1": (array_append(missing, 3, 9))} // missing
+] AS d
+SELECT VALUE d
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/objects/query-ASTERIXDB-2529/query-ASTERIXDB-2529.2.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/objects/query-ASTERIXDB-2529/query-ASTERIXDB-2529.2.adm
new file mode 100644
index 0000000..5c0326b
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/objects/query-ASTERIXDB-2529/query-ASTERIXDB-2529.2.adm
@@ -0,0 +1 @@
+{ "id": 1 }
\ No newline at end of file