>From Ali Alsuliman <[email protected]>: Ali Alsuliman has submitted this change. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/18017 )
Change subject: [NO ISSUE][OTH] Ensure supported chars in database object names ...................................................................... [NO ISSUE][OTH] Ensure supported chars in database object names - user model changes: no - storage format changes: no - interface changes: no Details: In cloud mode, the only chars allowed for database object names are letters, digits, '-' and '_'. This is currently ensured for DATABASE and DATAVERSE names. This patch is to ensure the same thing for all other database objects. Change-Id: Ib93d6c5b2364c96c049f07af511a44bc1adf4993 Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/18017 Integration-Tests: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Reviewed-by: Wail Alkowaileet <[email protected]> --- A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/disallowed-chars/test.000.ddl.sqlpp M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/special-chars/test.000.ddl.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/disallowed-chars/test.999.ddl.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/disallowed-chars/test.004.ddl.sqlpp M asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/special-chars/test.001.update.sqlpp M asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/disallowed-chars/test.003.ddl.sqlpp M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/special-chars/test.002.query.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/disallowed-chars/test.002.ddl.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/disallowed-chars/test.001.ddl.sqlpp M asterixdb/asterix-test-framework/src/main/resources/Catalog.xsd M asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/MetadataProvider.java M asterixdb/asterix-app/src/test/resources/runtimets/testsuite_cloud_storage.xml 14 files changed, 218 insertions(+), 60 deletions(-) Approvals: Wail Alkowaileet: Looks good to me, approved Jenkins: Verified; Verified Objections: Anon. E. Moose #1000171: Violations found diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java index 8641bd6..9d62c52 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java @@ -2224,24 +2224,27 @@ String replacerId = executorId == null ? DEF_REPLACER : executorId; List<CompilationUnit.ExpectedWarn> expectedWarns = cUnit.getExpectedWarn(); - expectedWarns.stream().filter(w -> !w.getReplacers().isEmpty()).forEach(w -> w.setValue( - MessageFormat.format(w.getValue(), (Object[]) getReplacements(cUnit, replacerId, w.getReplacers())))); + expectedWarns.stream().filter(w -> w.getReplacers() != null && !w.getReplacers().isEmpty()) + .forEach(w -> w.setValue(MessageFormat.format(w.getValue(), + (Object[]) getReplacements(cUnit, replacerId, w.getReplacers())))); List<CompilationUnit.ExpectedError> expectedErrors = cUnit.getExpectedError(); - expectedErrors.stream().filter(e -> !e.getReplacers().isEmpty()).forEach(e -> e.setValue( - MessageFormat.format(e.getValue(), (Object[]) getReplacements(cUnit, replacerId, e.getReplacers())))); + expectedErrors.stream().filter(e -> e.getReplacers() != null && !e.getReplacers().isEmpty()) + .forEach(e -> e.setValue(MessageFormat.format(e.getValue(), + (Object[]) getReplacements(cUnit, replacerId, e.getReplacers())))); } - private static String[] getReplacements(CompilationUnit cUnit, String replacerId, List<String> replacers) { - Optional<String> replacements = replacers.stream().filter(s -> s.startsWith(replacerId)).findFirst(); + private static String[] getReplacements(CompilationUnit cUnit, String replacerId, String replacersStr) { + String[] replacers = replacersStr.split("\\|"); + Optional<String> replacements = Arrays.stream(replacers).filter(s -> s.startsWith(replacerId)).findFirst(); if (replacements.isPresent()) { return replacements.get().substring(replacerId.length() + 1).split(","); } LOGGER.error("Test '{}', could not find message replacements for '{}' in replacements {}", cUnit.getName(), - replacerId, replacers); + replacerId, replacersStr); throw new RuntimeException( String.format("Test '%s', could not find message replacements for '%s' in replacements %s", - cUnit.getName(), replacerId, replacers)); + cUnit.getName(), replacerId, replacersStr)); } private String applySubstitution(String statement, List<Parameter> parameters) throws Exception { diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/disallowed-chars/test.000.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/disallowed-chars/test.000.ddl.sqlpp new file mode 100644 index 0000000..92836f1 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/disallowed-chars/test.000.ddl.sqlpp @@ -0,0 +1,21 @@ +/* + * 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 DATABASE db1 IF EXISTS; +CREATE DATABASE db1; \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/disallowed-chars/test.001.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/disallowed-chars/test.001.ddl.sqlpp new file mode 100644 index 0000000..4281c6c --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/disallowed-chars/test.001.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. + */ +// should fail. only chars, letters, '-' and '_' are allowed +CREATE DATAVERSE db1.`dv.with.dot`; \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/disallowed-chars/test.002.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/disallowed-chars/test.002.ddl.sqlpp new file mode 100644 index 0000000..5289b3d --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/disallowed-chars/test.002.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. + */ + +CREATE DATAVERSE db1.dv1; \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/disallowed-chars/test.003.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/disallowed-chars/test.003.ddl.sqlpp new file mode 100644 index 0000000..fd83138 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/disallowed-chars/test.003.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. + */ +// should fail. only chars, letters, '-' and '_' are allowed +CREATE COLLECTION db1.dv1.`col.with.dot` PRIMARY KEY (id:int); \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/disallowed-chars/test.004.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/disallowed-chars/test.004.ddl.sqlpp new file mode 100644 index 0000000..4325a1b --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/disallowed-chars/test.004.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. + */ +// should fail. only chars, letters, '-' and '_' are allowed +CREATE DATABASE `db.with.dot`; \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/disallowed-chars/test.999.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/disallowed-chars/test.999.ddl.sqlpp new file mode 100644 index 0000000..35487d3 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/disallowed-chars/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 DATABASE db1; \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/special-chars/test.000.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/special-chars/test.000.ddl.sqlpp index d3915a8..8745748 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/special-chars/test.000.ddl.sqlpp +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/special-chars/test.000.ddl.sqlpp @@ -23,4 +23,4 @@ CREATE DATAVERSE `part_1-`.`p_r-t2`; USE `part_1-`.`p_r-t2`; -CREATE COLLECTION `some@dataset` PRIMARY KEY (id: int); \ No newline at end of file +CREATE COLLECTION `some_data-set` PRIMARY KEY (id: int); \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/special-chars/test.001.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/special-chars/test.001.update.sqlpp index 15d9bbd..a22e37f 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/special-chars/test.001.update.sqlpp +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/special-chars/test.001.update.sqlpp @@ -19,4 +19,4 @@ USE `part_1-`.`p_r-t2`; -UPSERT INTO `some@dataset` {"id": 1}; \ No newline at end of file +UPSERT INTO `some_data-set` {"id": 1}; \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/special-chars/test.002.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/special-chars/test.002.query.sqlpp index 7019cab..d6a925f 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/special-chars/test.002.query.sqlpp +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cloud_storage/special-chars/test.002.query.sqlpp @@ -20,4 +20,4 @@ USE `part_1-`.`p_r-t2`; SELECT VALUE COUNT(*) -FROM `some@dataset`; \ No newline at end of file +FROM `some_data-set`; \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml b/asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml index 9287df2..d6096a7 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml +++ b/asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml @@ -50,7 +50,7 @@ <test-case FilePath="api" check-warnings="true"> <compilation-unit name="request-dataverse"> <output-dir compare="Text">request-dataverse</output-dir> - <expected-warn replacers="cloud:Default.testUnknown def:testUnknown">ASX1063: Cannot find dataverse with name {0}</expected-warn> + <expected-warn replacers="cloud:Default.testUnknown|def:testUnknown">ASX1063: Cannot find dataverse with name {0}</expected-warn> <source-location>false</source-location> </compilation-unit> </test-case> @@ -4010,7 +4010,7 @@ <test-case FilePath="custord"> <compilation-unit name="join_q_07"> <output-dir compare="Text">join_q_06</output-dir> - <expected-error replacers="cloud:Default.test def:test">Cannot find dataset c in dataverse {0} nor an alias with name c</expected-error> + <expected-error replacers="cloud:Default.test|def:test">Cannot find dataset c in dataverse {0} nor an alias with name c</expected-error> </compilation-unit> </test-case> <test-case FilePath="custord"> @@ -4084,7 +4084,7 @@ <test-case FilePath="dapd"> <compilation-unit name="q2-2-negative"> <output-dir compare="Text">q2</output-dir> - <expected-error replacers="cloud:Default.test def:test">Cannot find dataset e in dataverse {0} nor an alias with name e</expected-error> + <expected-error replacers="cloud:Default.test|def:test">Cannot find dataset e in dataverse {0} nor an alias with name e</expected-error> </compilation-unit> </test-case> <test-case FilePath="dapd"> @@ -4162,7 +4162,7 @@ <test-case FilePath="ddl"> <compilation-unit name="create-dataset-3"> <output-dir compare="Clean-JSON">create-dataset-3</output-dir> - <expected-error replacers="cloud:Default.test def:test">ASX1077: Cannot find dataset non_existent in dataverse {0} nor an alias with name non_existent (in line 23, at column 21)</expected-error> + <expected-error replacers="cloud:Default.test|def:test">ASX1077: Cannot find dataset non_existent in dataverse {0} nor an alias with name non_existent (in line 23, at column 21)</expected-error> </compilation-unit> </test-case> <test-case FilePath="ddl"> @@ -4219,8 +4219,8 @@ <test-case FilePath="ddl/create-index"> <compilation-unit name="create-index-6"> <output-dir compare="Text">none</output-dir> - <expected-error replacers="cloud:Default.test def:test">ASX1050: Cannot find dataset with name LineItemView1 in dataverse {0} (in line 55, at column 1)</expected-error> - <expected-error replacers="cloud:Default.test def:test">ASX1050: Cannot find dataset with name LineItemView2 in dataverse {0} (in line 60, at column 1)</expected-error> + <expected-error replacers="cloud:Default.test|def:test">ASX1050: Cannot find dataset with name LineItemView1 in dataverse {0} (in line 55, at column 1)</expected-error> + <expected-error replacers="cloud:Default.test|def:test">ASX1050: Cannot find dataset with name LineItemView2 in dataverse {0} (in line 60, at column 1)</expected-error> </compilation-unit> </test-case> <test-case FilePath="ddl/create-index"> @@ -4231,7 +4231,7 @@ <test-case FilePath="ddl"> <compilation-unit name="bad-type-ddl"> <output-dir compare="Text">none</output-dir> - <expected-error>ASX1079: Compilation error: Reserved type name $x</expected-error> + <expected-error replacers="cloud:ASX1115: Invalid name for a database object: '$x'|def:ASX1079: Compilation error: Reserved type name $x">{0}</expected-error> <expected-error>ASX0013: Duplicate field name 'c' (in line 29, at column 19)</expected-error> </compilation-unit> </test-case> @@ -4259,13 +4259,13 @@ <compilation-unit name="invalid-dataverse"> <output-dir compare="Text">invalid-dataverse</output-dir> <source-location>false</source-location> - <expected-warn replacers="cloud:Default.fakeDataverse def:fakeDataverse">Cannot find dataverse with name {0} (in line 22, at column 1)</expected-warn> - <expected-error replacers="cloud:Default.fakeDataverse def:fakeDataverse">Cannot find dataverse with name {0} (in line 27, at column 1)</expected-error> - <expected-warn replacers="cloud:Default.fakeDataverse def:fakeDataverse">Cannot find dataverse with name {0} (in line 29, at column 1)</expected-warn> - <expected-error replacers="cloud:Default.fakeDataverse def:fakeDataverse">Cannot find dataverse with name {0} (in line 30, at column 1)</expected-error> - <expected-error replacers="cloud:fakeDataverse def:fakeDataverse">Cannot find datatype with name {0}.myType</expected-error> - <expected-error replacers="cloud:Default.fakeDataverse def:fakeDataverse">Cannot find dataverse with name {0} (in line 30, at column 1)</expected-error> - <expected-error replacers="cloud:Default.fakeDataverse def:fakeDataverse">Cannot find dataverse with name {0} (in line 32, at column 1)</expected-error> + <expected-warn replacers="cloud:Default.fakeDataverse|def:fakeDataverse">Cannot find dataverse with name {0} (in line 22, at column 1)</expected-warn> + <expected-error replacers="cloud:Default.fakeDataverse|def:fakeDataverse">Cannot find dataverse with name {0} (in line 27, at column 1)</expected-error> + <expected-warn replacers="cloud:Default.fakeDataverse|def:fakeDataverse">Cannot find dataverse with name {0} (in line 29, at column 1)</expected-warn> + <expected-error replacers="cloud:Default.fakeDataverse|def:fakeDataverse">Cannot find dataverse with name {0} (in line 30, at column 1)</expected-error> + <expected-error replacers="cloud:fakeDataverse|def:fakeDataverse">Cannot find datatype with name {0}.myType</expected-error> + <expected-error replacers="cloud:Default.fakeDataverse|def:fakeDataverse">Cannot find dataverse with name {0} (in line 30, at column 1)</expected-error> + <expected-error replacers="cloud:Default.fakeDataverse|def:fakeDataverse">Cannot find dataverse with name {0} (in line 32, at column 1)</expected-error> </compilation-unit> </test-case> <test-case FilePath="ddl"> @@ -4364,14 +4364,14 @@ <test-case FilePath="ddl" check-warnings="true"> <compilation-unit name="drop_dataset_invalid_dataverse"> <output-dir compare="Text">drop_dataset_invalid_dataverse</output-dir> - <expected-error replacers="cloud:Default.fakeDataverse def:fakeDataverse">ASX1063: Cannot find dataverse with name {0} (in line 22, at column 1)</expected-error> - <expected-error replacers="cloud:Default.fakeDataverse def:fakeDataverse">ASX1063: Cannot find dataverse with name {0} (in line 22, at column 1)</expected-error> - <expected-error replacers="cloud:Default.fakeDataverse def:fakeDataverse">ASX1063: Cannot find dataverse with name {0} (in line 22, at column 1)</expected-error> - <expected-error replacers="cloud:Default.fakeDataverse def:fakeDataverse">ASX1063: Cannot find dataverse with name {0} (in line 22, at column 1)</expected-error> - <expected-error replacers="cloud:Default.realDataverse def:realDataverse">ASX1050: Cannot find dataset with name fakeDataset1 in dataverse {0} (in line 22, at column 1)</expected-error> - <expected-warn replacers="cloud:Default.fakeDataverse def:fakeDataverse">ASX1063: Cannot find dataverse with name {0} (in line 22, at column 1)</expected-warn> - <expected-warn replacers="cloud:Default.fakeDataverse def:fakeDataverse">ASX1063: Cannot find dataverse with name {0} (in line 22, at column 1)</expected-warn> - <expected-warn replacers="cloud:Default.fakeDataverse def:fakeDataverse">ASX1063: Cannot find dataverse with name {0} (in line 22, at column 1)</expected-warn> + <expected-error replacers="cloud:Default.fakeDataverse|def:fakeDataverse">ASX1063: Cannot find dataverse with name {0} (in line 22, at column 1)</expected-error> + <expected-error replacers="cloud:Default.fakeDataverse|def:fakeDataverse">ASX1063: Cannot find dataverse with name {0} (in line 22, at column 1)</expected-error> + <expected-error replacers="cloud:Default.fakeDataverse|def:fakeDataverse">ASX1063: Cannot find dataverse with name {0} (in line 22, at column 1)</expected-error> + <expected-error replacers="cloud:Default.fakeDataverse|def:fakeDataverse">ASX1063: Cannot find dataverse with name {0} (in line 22, at column 1)</expected-error> + <expected-error replacers="cloud:Default.realDataverse|def:realDataverse">ASX1050: Cannot find dataset with name fakeDataset1 in dataverse {0} (in line 22, at column 1)</expected-error> + <expected-warn replacers="cloud:Default.fakeDataverse|def:fakeDataverse">ASX1063: Cannot find dataverse with name {0} (in line 22, at column 1)</expected-warn> + <expected-warn replacers="cloud:Default.fakeDataverse|def:fakeDataverse">ASX1063: Cannot find dataverse with name {0} (in line 22, at column 1)</expected-warn> + <expected-warn replacers="cloud:Default.fakeDataverse|def:fakeDataverse">ASX1063: Cannot find dataverse with name {0} (in line 22, at column 1)</expected-warn> </compilation-unit> </test-case> <test-case FilePath="ddl"> @@ -5955,13 +5955,13 @@ <test-case FilePath="group-by"> <compilation-unit name="core-01-error"> <output-dir compare="Text">none</output-dir> - <expected-error replacers="cloud:Default.gby def:gby">Cannot find dataset e in dataverse {0} nor an alias with name e</expected-error> + <expected-error replacers="cloud:Default.gby|def:gby">Cannot find dataset e in dataverse {0} nor an alias with name e</expected-error> </compilation-unit> </test-case> <test-case FilePath="group-by"> <compilation-unit name="core-02-error"> <output-dir compare="Text">none</output-dir> - <expected-error replacers="cloud:Default.gby def:gby">Cannot find dataset f in dataverse {0} nor an alias with name f</expected-error> + <expected-error replacers="cloud:Default.gby|def:gby">Cannot find dataset f in dataverse {0} nor an alias with name f</expected-error> </compilation-unit> </test-case> <test-case FilePath="group-by"> @@ -6720,7 +6720,7 @@ <test-case FilePath="join"> <compilation-unit name="cross-join-02-negative"> <output-dir compare="Text">none</output-dir> - <expected-error replacers="cloud:Default.Default def:Default">ASX1077: Cannot find dataset x in dataverse {0} nor an alias with name x (in line 26, at column 39)</expected-error> + <expected-error replacers="cloud:Default.Default|def:Default">ASX1077: Cannot find dataset x in dataverse {0} nor an alias with name x (in line 26, at column 39)</expected-error> </compilation-unit> </test-case> <test-case FilePath="join"> @@ -7105,8 +7105,8 @@ <compilation-unit name="partition-by-nonexistent-field"> <output-dir compare="Text">partition-by-nonexistent-field</output-dir> <expected-error>Field 'id' is not found</expected-error> - <expected-error replacers="cloud:Default.test def:test">Cannot find dataset with name testds in dataverse {0}</expected-error> - <expected-error replacers="cloud:Default.test def:test">Cannot find dataset testds in dataverse {0} nor an alias with name testds</expected-error> + <expected-error replacers="cloud:Default.test|def:test">Cannot find dataset with name testds in dataverse {0}</expected-error> + <expected-error replacers="cloud:Default.test|def:test">Cannot find dataset testds in dataverse {0} nor an alias with name testds</expected-error> </compilation-unit> </test-case> <test-case FilePath="misc"> @@ -7300,8 +7300,8 @@ <compilation-unit name="dump_index"> <output-dir compare="Text">dump_index</output-dir> <expected-error>Cannot find index with name noindex</expected-error> - <expected-error replacers="cloud:Default.test def:test">Cannot find dataset with name nodataset in dataverse {0}</expected-error> - <expected-error replacers="cloud:Default.nodataverse def:nodataverse">Cannot find dataset with name ds in dataverse {0}</expected-error> + <expected-error replacers="cloud:Default.test|def:test">Cannot find dataset with name nodataset in dataverse {0}</expected-error> + <expected-error replacers="cloud:Default.nodataverse|def:nodataverse">Cannot find dataset with name ds in dataverse {0}</expected-error> <expected-error>Unsupported type: dump-index cannot process input type null</expected-error> <expected-error>Unsupported type: dump-index cannot process input type null</expected-error> <expected-error>Unsupported type: dump-index cannot process input type null</expected-error> @@ -11656,7 +11656,7 @@ <test-case FilePath="synonym"> <compilation-unit name="synonym-02-negative"> <output-dir compare="Text">none</output-dir> - <expected-error replacers="cloud:Default.UNKNOWN_DATAVERSE def:UNKNOWN_DATAVERSE">ASX1063: Cannot find dataverse with name {0}</expected-error> + <expected-error replacers="cloud:Default.UNKNOWN_DATAVERSE|def:UNKNOWN_DATAVERSE">ASX1063: Cannot find dataverse with name {0}</expected-error> </compilation-unit> </test-case> <test-case FilePath="synonym"> @@ -13152,26 +13152,26 @@ <test-case FilePath="user-defined-functions"> <compilation-unit name="bad-function-ddl-1"> <output-dir compare="Text">bad-function-ddl-1</output-dir> - <expected-error replacers="cloud:Default.experiments def:experiments">Cannot find dataset TweetMessages in dataverse {0} nor an alias with name TweetMessages</expected-error> - <expected-error replacers="cloud:Default.experiments2 def:experiments2">Cannot find dataset TweetMessages2 in dataverse {0} nor an alias with name TweetMessages2</expected-error> + <expected-error replacers="cloud:Default.experiments|def:experiments">Cannot find dataset TweetMessages in dataverse {0} nor an alias with name TweetMessages</expected-error> + <expected-error replacers="cloud:Default.experiments2|def:experiments2">Cannot find dataset TweetMessages2 in dataverse {0} nor an alias with name TweetMessages2</expected-error> </compilation-unit> </test-case> <test-case FilePath="user-defined-functions"> <compilation-unit name="bad-function-ddl-2"> <output-dir compare="Text">bad-function-ddl-2</output-dir> - <expected-error replacers="cloud:Default.experiments2 def:experiments2">Cannot find dataset TweetMessages in dataverse {0} nor an alias with name TweetMessages</expected-error> + <expected-error replacers="cloud:Default.experiments2|def:experiments2">Cannot find dataset TweetMessages in dataverse {0} nor an alias with name TweetMessages</expected-error> </compilation-unit> </test-case> <test-case FilePath="user-defined-functions"> <compilation-unit name="bad-function-ddl-3"> <output-dir compare="Text">bad-function-ddl-3</output-dir> - <expected-error replacers="cloud:Default.experiments def:experiments">Cannot find dataset TweetMessages in dataverse {0} nor an alias with name TweetMessages</expected-error> + <expected-error replacers="cloud:Default.experiments|def:experiments">Cannot find dataset TweetMessages in dataverse {0} nor an alias with name TweetMessages</expected-error> </compilation-unit> </test-case> <test-case FilePath="user-defined-functions"> <compilation-unit name="bad-function-ddl-4"> <output-dir compare="Text">bad-function-ddl-4</output-dir> - <expected-error replacers="cloud:Default.experients def:experients">Cannot find dataset TweetMessages in dataverse {0} nor an alias with name TweetMessages</expected-error> + <expected-error replacers="cloud:Default.experients|def:experients">Cannot find dataset TweetMessages in dataverse {0} nor an alias with name TweetMessages</expected-error> </compilation-unit> </test-case> <test-case FilePath="user-defined-functions"> @@ -13190,13 +13190,13 @@ <test-case FilePath="user-defined-functions"> <compilation-unit name="bad-function-ddl-7"> <output-dir compare="Text">bad-function-ddl-7</output-dir> - <expected-error replacers="cloud:Default.experiments def:experiments">Cannot find dataset TweetMessaes in dataverse {0} nor an alias with name TweetMessaes</expected-error> + <expected-error replacers="cloud:Default.experiments|def:experiments">Cannot find dataset TweetMessaes in dataverse {0} nor an alias with name TweetMessaes</expected-error> </compilation-unit> </test-case> <test-case FilePath="user-defined-functions"> <compilation-unit name="bad-function-ddl-8"> <output-dir compare="Text">bad-function-ddl-8</output-dir> - <expected-error replacers="cloud:Default.experiments def:experiments">Cannot find dataset TweetMessaes in dataverse {0} nor an alias with name TweetMessaes</expected-error> + <expected-error replacers="cloud:Default.experiments|def:experiments">Cannot find dataset TweetMessaes in dataverse {0} nor an alias with name TweetMessaes</expected-error> </compilation-unit> </test-case> <test-case FilePath="user-defined-functions"> @@ -13308,7 +13308,7 @@ <test-case FilePath="user-defined-functions"> <compilation-unit name="query-ASTERIXDB-1652"> <output-dir compare="Text">query-ASTERIXDB-1652-2</output-dir> - <expected-error replacers="cloud:Default.test def:test">ASX1063: Cannot find dataverse with name {0}</expected-error> + <expected-error replacers="cloud:Default.test|def:test">ASX1063: Cannot find dataverse with name {0}</expected-error> </compilation-unit> </test-case> <test-case FilePath="user-defined-functions"> @@ -13589,7 +13589,7 @@ <test-case FilePath="view"> <compilation-unit name="create-view-2-negative"> <output-dir compare="Text">none</output-dir> - <expected-error replacers="cloud:Default.test def:test">ASX1063: Cannot find dataverse with name {0} (in line 24, at column 1)</expected-error> + <expected-error replacers="cloud:Default.test|def:test">ASX1063: Cannot find dataverse with name {0} (in line 24, at column 1)</expected-error> <expected-error><![CDATA[ASX1001: Syntax error: In line 25 >>create view test.v1 as select * from range(1,2) r order by;<< Encountered ";" at column 59]]></expected-error> <expected-error>ASX1081: Cannot find function with signature test.undefined_range(2) (in line 25, at column 38)</expected-error> <expected-error>ASX1160: A view with this name test.v1 already exists (in line 26, at column 1)</expected-error> @@ -13669,7 +13669,7 @@ <expected-error><![CDATA[ASX1166: Invalid foreign key definition: foreign key does not match primary key of view test1.employee_v1 (in line 34, at column 1)]]></expected-error> <expected-error><![CDATA[ASX1166: Invalid foreign key definition: foreign key does not match primary key of view test1.employee_v2 (in line 34, at column 1)]]></expected-error> <expected-error><![CDATA[ASX1164: Invalid foreign key definition (in line 34, at column 1)]]></expected-error> - <expected-error replacers="cloud:Default.test3 def:test3"><![CDATA[ASX1063: Cannot find dataverse with name {0} (in line 42, at column 1)]]></expected-error> + <expected-error replacers="cloud:Default.test3|def:test3"><![CDATA[ASX1063: Cannot find dataverse with name {0} (in line 42, at column 1)]]></expected-error> <expected-error><![CDATA[ASX1159: Cannot find view with name test1.employee_v3 (in line 42, at column 1)]]></expected-error> <expected-error><![CDATA[ASX1159: Cannot find view with name test1.employee (in line 43, at column 1)]]></expected-error> <expected-error><![CDATA[ASX1164: Invalid foreign key definition (in line 43, at column 1)]]></expected-error> @@ -13709,9 +13709,9 @@ <test-case FilePath="view"> <compilation-unit name="drop-view-2-negative"> <output-dir compare="Text">drop-view-2-negative</output-dir> - <expected-error replacers="cloud:Default.test def:test">ASX1063: Cannot find dataverse with name {0} (in line 24, at column 1)</expected-error> + <expected-error replacers="cloud:Default.test|def:test">ASX1063: Cannot find dataverse with name {0} (in line 24, at column 1)</expected-error> <expected-error>ASX1159: Cannot find view with name test.v1 (in line 25, at column 1)</expected-error> - <expected-error replacers="cloud:Default.test def:test">ASX1050: Cannot find dataset with name v1 in dataverse {0} (in line 27, at column 1)</expected-error> + <expected-error replacers="cloud:Default.test|def:test">ASX1050: Cannot find dataset with name v1 in dataverse {0} (in line 27, at column 1)</expected-error> <expected-error>ASX1159: Cannot find view with name test.ds1 (in line 30, at column 1)</expected-error> <expected-error>ASX1148: Cannot drop dataset test2.ds2 being used by view test1.v1</expected-error> <expected-error>ASX1148: Cannot drop function test2.f2() being used by view test1.v1</expected-error> @@ -13730,9 +13730,9 @@ <test-case FilePath="view"> <compilation-unit name="view-2-negative"> <output-dir compare="Text">none</output-dir> - <expected-error replacers="cloud:Default.test1 def:test1">ASX1050: Cannot find dataset with name v1 in dataverse {0} (in line 24, at column 17)</expected-error> - <expected-error replacers="cloud:Default.test1 def:test1">ASX1050: Cannot find dataset with name v2 in dataverse {0} (in line 24, at column 17)</expected-error> - <expected-error replacers="cloud:Default.test1 def:test1">ASX1050: Cannot find dataset with name v3 in dataverse {0} (in line 24, at column 1)</expected-error> + <expected-error replacers="cloud:Default.test1|def:test1">ASX1050: Cannot find dataset with name v1 in dataverse {0} (in line 24, at column 17)</expected-error> + <expected-error replacers="cloud:Default.test1|def:test1">ASX1050: Cannot find dataset with name v2 in dataverse {0} (in line 24, at column 17)</expected-error> + <expected-error replacers="cloud:Default.test1|def:test1">ASX1050: Cannot find dataset with name v3 in dataverse {0} (in line 24, at column 1)</expected-error> </compilation-unit> </test-case> <test-case FilePath="view"> @@ -13821,7 +13821,7 @@ <test-case FilePath="load"> <compilation-unit name="issue650_query"> <output-dir compare="Text">none</output-dir> - <expected-error replacers="cloud:Default.fuzzyjoin def:fuzzyjoin">Cannot find dataset with name Users in dataverse {0}</expected-error> + <expected-error replacers="cloud:Default.fuzzyjoin|def:fuzzyjoin">Cannot find dataset with name Users in dataverse {0}</expected-error> </compilation-unit> </test-case> <test-case FilePath="load"> @@ -15105,7 +15105,7 @@ <test-case FilePath="union"> <compilation-unit name="union_negative"> <output-dir compare="Text">union</output-dir> - <expected-error replacers="cloud:Default.TinySocial def:TinySocial">Cannot find dataset t in dataverse {0} nor an alias with name t</expected-error> + <expected-error replacers="cloud:Default.TinySocial|def:TinySocial">Cannot find dataset t in dataverse {0} nor an alias with name t</expected-error> </compilation-unit> </test-case> <test-case FilePath="union"> diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_cloud_storage.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_cloud_storage.xml index a43d4f1a..6359d8a 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_cloud_storage.xml +++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_cloud_storage.xml @@ -32,6 +32,14 @@ <output-dir compare="Text">special-chars</output-dir> </compilation-unit> </test-case> + <test-case FilePath="cloud_storage"> + <compilation-unit name="disallowed-chars"> + <output-dir compare="Text">disallowed-chars</output-dir> + <expected-error>ASX1115: Invalid name for a database object: 'dv.with.dot'</expected-error> + <expected-error>ASX1115: Invalid name for a database object: 'col.with.dot'</expected-error> + <expected-error>ASX1115: Invalid name for a database object: 'db.with.dot'</expected-error> + </compilation-unit> + </test-case> </test-group> &sqlpp_queries; </test-suite> diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/MetadataProvider.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/MetadataProvider.java index 0aa5f46..68a49fa 100644 --- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/MetadataProvider.java +++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/MetadataProvider.java @@ -1928,6 +1928,9 @@ validateNamespaceName(namespace, sourceLoc); } validateDatabaseObjectNameImpl(objectName, sourceLoc); + if (namespaceResolver.isUsingDatabase()) { + validateChars(objectName, sourceLoc); + } } private void validateDatabaseObjectNameImpl(String name, SourceLocation sourceLoc) throws AlgebricksException { diff --git a/asterixdb/asterix-test-framework/src/main/resources/Catalog.xsd b/asterixdb/asterix-test-framework/src/main/resources/Catalog.xsd index b3d27f4..3d2de83 100644 --- a/asterixdb/asterix-test-framework/src/main/resources/Catalog.xsd +++ b/asterixdb/asterix-test-framework/src/main/resources/Catalog.xsd @@ -175,7 +175,7 @@ <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> - <xs:attribute name="replacers" type="test:str-list"/> + <xs:attribute name="replacers" type="xs:string"/> </xs:extension> </xs:simpleContent> </xs:complexType> @@ -192,7 +192,7 @@ <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> - <xs:attribute name="replacers" type="test:str-list"/> + <xs:attribute name="replacers" type="xs:string"/> </xs:extension> </xs:simpleContent> </xs:complexType> -- To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/18017 To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Change-Id: Ib93d6c5b2364c96c049f07af511a44bc1adf4993 Gerrit-Change-Number: 18017 Gerrit-PatchSet: 5 Gerrit-Owner: Ali Alsuliman <[email protected]> Gerrit-Reviewer: Ali Alsuliman <[email protected]> Gerrit-Reviewer: Anon. E. Moose #1000171 Gerrit-Reviewer: Jenkins <[email protected]> Gerrit-Reviewer: Wail Alkowaileet <[email protected]> Gerrit-MessageType: merged
