This is an automated email from the ASF dual-hosted git repository. htowaileb 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 e6cdca50b3 [ASTERIXDB-3267][EXT]: Ensure static part is also checked when evaluating for filter fields e6cdca50b3 is described below commit e6cdca50b320e602859c624f573e8b1ae77d7922 Author: Hussain Towaileb <hussain.towai...@couchbase.com> AuthorDate: Mon Sep 25 07:41:48 2023 +0300 [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 <jenk...@fulliautomatix.ics.uci.edu> Tested-by: Hussain Towaileb <hussai...@gmail.com> Reviewed-by: Murtadha Hubail <mhub...@apache.org> --- .../department/accounting/professors/data.json | 1 + .../department/accounting/students/data.json | 1 + .../department/engineering/professors/data.json | 1 + .../department/engineering/students/data.json | 1 + .../department/hr/professors/data.json | 1 + .../department/hr/students/data.json | 1 + .../department/accounting/courses/101/data.json | 1 + .../department/accounting/professors/data.json | 1 + .../department/engineering/courses/101/data.json | 1 + .../department/engineering/professors/data.json | 1 + .../department/hr/courses/101/data.json | 1 + .../department/hr/professors/data.json | 1 + .../sales/2019-01-01/data.json | 1 + .../sales/2019/data.json | 1 + .../sales/bar-2019-01-01/data.json | 1 + .../sales/foo-2019-01-01/data.json | 1 + .../test.000.ddl.sqlpp | 41 +++++++++++++++++ .../test.010.query.sqlpp | 26 +++++++++++ .../test.011.query.sqlpp | 26 +++++++++++ .../test.999.ddl.sqlpp | 20 +++++++++ .../test.000.ddl.sqlpp | 41 +++++++++++++++++ .../test.010.query.sqlpp | 26 +++++++++++ .../test.011.query.sqlpp | 26 +++++++++++ .../test.999.ddl.sqlpp | 20 +++++++++ .../test.000.ddl.sqlpp | 41 +++++++++++++++++ .../test.010.query.sqlpp | 26 +++++++++++ .../test.011.query.sqlpp | 26 +++++++++++ .../test.999.ddl.sqlpp | 20 +++++++++ .../test.000.ddl.sqlpp | 41 +++++++++++++++++ .../test.010.query.sqlpp | 26 +++++++++++ .../test.011.query.sqlpp | 26 +++++++++++ .../test.999.ddl.sqlpp | 20 +++++++++ .../result.010.adm | 3 ++ .../result.011.adm | 3 ++ .../result.010.adm | 1 + .../result.011.adm | 1 + .../result.010.adm | 3 ++ .../result.011.adm | 3 ++ .../result.010.adm | 1 + .../result.011.adm | 1 + ...stsuite_external_dataset_azure_blob_storage.xml | 24 ++++++++-- .../runtimets/testsuite_external_dataset_s3.xml | 36 ++++++++++++--- .../common/exceptions/RuntimeDataException.java | 4 ++ .../input/record/reader/aws/AwsS3InputStream.java | 4 +- .../aws/parquet/AwsS3ParquetReaderFactory.java | 4 +- .../reader/azure/blob/AzureBlobInputStream.java | 4 +- .../azure/datalake/AzureDataLakeInputStream.java | 4 +- .../input/record/reader/gcs/GCSInputStream.java | 4 +- .../input/stream/AbstractMultipleInputStream.java | 3 +- .../asterix/external/util/ExternalDataPrefix.java | 52 +++++++++++++--------- .../asterix/external/util/aws/s3/S3Utils.java | 12 ++--- .../util/azure/blob_storage/AzureUtils.java | 16 +++---- .../asterix/external/util/google/gcs/GCSUtils.java | 8 ++-- 53 files changed, 601 insertions(+), 58 deletions(-) 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 0000000000..7052c42c0d --- /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 0000000000..4b16428c8a --- /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 0000000000..c1eff7c049 --- /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 0000000000..35fedb8ca2 --- /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 0000000000..9808a46ea6 --- /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 0000000000..fc5217b488 --- /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 0000000000..4b16428c8a --- /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 0000000000..7052c42c0d --- /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 0000000000..35fedb8ca2 --- /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 0000000000..c1eff7c049 --- /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 0000000000..fc5217b488 --- /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 0000000000..9808a46ea6 --- /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 0000000000..4b16428c8a --- /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 0000000000..7052c42c0d --- /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 0000000000..4b16428c8a --- /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 0000000000..7052c42c0d --- /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 0000000000..c9e189215f --- /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 0000000000..7d478849d0 --- /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 0000000000..4eb2354d60 --- /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 0000000000..36b2bab543 --- /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 0000000000..0d9134ad45 --- /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 0000000000..7d478849d0 --- /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 0000000000..4eb2354d60 --- /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 0000000000..36b2bab543 --- /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 0000000000..88976290cd --- /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 0000000000..7d478849d0 --- /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 0000000000..4eb2354d60 --- /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 0000000000..36b2bab543 --- /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 0000000000..d358ae0ce4 --- /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 0000000000..7d478849d0 --- /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 0000000000..4eb2354d60 --- /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 0000000000..36b2bab543 --- /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 0000000000..f04c3d68e3 --- /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 0000000000..2fe19ff2bc --- /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 0000000000..0b2a7b4bdb --- /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 0000000000..aca6404fe2 --- /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 0000000000..f04c3d68e3 --- /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 0000000000..2fe19ff2bc --- /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 0000000000..0b2a7b4bdb --- /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 0000000000..aca6404fe2 --- /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 024e531ca8..55764eded2 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 c248cc2b2f..623e7bc112 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 1a0a61fdbb..95bcda7dc2 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 @@ public class RuntimeDataException extends HyracksDataException { 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 56feb8a659..f2ede19c8f 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 @@ public class AwsS3InputStream extends AbstractExternalInputStream { 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 @@ public class AwsS3InputStream extends AbstractExternalInputStream { 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 f33553865b..abed33afcb 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 @@ public class AwsS3ParquetReaderFactory extends HDFSDataSourceFactory { 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 52d16c13be..db4fdb0b7d 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 @@ public class AzureBlobInputStream extends AbstractExternalInputStream { + "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 ba47d57282..9b160265f2 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 @@ public class AzureDataLakeInputStream extends AbstractExternalInputStream { + "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 ebc9907f0e..89da06512f 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 @@ public class GCSInputStream extends AbstractExternalInputStream { 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 @@ public class GCSInputStream extends AbstractExternalInputStream { 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 18ef1505a0..dcc8a61569 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 @@ public abstract class AbstractMultipleInputStream extends AsterixInputStream { } 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 394295d875..299d0e4e55 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 final class ExternalDataPrefix implements Serializable { } 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 @@ public final class ExternalDataPrefix implements Serializable { // 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 @@ public final class ExternalDataPrefix implements Serializable { 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 @@ public final class ExternalDataPrefix implements Serializable { * 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 @@ public final class ExternalDataPrefix implements Serializable { 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 966b536af8..650f823c52 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 @@ public class S3Utils { 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 @@ public class S3Utils { 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 @@ public class S3Utils { 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 4062fc9d2e..12502673f6 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 @@ public class AzureUtils { 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 @@ public class AzureUtils { 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 @@ public class AzureUtils { 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 @@ public class AzureUtils { 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 @@ public class AzureUtils { 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 @@ public class AzureUtils { 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 @@ public class AzureUtils { } 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 @@ public class AzureUtils { } 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 e5ff733968..bbd36de7d6 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 @@ public class GCSUtils { 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 @@ public class GCSUtils { } 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 @@ public class GCSUtils { 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