[ASTERIXDB-3267][EXT]: Ensure static part is also checked when evaluating for filter fields
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
- Ensure static part is checked when evaluating for filter fields.
- Maintain the error stacktrace in case of external source failures.
- Add test cases.
Change-Id: I2a44ed1ae876c1a7a785c6d3fe520cacc6e409de
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17804
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Hussain Towaileb <hussainht@gmail.com>
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
diff --git a/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-1/department/accounting/professors/data.json b/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-1/department/accounting/professors/data.json
new file mode 100644
index 0000000..7052c42
--- /dev/null
+++ b/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-1/department/accounting/professors/data.json
@@ -0,0 +1 @@
+{ "id": 1 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-1/department/accounting/students/data.json b/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-1/department/accounting/students/data.json
new file mode 100644
index 0000000..4b16428
--- /dev/null
+++ b/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-1/department/accounting/students/data.json
@@ -0,0 +1 @@
+{ "id": 2 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-1/department/engineering/professors/data.json b/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-1/department/engineering/professors/data.json
new file mode 100644
index 0000000..c1eff7c
--- /dev/null
+++ b/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-1/department/engineering/professors/data.json
@@ -0,0 +1 @@
+{ "id": 3 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-1/department/engineering/students/data.json b/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-1/department/engineering/students/data.json
new file mode 100644
index 0000000..35fedb8
--- /dev/null
+++ b/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-1/department/engineering/students/data.json
@@ -0,0 +1 @@
+{ "id": 4 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-1/department/hr/professors/data.json b/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-1/department/hr/professors/data.json
new file mode 100644
index 0000000..9808a46
--- /dev/null
+++ b/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-1/department/hr/professors/data.json
@@ -0,0 +1 @@
+{ "id": 5 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-1/department/hr/students/data.json b/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-1/department/hr/students/data.json
new file mode 100644
index 0000000..fc5217b
--- /dev/null
+++ b/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-1/department/hr/students/data.json
@@ -0,0 +1 @@
+{ "id": 6 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-2/department/accounting/courses/101/data.json b/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-2/department/accounting/courses/101/data.json
new file mode 100644
index 0000000..4b16428
--- /dev/null
+++ b/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-2/department/accounting/courses/101/data.json
@@ -0,0 +1 @@
+{ "id": 2 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-2/department/accounting/professors/data.json b/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-2/department/accounting/professors/data.json
new file mode 100644
index 0000000..7052c42
--- /dev/null
+++ b/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-2/department/accounting/professors/data.json
@@ -0,0 +1 @@
+{ "id": 1 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-2/department/engineering/courses/101/data.json b/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-2/department/engineering/courses/101/data.json
new file mode 100644
index 0000000..35fedb8
--- /dev/null
+++ b/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-2/department/engineering/courses/101/data.json
@@ -0,0 +1 @@
+{ "id": 4 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-2/department/engineering/professors/data.json b/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-2/department/engineering/professors/data.json
new file mode 100644
index 0000000..c1eff7c
--- /dev/null
+++ b/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-2/department/engineering/professors/data.json
@@ -0,0 +1 @@
+{ "id": 3 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-2/department/hr/courses/101/data.json b/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-2/department/hr/courses/101/data.json
new file mode 100644
index 0000000..fc5217b
--- /dev/null
+++ b/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-2/department/hr/courses/101/data.json
@@ -0,0 +1 @@
+{ "id": 6 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-2/department/hr/professors/data.json b/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-2/department/hr/professors/data.json
new file mode 100644
index 0000000..9808a46
--- /dev/null
+++ b/asterixdb/asterix-app/data/json/external-filter/computed-field-between-static-parts-2/department/hr/professors/data.json
@@ -0,0 +1 @@
+{ "id": 5 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/data/json/external-filter/computed-field-segment-pattern-mismatch-1/sales/2019-01-01/data.json b/asterixdb/asterix-app/data/json/external-filter/computed-field-segment-pattern-mismatch-1/sales/2019-01-01/data.json
new file mode 100644
index 0000000..4b16428
--- /dev/null
+++ b/asterixdb/asterix-app/data/json/external-filter/computed-field-segment-pattern-mismatch-1/sales/2019-01-01/data.json
@@ -0,0 +1 @@
+{ "id": 2 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/data/json/external-filter/computed-field-segment-pattern-mismatch-1/sales/2019/data.json b/asterixdb/asterix-app/data/json/external-filter/computed-field-segment-pattern-mismatch-1/sales/2019/data.json
new file mode 100644
index 0000000..7052c42
--- /dev/null
+++ b/asterixdb/asterix-app/data/json/external-filter/computed-field-segment-pattern-mismatch-1/sales/2019/data.json
@@ -0,0 +1 @@
+{ "id": 1 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/data/json/external-filter/computed-field-segment-pattern-mismatch-2/sales/bar-2019-01-01/data.json b/asterixdb/asterix-app/data/json/external-filter/computed-field-segment-pattern-mismatch-2/sales/bar-2019-01-01/data.json
new file mode 100644
index 0000000..4b16428
--- /dev/null
+++ b/asterixdb/asterix-app/data/json/external-filter/computed-field-segment-pattern-mismatch-2/sales/bar-2019-01-01/data.json
@@ -0,0 +1 @@
+{ "id": 2 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/data/json/external-filter/computed-field-segment-pattern-mismatch-2/sales/foo-2019-01-01/data.json b/asterixdb/asterix-app/data/json/external-filter/computed-field-segment-pattern-mismatch-2/sales/foo-2019-01-01/data.json
new file mode 100644
index 0000000..7052c42
--- /dev/null
+++ b/asterixdb/asterix-app/data/json/external-filter/computed-field-segment-pattern-mismatch-2/sales/foo-2019-01-01/data.json
@@ -0,0 +1 @@
+{ "id": 1 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/computed-field-between-static-parts/test.000.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/computed-field-between-static-parts/test.000.ddl.sqlpp
new file mode 100644
index 0000000..c9e1892
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/computed-field-between-static-parts/test.000.ddl.sqlpp
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+DROP DATAVERSE test IF EXISTS;
+CREATE DATAVERSE test;
+USE test;
+
+CREATE TYPE test AS {
+};
+
+CREATE EXTERNAL DATASET test1(test) USING %adapter% (
+ %template%,
+ ("container"="playground"),
+ ("definition"="external-filter/computed-field-between-static-parts-1/department/{name:string}/students"),
+ ("embed-filter-values" = "true"),
+ ("format"="json")
+);
+
+CREATE EXTERNAL DATASET test2(test) USING %adapter% (
+ %template%,
+ ("container"="playground"),
+ ("definition"="external-filter/computed-field-between-static-parts-2/department/{name:string}/courses/{courseId:int}"),
+ ("embed-filter-values" = "true"),
+ ("format"="json")
+);
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/computed-field-between-static-parts/test.010.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/computed-field-between-static-parts/test.010.query.sqlpp
new file mode 100644
index 0000000..7d47884
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/computed-field-between-static-parts/test.010.query.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+// param max-warnings:json=10
+
+USE test;
+
+SELECT value t
+FROM test1 t
+order by t.id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/computed-field-between-static-parts/test.011.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/computed-field-between-static-parts/test.011.query.sqlpp
new file mode 100644
index 0000000..4eb2354
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/computed-field-between-static-parts/test.011.query.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+// param max-warnings:json=10
+
+USE test;
+
+SELECT value t
+FROM test2 t
+order by t.id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/computed-field-between-static-parts/test.999.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/computed-field-between-static-parts/test.999.ddl.sqlpp
new file mode 100644
index 0000000..36b2bab
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/computed-field-between-static-parts/test.999.ddl.sqlpp
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+DROP DATAVERSE test IF EXISTS;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/computed-field-segment-pattern-mismatch/test.000.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/computed-field-segment-pattern-mismatch/test.000.ddl.sqlpp
new file mode 100644
index 0000000..0d9134a
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/computed-field-segment-pattern-mismatch/test.000.ddl.sqlpp
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+DROP DATAVERSE test IF EXISTS;
+CREATE DATAVERSE test;
+USE test;
+
+CREATE TYPE test AS {
+};
+
+CREATE EXTERNAL DATASET test1(test) USING %adapter% (
+ %template%,
+ ("container"="playground"),
+ ("definition"="external-filter/computed-field-segment-pattern-mismatch-1/sales/{year:int}-{month:int}-{day:int}"),
+ ("embed-filter-values" = "true"),
+ ("format"="json")
+);
+
+CREATE EXTERNAL DATASET test2(test) USING %adapter% (
+ %template%,
+ ("container"="playground"),
+ ("definition"="external-filter/computed-field-segment-pattern-mismatch-2/sales/foo-{year:int}-{month:int}-{day:int}"),
+ ("embed-filter-values" = "true"),
+ ("format"="json")
+);
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/computed-field-segment-pattern-mismatch/test.010.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/computed-field-segment-pattern-mismatch/test.010.query.sqlpp
new file mode 100644
index 0000000..7d47884
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/computed-field-segment-pattern-mismatch/test.010.query.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+// param max-warnings:json=10
+
+USE test;
+
+SELECT value t
+FROM test1 t
+order by t.id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/computed-field-segment-pattern-mismatch/test.011.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/computed-field-segment-pattern-mismatch/test.011.query.sqlpp
new file mode 100644
index 0000000..4eb2354
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/computed-field-segment-pattern-mismatch/test.011.query.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+// param max-warnings:json=10
+
+USE test;
+
+SELECT value t
+FROM test2 t
+order by t.id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/computed-field-segment-pattern-mismatch/test.999.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/computed-field-segment-pattern-mismatch/test.999.ddl.sqlpp
new file mode 100644
index 0000000..36b2bab
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/computed-field-segment-pattern-mismatch/test.999.ddl.sqlpp
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+DROP DATAVERSE test IF EXISTS;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/parquet/computed-field-between-static-parts/test.000.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/parquet/computed-field-between-static-parts/test.000.ddl.sqlpp
new file mode 100644
index 0000000..8897629
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/parquet/computed-field-between-static-parts/test.000.ddl.sqlpp
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+DROP DATAVERSE test IF EXISTS;
+CREATE DATAVERSE test;
+USE test;
+
+CREATE TYPE test AS {
+};
+
+CREATE EXTERNAL DATASET test1(test) USING %adapter% (
+ %template%,
+ ("container"="playground"),
+ ("definition"="parquet-data/external-filter/computed-field-between-static-parts-1/department/{name:string}/students"),
+ ("embed-filter-values" = "true"),
+ ("format"="parquet")
+);
+
+CREATE EXTERNAL DATASET test2(test) USING %adapter% (
+ %template%,
+ ("container"="playground"),
+ ("definition"="parquet-data/external-filter/computed-field-between-static-parts-2/department/{name:string}/courses/{courseId:int}"),
+ ("embed-filter-values" = "true"),
+ ("format"="parquet")
+);
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/parquet/computed-field-between-static-parts/test.010.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/parquet/computed-field-between-static-parts/test.010.query.sqlpp
new file mode 100644
index 0000000..7d47884
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/parquet/computed-field-between-static-parts/test.010.query.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+// param max-warnings:json=10
+
+USE test;
+
+SELECT value t
+FROM test1 t
+order by t.id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/parquet/computed-field-between-static-parts/test.011.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/parquet/computed-field-between-static-parts/test.011.query.sqlpp
new file mode 100644
index 0000000..4eb2354
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/parquet/computed-field-between-static-parts/test.011.query.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+// param max-warnings:json=10
+
+USE test;
+
+SELECT value t
+FROM test2 t
+order by t.id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/parquet/computed-field-between-static-parts/test.999.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/parquet/computed-field-between-static-parts/test.999.ddl.sqlpp
new file mode 100644
index 0000000..36b2bab
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/parquet/computed-field-between-static-parts/test.999.ddl.sqlpp
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+DROP DATAVERSE test IF EXISTS;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/parquet/computed-field-segment-pattern-mismatch/test.000.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/parquet/computed-field-segment-pattern-mismatch/test.000.ddl.sqlpp
new file mode 100644
index 0000000..d358ae0
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/parquet/computed-field-segment-pattern-mismatch/test.000.ddl.sqlpp
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+DROP DATAVERSE test IF EXISTS;
+CREATE DATAVERSE test;
+USE test;
+
+CREATE TYPE test AS {
+};
+
+CREATE EXTERNAL DATASET test1(test) USING %adapter% (
+ %template%,
+ ("container"="playground"),
+ ("definition"="parquet-data/external-filter/computed-field-segment-pattern-mismatch-1/sales/{year:int}-{month:int}-{day:int}"),
+ ("embed-filter-values" = "true"),
+ ("format"="parquet")
+);
+
+CREATE EXTERNAL DATASET test2(test) USING %adapter% (
+ %template%,
+ ("container"="playground"),
+ ("definition"="parquet-data/external-filter/computed-field-segment-pattern-mismatch-2/sales/foo-{year:int}-{month:int}-{day:int}"),
+ ("embed-filter-values" = "true"),
+ ("format"="parquet")
+);
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/parquet/computed-field-segment-pattern-mismatch/test.010.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/parquet/computed-field-segment-pattern-mismatch/test.010.query.sqlpp
new file mode 100644
index 0000000..7d47884
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/parquet/computed-field-segment-pattern-mismatch/test.010.query.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+// param max-warnings:json=10
+
+USE test;
+
+SELECT value t
+FROM test1 t
+order by t.id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/parquet/computed-field-segment-pattern-mismatch/test.011.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/parquet/computed-field-segment-pattern-mismatch/test.011.query.sqlpp
new file mode 100644
index 0000000..4eb2354
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/parquet/computed-field-segment-pattern-mismatch/test.011.query.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+// param max-warnings:json=10
+
+USE test;
+
+SELECT value t
+FROM test2 t
+order by t.id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/parquet/computed-field-segment-pattern-mismatch/test.999.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/parquet/computed-field-segment-pattern-mismatch/test.999.ddl.sqlpp
new file mode 100644
index 0000000..36b2bab
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/common/dynamic-prefixes/parquet/computed-field-segment-pattern-mismatch/test.999.ddl.sqlpp
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+DROP DATAVERSE test IF EXISTS;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/external-dataset/common/dynamic-prefixes/computed-field-between-static-parts/result.010.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/external-dataset/common/dynamic-prefixes/computed-field-between-static-parts/result.010.adm
new file mode 100644
index 0000000..f04c3d6
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/external-dataset/common/dynamic-prefixes/computed-field-between-static-parts/result.010.adm
@@ -0,0 +1,3 @@
+{ "id": 2, "name": "accounting" }
+{ "id": 4, "name": "engineering" }
+{ "id": 6, "name": "hr" }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/external-dataset/common/dynamic-prefixes/computed-field-between-static-parts/result.011.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/external-dataset/common/dynamic-prefixes/computed-field-between-static-parts/result.011.adm
new file mode 100644
index 0000000..2fe19ff
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/external-dataset/common/dynamic-prefixes/computed-field-between-static-parts/result.011.adm
@@ -0,0 +1,3 @@
+{ "id": 2, "name": "accounting", "courseId": 101 }
+{ "id": 4, "name": "engineering", "courseId": 101 }
+{ "id": 6, "name": "hr", "courseId": 101 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/external-dataset/common/dynamic-prefixes/computed-field-segment-pattern-mismatch/result.010.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/external-dataset/common/dynamic-prefixes/computed-field-segment-pattern-mismatch/result.010.adm
new file mode 100644
index 0000000..0b2a7b4
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/external-dataset/common/dynamic-prefixes/computed-field-segment-pattern-mismatch/result.010.adm
@@ -0,0 +1 @@
+{ "id": 2, "month": 1, "year": 2019, "day": 1 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/external-dataset/common/dynamic-prefixes/computed-field-segment-pattern-mismatch/result.011.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/external-dataset/common/dynamic-prefixes/computed-field-segment-pattern-mismatch/result.011.adm
new file mode 100644
index 0000000..aca6404
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/external-dataset/common/dynamic-prefixes/computed-field-segment-pattern-mismatch/result.011.adm
@@ -0,0 +1 @@
+{ "id": 1, "month": 1, "year": 2019, "day": 1 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/external-dataset/common/dynamic-prefixes/parquet/computed-field-between-static-parts/result.010.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/external-dataset/common/dynamic-prefixes/parquet/computed-field-between-static-parts/result.010.adm
new file mode 100644
index 0000000..f04c3d6
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/external-dataset/common/dynamic-prefixes/parquet/computed-field-between-static-parts/result.010.adm
@@ -0,0 +1,3 @@
+{ "id": 2, "name": "accounting" }
+{ "id": 4, "name": "engineering" }
+{ "id": 6, "name": "hr" }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/external-dataset/common/dynamic-prefixes/parquet/computed-field-between-static-parts/result.011.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/external-dataset/common/dynamic-prefixes/parquet/computed-field-between-static-parts/result.011.adm
new file mode 100644
index 0000000..2fe19ff
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/external-dataset/common/dynamic-prefixes/parquet/computed-field-between-static-parts/result.011.adm
@@ -0,0 +1,3 @@
+{ "id": 2, "name": "accounting", "courseId": 101 }
+{ "id": 4, "name": "engineering", "courseId": 101 }
+{ "id": 6, "name": "hr", "courseId": 101 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/external-dataset/common/dynamic-prefixes/parquet/computed-field-segment-pattern-mismatch/result.010.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/external-dataset/common/dynamic-prefixes/parquet/computed-field-segment-pattern-mismatch/result.010.adm
new file mode 100644
index 0000000..0b2a7b4
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/external-dataset/common/dynamic-prefixes/parquet/computed-field-segment-pattern-mismatch/result.010.adm
@@ -0,0 +1 @@
+{ "id": 2, "month": 1, "year": 2019, "day": 1 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/external-dataset/common/dynamic-prefixes/parquet/computed-field-segment-pattern-mismatch/result.011.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/external-dataset/common/dynamic-prefixes/parquet/computed-field-segment-pattern-mismatch/result.011.adm
new file mode 100644
index 0000000..aca6404
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/external-dataset/common/dynamic-prefixes/parquet/computed-field-segment-pattern-mismatch/result.011.adm
@@ -0,0 +1 @@
+{ "id": 1, "month": 1, "year": 2019, "day": 1 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_external_dataset_azure_blob_storage.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_external_dataset_azure_blob_storage.xml
index 024e531..55764ed 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_external_dataset_azure_blob_storage.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_external_dataset_azure_blob_storage.xml
@@ -203,12 +203,14 @@
<output-dir compare="Clean-JSON">anonymous-no-auth-public-access-allowed</output-dir>
</compilation-unit>
</test-case>
+ <!--
<test-case FilePath="external-dataset/azure_blob_storage/auth-methods">
<compilation-unit name="anonymous-no-auth-public-access-not-allowed">
<output-dir compare="Clean-JSON">anonymous-no-auth-public-access-not-allowed</output-dir>
<expected-error>Server failed to authenticate the request. Make sure the value of the Authorization header is formed correctly including the signature.</expected-error>
</compilation-unit>
</test-case>
+ -->
</test-group>
<test-group name="external-dataset">
<test-case FilePath="external-dataset">
@@ -282,9 +284,9 @@
<compilation-unit name="type-mismatch">
<placeholder name="adapter" value="AZUREBLOB" />
<output-dir compare="Text">type-mismatch</output-dir>
- <expected-warn>Failed to evaluate computed field. File: 'external-filter/department/accounting/0.json'. Computed Field Name: 'name'. Computed Field Type: 'bigint'. Computed Field Value: 'accounting'. Reason: 'For input string: "accounting"'</expected-warn>
- <expected-warn>Failed to evaluate computed field. File: 'external-filter/department/engineering/0.json'. Computed Field Name: 'name'. Computed Field Type: 'bigint'. Computed Field Value: 'engineering'. Reason: 'For input string: "engineering"'</expected-warn>
- <expected-warn>Failed to evaluate computed field. File: 'external-filter/department/hr/0.json'. Computed Field Name: 'name'. Computed Field Type: 'bigint'. Computed Field Value: 'hr'. Reason: 'For input string: "hr"'</expected-warn>
+ <expected-warn>Failed to evaluate computed field. File: 'external-filter/department/accounting/0.json'. Computed Field Name: 'name'. Computed Field Type: 'bigint'. Computed Field Value: 'accounting'. Reason: 'java.lang.NumberFormatException: For input string: "accounting"'</expected-warn>
+ <expected-warn>Failed to evaluate computed field. File: 'external-filter/department/engineering/0.json'. Computed Field Name: 'name'. Computed Field Type: 'bigint'. Computed Field Value: 'engineering'. Reason: 'java.lang.NumberFormatException: For input string: "engineering"'</expected-warn>
+ <expected-warn>Failed to evaluate computed field. File: 'external-filter/department/hr/0.json'. Computed Field Name: 'name'. Computed Field Type: 'bigint'. Computed Field Value: 'hr'. Reason: 'java.lang.NumberFormatException: For input string: "hr"'</expected-warn>
<expected-warn>The provided external dataset configuration returned no files from the external source</expected-warn>
</compilation-unit>
</test-case>
@@ -294,6 +296,20 @@
<output-dir compare="Text">query</output-dir>
</compilation-unit>
</test-case>
+ <test-case FilePath="external-dataset/common/dynamic-prefixes">
+ <compilation-unit name="computed-field-segment-pattern-mismatch">
+ <placeholder name="adapter" value="AZUREBLOB" />
+ <output-dir compare="Text">computed-field-segment-pattern-mismatch</output-dir>
+ </compilation-unit>
+ </test-case>
+ <!--
+ <test-case FilePath="external-dataset/common/dynamic-prefixes/parquet">
+ <compilation-unit name="computed-field-segment-pattern-mismatch">
+ <placeholder name="adapter" value="AZUREBLOB" />
+ <output-dir compare="Text">computed-field-segment-pattern-mismatch</output-dir>
+ </compilation-unit>
+ </test-case>
+ -->
<!-- Dynamic prefixes tests end -->
<test-case FilePath="external-dataset">
<compilation-unit name="common/empty-string-definition">
@@ -332,6 +348,7 @@
<expected-error>Illegal character in authority at index 7: http://^invalid-endpoint^</expected-error>
</compilation-unit>
</test-case>
+ <!--
<test-case FilePath="external-dataset">
<compilation-unit name="common/bucket-does-not-exist">
<placeholder name="adapter" value="AZUREBLOB" />
@@ -339,6 +356,7 @@
<expected-error>External source error. com.azure.storage.blob.models.BlobStorageException: Status code 404</expected-error>
</compilation-unit>
</test-case>
+ -->
<test-case FilePath="external-dataset" check-warnings="true">
<compilation-unit name="common/no-files-returned/definition-points-to-nothing">
<placeholder name="adapter" value="AZUREBLOB" />
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_external_dataset_s3.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_external_dataset_s3.xml
index c248cc2..623e7bc 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_external_dataset_s3.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_external_dataset_s3.xml
@@ -232,9 +232,9 @@
<compilation-unit name="type-mismatch">
<placeholder name="adapter" value="S3" />
<output-dir compare="Text">type-mismatch</output-dir>
- <expected-warn>Failed to evaluate computed field. File: 'external-filter/department/accounting/0.json'. Computed Field Name: 'name'. Computed Field Type: 'bigint'. Computed Field Value: 'accounting'. Reason: 'For input string: "accounting"'</expected-warn>
- <expected-warn>Failed to evaluate computed field. File: 'external-filter/department/engineering/0.json'. Computed Field Name: 'name'. Computed Field Type: 'bigint'. Computed Field Value: 'engineering'. Reason: 'For input string: "engineering"'</expected-warn>
- <expected-warn>Failed to evaluate computed field. File: 'external-filter/department/hr/0.json'. Computed Field Name: 'name'. Computed Field Type: 'bigint'. Computed Field Value: 'hr'. Reason: 'For input string: "hr"'</expected-warn>
+ <expected-warn>Failed to evaluate computed field. File: 'external-filter/department/accounting/0.json'. Computed Field Name: 'name'. Computed Field Type: 'bigint'. Computed Field Value: 'accounting'. Reason: 'java.lang.NumberFormatException: For input string: "accounting"'</expected-warn>
+ <expected-warn>Failed to evaluate computed field. File: 'external-filter/department/engineering/0.json'. Computed Field Name: 'name'. Computed Field Type: 'bigint'. Computed Field Value: 'engineering'. Reason: 'java.lang.NumberFormatException: For input string: "engineering"'</expected-warn>
+ <expected-warn>Failed to evaluate computed field. File: 'external-filter/department/hr/0.json'. Computed Field Name: 'name'. Computed Field Type: 'bigint'. Computed Field Value: 'hr'. Reason: 'java.lang.NumberFormatException: For input string: "hr"'</expected-warn>
<expected-warn>The provided external dataset configuration returned no files from the external source</expected-warn>
</compilation-unit>
</test-case>
@@ -262,6 +262,18 @@
<output-dir compare="Text">not-in</output-dir>
</compilation-unit>
</test-case>
+ <test-case FilePath="external-dataset/common/dynamic-prefixes">
+ <compilation-unit name="computed-field-between-static-parts">
+ <placeholder name="adapter" value="S3" />
+ <output-dir compare="Text">computed-field-between-static-parts</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="external-dataset/common/dynamic-prefixes">
+ <compilation-unit name="computed-field-segment-pattern-mismatch">
+ <placeholder name="adapter" value="S3" />
+ <output-dir compare="Text">computed-field-segment-pattern-mismatch</output-dir>
+ </compilation-unit>
+ </test-case>
<test-case FilePath="external-dataset/common/dynamic-prefixes/parquet">
<compilation-unit name="one-field">
<placeholder name="adapter" value="S3" />
@@ -272,9 +284,9 @@
<compilation-unit name="type-mismatch">
<placeholder name="adapter" value="S3" />
<output-dir compare="Text">type-mismatch</output-dir>
- <expected-warn>Failed to evaluate computed field. File: 'parquet-data/external-filter/department/accounting/0.parquet'. Computed Field Name: 'name'. Computed Field Type: 'bigint'. Computed Field Value: 'accounting'. Reason: 'For input string: "accounting"'</expected-warn>
- <expected-warn>Failed to evaluate computed field. File: 'parquet-data/external-filter/department/engineering/0.parquet'. Computed Field Name: 'name'. Computed Field Type: 'bigint'. Computed Field Value: 'engineering'. Reason: 'For input string: "engineering"'</expected-warn>
- <expected-warn>Failed to evaluate computed field. File: 'parquet-data/external-filter/department/hr/0.parquet'. Computed Field Name: 'name'. Computed Field Type: 'bigint'. Computed Field Value: 'hr'. Reason: 'For input string: "hr"'</expected-warn>
+ <expected-warn>Failed to evaluate computed field. File: 'parquet-data/external-filter/department/accounting/0.parquet'. Computed Field Name: 'name'. Computed Field Type: 'bigint'. Computed Field Value: 'accounting'. Reason: 'java.lang.NumberFormatException: For input string: "accounting"'</expected-warn>
+ <expected-warn>Failed to evaluate computed field. File: 'parquet-data/external-filter/department/engineering/0.parquet'. Computed Field Name: 'name'. Computed Field Type: 'bigint'. Computed Field Value: 'engineering'. Reason: 'java.lang.NumberFormatException: For input string: "engineering"'</expected-warn>
+ <expected-warn>Failed to evaluate computed field. File: 'parquet-data/external-filter/department/hr/0.parquet'. Computed Field Name: 'name'. Computed Field Type: 'bigint'. Computed Field Value: 'hr'. Reason: 'java.lang.NumberFormatException: For input string: "hr"'</expected-warn>
<expected-warn>The provided external dataset configuration returned no files from the external source</expected-warn>
</compilation-unit>
</test-case>
@@ -296,6 +308,12 @@
<output-dir compare="Text">embed-multiple-values</output-dir>
</compilation-unit>
</test-case>
+ <test-case FilePath="external-dataset/common/dynamic-prefixes/parquet">
+ <compilation-unit name="computed-field-between-static-parts">
+ <placeholder name="adapter" value="S3" />
+ <output-dir compare="Text">computed-field-between-static-parts</output-dir>
+ </compilation-unit>
+ </test-case>
<test-case FilePath="external-dataset/common/dynamic-prefixes/csv">
<compilation-unit name="embed-one-value">
<placeholder name="adapter" value="S3" />
@@ -308,6 +326,12 @@
<output-dir compare="Text">embed-multiple-values</output-dir>
</compilation-unit>
</test-case>
+ <test-case FilePath="external-dataset/common/dynamic-prefixes/parquet">
+ <compilation-unit name="computed-field-segment-pattern-mismatch">
+ <placeholder name="adapter" value="S3" />
+ <output-dir compare="Text">computed-field-segment-pattern-mismatch</output-dir>
+ </compilation-unit>
+ </test-case>
<!-- Dynamic prefixes tests end -->
<test-case FilePath="external-dataset">
<compilation-unit name="common/empty-string-definition">
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/RuntimeDataException.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/RuntimeDataException.java
index 1a0a61f..95bcda7 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/RuntimeDataException.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/RuntimeDataException.java
@@ -31,6 +31,10 @@
return new RuntimeDataException(error, params);
}
+ public static RuntimeDataException create(ErrorCode error, Throwable cause, Serializable... params) {
+ return new RuntimeDataException(error, cause, params);
+ }
+
public RuntimeDataException(ErrorCode errorCode, Throwable cause, SourceLocation sourceLoc,
Serializable... params) {
super(errorCode, cause, sourceLoc, params);
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/aws/AwsS3InputStream.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/aws/AwsS3InputStream.java
index 56feb8a..f2ede19 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/aws/AwsS3InputStream.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/aws/AwsS3InputStream.java
@@ -92,7 +92,7 @@
return false;
} catch (S3Exception ex) {
if (!shouldRetry(ex.awsErrorDetails().errorCode(), retries++)) {
- throw new RuntimeDataException(ErrorCode.EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw new RuntimeDataException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
}
LOGGER.debug(() -> "S3 retryable error: " + LogRedactionUtil.userData(ex.getMessage()));
@@ -103,7 +103,7 @@
Thread.currentThread().interrupt();
}
} catch (SdkException ex) {
- throw new RuntimeDataException(ErrorCode.EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw new RuntimeDataException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
}
}
return true;
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/aws/parquet/AwsS3ParquetReaderFactory.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/aws/parquet/AwsS3ParquetReaderFactory.java
index f335538..abed33a 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/aws/parquet/AwsS3ParquetReaderFactory.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/aws/parquet/AwsS3ParquetReaderFactory.java
@@ -88,11 +88,11 @@
configureAwsS3HdfsJobConf(conf, configuration, numberOfPartitions);
configureHdfsConf(conf, configuration);
} catch (SdkException | SdkBaseException ex) {
- throw new RuntimeDataException(ErrorCode.EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw new RuntimeDataException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
} catch (AlgebricksException ex) {
Throwable root = ExceptionUtils.getRootCause(ex);
if (root instanceof SdkException || root instanceof SdkBaseException) {
- throw new RuntimeDataException(ErrorCode.EXTERNAL_SOURCE_ERROR, getMessageOrToString(root));
+ throw new RuntimeDataException(ErrorCode.EXTERNAL_SOURCE_ERROR, root, getMessageOrToString(root));
}
throw ex;
}
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/azure/blob/AzureBlobInputStream.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/azure/blob/AzureBlobInputStream.java
index 52d16c1..db4fdb0 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/azure/blob/AzureBlobInputStream.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/azure/blob/AzureBlobInputStream.java
@@ -75,10 +75,10 @@
+ "found in container " + container);
return false;
} else {
- throw new RuntimeDataException(ErrorCode.EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw new RuntimeDataException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
}
} catch (Exception ex) {
- throw new RuntimeDataException(ErrorCode.EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw new RuntimeDataException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
}
return true;
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/azure/datalake/AzureDataLakeInputStream.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/azure/datalake/AzureDataLakeInputStream.java
index ba47d57..9b16026 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/azure/datalake/AzureDataLakeInputStream.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/azure/datalake/AzureDataLakeInputStream.java
@@ -75,10 +75,10 @@
+ "found in container " + container);
return false;
} else {
- throw new RuntimeDataException(ErrorCode.EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw new RuntimeDataException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
}
} catch (Exception ex) {
- throw new RuntimeDataException(ErrorCode.EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw new RuntimeDataException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
}
return true;
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/gcs/GCSInputStream.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/gcs/GCSInputStream.java
index ebc9907..89da065 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/gcs/GCSInputStream.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/gcs/GCSInputStream.java
@@ -96,7 +96,7 @@
break;
} catch (BaseServiceException ex) {
if (!ex.isRetryable() || !shouldRetry(++attempt)) {
- throw new RuntimeDataException(ErrorCode.EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw new RuntimeDataException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
}
LOGGER.debug(() -> "Retryable error: " + getMessageOrToString(ex));
@@ -107,7 +107,7 @@
Thread.currentThread().interrupt();
}
} catch (Exception ex) {
- throw new RuntimeDataException(ErrorCode.EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw new RuntimeDataException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
}
}
return true;
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/stream/AbstractMultipleInputStream.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/stream/AbstractMultipleInputStream.java
index 18ef150..dcc8a61 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/stream/AbstractMultipleInputStream.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/stream/AbstractMultipleInputStream.java
@@ -80,7 +80,8 @@
}
return result;
} catch (Exception e) {
- throw RuntimeDataException.create(ErrorCode.EXTERNAL_SOURCE_ERROR, ExceptionUtils.getMessageOrToString(e));
+ throw RuntimeDataException.create(ErrorCode.EXTERNAL_SOURCE_ERROR, e,
+ ExceptionUtils.getMessageOrToString(e));
}
}
}
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/ExternalDataPrefix.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/ExternalDataPrefix.java
index 394295d..299d0e4 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/ExternalDataPrefix.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/ExternalDataPrefix.java
@@ -227,14 +227,17 @@
}
public List<String> getValues(String key) {
- return extractValues(extractPrefixSegments(key));
+ List<String> values = new ArrayList<>();
+ extractValues(extractPrefixSegments(key), values);
+
+ return values;
}
/**
* Evaluates whether the provided key satisfies the conditions of the evaluator or not
* TODO Check if {@link IExternalFilterEvaluator#isComputedFieldUsed(int)} is useful once we have regex extractor
*
- * @param key ke
+ * @param key key
* @param evaluator evaluator
* @return true if key satisfies the evaluator conditions, false otherwise
*/
@@ -243,24 +246,30 @@
// TODO provide the List to avoid array creation
List<String> keySegments = extractPrefixSegments(key);
- // no computed fields filter, accept path
- if (!hasComputedFields() || evaluator.isEmpty()) {
- return true;
- }
-
// segments of object key have to be larger than segments of the prefix
if (keySegments.size() <= segments.size()) {
return false;
}
- // no computed fields used in WHERE clause, accept object
- if (evaluator.isEmpty()) {
+ // no computed fields filter, accept path
+ if (!hasComputedFields()) {
return true;
}
+ // before doing any computed field evaluation, make sure the static part matches
+ for (int i = 0; i < segments.size(); i++) {
+ if (!computedFieldSegmentIndexes.contains(i) && !keySegments.get(i).equals(segments.get(i))) {
+ return false;
+ }
+ }
+
// extract values for all compute fields and set them in the evaluator
// TODO provide the List to avoid array creation
- List<String> values = extractValues(keySegments);
+ List<String> values = new ArrayList<>();
+ boolean success = extractValues(keySegments, values);
+ if (!success) {
+ return false;
+ }
String computedFieldName = null;
IAType computedFieldType = null;
@@ -279,7 +288,7 @@
if (warningCollector.shouldWarn()) {
warningCollector.warn(Warning.of(null, ErrorCode.FAILED_TO_EVALUATE_COMPUTED_FIELD,
LogRedactionUtil.userData(key), computedFieldName, computedFieldType,
- LogRedactionUtil.userData(computedFieldValue), LogRedactionUtil.userData(ex.getMessage())));
+ LogRedactionUtil.userData(computedFieldValue), LogRedactionUtil.userData(ex.toString())));
}
return false;
}
@@ -300,11 +309,11 @@
* extracts the computed fields values from the object's key
*
* @param keySegments object's key segments
- * @return list of computed field values
+ * @param values list to put the values in
+ *
+ * @return true if values of computed field are extracted successfully, false otherwise
*/
- private List<String> extractValues(List<String> keySegments) {
- List<String> values = new ArrayList<>();
-
+ private boolean extractValues(List<String> keySegments, List<String> values) {
for (Map.Entry<Integer, PrefixSegment> entry : indexToComputedFieldsMap.entrySet()) {
int index = entry.getKey();
String expression = entry.getValue().getExpression();
@@ -312,14 +321,17 @@
String keySegment = keySegments.get(index);
Matcher matcher = Pattern.compile(expression).matcher(keySegment);
- if (matcher.find()) {
- for (int i = 1; i <= matcher.groupCount(); i++) {
- values.add(matcher.group(i));
- }
+ // key segment not matching expected computed field segment pattern
+ if (!matcher.find()) {
+ return false;
+ }
+
+ for (int i = 1; i <= matcher.groupCount(); i++) {
+ values.add(matcher.group(i));
}
}
- return values;
+ return true;
}
private IAType getUpdatedType(IAType type) {
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/aws/s3/S3Utils.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/aws/s3/S3Utils.java
index 966b536..650f823 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/aws/s3/S3Utils.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/aws/s3/S3Utils.java
@@ -186,10 +186,10 @@
try {
builder.endpointOverride(uri);
} catch (NullPointerException ex) {
- throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
}
} catch (URISyntaxException ex) {
- throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR,
+ throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex,
String.format("Invalid service endpoint %s", serviceEndpoint));
}
}
@@ -308,10 +308,10 @@
throw ex;
}
} catch (SdkException ex2) {
- throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex2, getMessageOrToString(ex));
}
} catch (SdkException ex) {
- throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
} finally {
if (s3Client != null) {
CleanupUtils.close(s3Client, null);
@@ -385,10 +385,10 @@
throw ex;
}
} catch (SdkException ex2) {
- throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex2, getMessageOrToString(ex));
}
} catch (SdkException ex) {
- throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
} finally {
if (s3Client != null) {
CleanupUtils.close(s3Client, null);
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/azure/blob_storage/AzureUtils.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/azure/blob_storage/AzureUtils.java
index 4062fc9..1250267 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/azure/blob_storage/AzureUtils.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/azure/blob_storage/AzureUtils.java
@@ -222,7 +222,7 @@
pemCertificate.invoke(certificate, certificateContent, clientCertificatePassword);
}
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ex) {
- throw new CompilationException(EXTERNAL_SOURCE_ERROR, ex.getMessage());
+ throw new CompilationException(EXTERNAL_SOURCE_ERROR, ex, ex.getMessage());
}
builder.credential(certificate.build());
}
@@ -242,7 +242,7 @@
try {
return builder.buildClient();
} catch (Exception ex) {
- throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
}
}
@@ -375,7 +375,7 @@
pemCertificate.invoke(certificate, certificateContent, clientCertificatePassword);
}
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ex) {
- throw new CompilationException(EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw new CompilationException(EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
}
builder.credential(certificate.build());
}
@@ -395,7 +395,7 @@
try {
return builder.buildClient();
} catch (Exception ex) {
- throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
}
}
@@ -434,7 +434,7 @@
warningCollector.warn(warning);
}
} catch (Exception ex) {
- throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
}
return filesOnly;
@@ -488,7 +488,7 @@
warningCollector.warn(warning);
}
} catch (Exception ex) {
- throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
}
return filesOnly;
@@ -554,7 +554,7 @@
} catch (CompilationException ex) {
throw ex;
} catch (Exception ex) {
- throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
}
}
@@ -593,7 +593,7 @@
} catch (CompilationException ex) {
throw ex;
} catch (Exception ex) {
- throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
}
}
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/google/gcs/GCSUtils.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/google/gcs/GCSUtils.java
index e5ff733..bbd36de 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/google/gcs/GCSUtils.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/google/gcs/GCSUtils.java
@@ -103,13 +103,13 @@
try {
builder.setCredentials(GoogleCredentials.getApplicationDefault());
} catch (IOException ex) {
- throw CompilationException.create(EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw CompilationException.create(EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
}
} else if (jsonCredentials != null) {
try (InputStream credentialsStream = new ByteArrayInputStream(jsonCredentials.getBytes())) {
builder.setCredentials(GoogleCredentials.fromStream(credentialsStream));
} catch (IOException ex) {
- throw new CompilationException(EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw new CompilationException(EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
}
} else {
builder.setCredentials(NoCredentials.getInstance());
@@ -152,7 +152,7 @@
} catch (CompilationException ex) {
throw ex;
} catch (Exception ex) {
- throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
}
}
@@ -169,7 +169,7 @@
try {
items = gcs.list(container, options);
} catch (BaseServiceException ex) {
- throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
}
// Collect the paths to files only