This is an automated email from the ASF dual-hosted git repository.
hucong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 840f0de1ac7 Add DialectFunctionOption to handle wrong skip column bind
in ColumnSegmentBinder (#38350)
840f0de1ac7 is described below
commit 840f0de1ac71ec42b1d1575684bea23d794e9543
Author: Zhengqiang Duan <[email protected]>
AuthorDate: Thu Mar 5 11:27:27 2026 +0800
Add DialectFunctionOption to handle wrong skip column bind in
ColumnSegmentBinder (#38350)
---
RELEASE-NOTES.md | 1 +
.../database/metadata/DialectDatabaseMetaData.java | 11 ++++
.../option/function/DefaultFunctionOption.java | 29 +++++++++++
.../option/function/DialectFunctionOption.java | 43 ++++++++++++++++
.../option/function/DefaultFunctionOptionTest.java | 37 +++++++++++++
.../database/FirebirdDatabaseMetaData.java | 7 +++
.../database/option/FirebirdFunctionOption.java | 43 ++++++++++++++++
.../database/FirebirdDatabaseMetaDataTest.java | 6 +++
.../option/FirebirdFunctionOptionTest.java | 42 +++++++++++++++
.../h2/metadata/database/H2DatabaseMetaData.java | 7 +++
.../metadata/database/option/H2FunctionOption.java | 43 ++++++++++++++++
.../metadata/database/H2DatabaseMetaDataTest.java | 7 +++
.../database/option/H2FunctionOptionTest.java | 46 +++++++++++++++++
.../metadata/database/HiveDatabaseMetaData.java | 7 +++
.../database/option/HiveFunctionOption.java | 43 ++++++++++++++++
.../database/HiveDatabaseMetaDataTest.java | 6 +++
.../database/option/HiveFunctionOptionTest.java | 41 +++++++++++++++
.../metadata/database/MySQLDatabaseMetaData.java | 7 +++
.../database/option/MySQLFunctionOption.java | 44 ++++++++++++++++
.../database/MySQLDatabaseMetaDataTest.java | 6 +++
.../database/option/MySQLFunctionOptionTest.java | 49 ++++++++++++++++++
.../database/OpenGaussDatabaseMetaData.java | 7 +++
.../database/OpenGaussDatabaseMetaDataTest.java | 6 +++
.../metadata/database/OracleDatabaseMetaData.java | 7 +++
.../database/option/OracleFunctionOption.java | 45 ++++++++++++++++
.../database/OracleDatabaseMetaDataTest.java | 6 +++
.../database/option/OracleFunctionOptionTest.java | 60 ++++++++++++++++++++++
.../database/PostgreSQLDatabaseMetaData.java | 7 +++
.../database/option/PostgreSQLFunctionOption.java | 44 ++++++++++++++++
.../database/PostgreSQLDatabaseMetaDataTest.java | 6 +++
.../option/PostgreSQLFunctionOptionTest.java | 49 ++++++++++++++++++
.../metadata/database/PrestoDatabaseMetaData.java | 7 +++
.../database/option/PrestoFunctionOption.java | 43 ++++++++++++++++
.../database/PrestoDatabaseMetaDataTest.java | 6 +++
.../database/option/PrestoFunctionOptionTest.java | 44 ++++++++++++++++
.../metadata/database/SQL92DatabaseMetaData.java | 7 +++
.../SQL92FunctionOption.java} | 34 +++++-------
.../database/SQL92DatabaseMetaDataTest.java | 7 +++
.../database/option/SQL92FunctionOptionTest.java | 44 ++++++++++++++++
.../database/SQLServerDatabaseMetaData.java | 7 +++
.../database/option/SQLServerFunctionOption.java | 44 ++++++++++++++++
.../database/SQLServerDatabaseMetaDataTest.java | 7 +++
.../option/SQLServerFunctionOptionTest.java | 46 +++++++++++++++++
.../dml/expression/type/ColumnSegmentBinder.java | 13 ++---
.../dml/assign/AssignmentSegmentBinderTest.java | 14 ++++-
.../expression/type/ColumnSegmentBinderTest.java | 19 +++++--
.../type/OuterJoinExpressionBinderTest.java | 14 ++++-
47 files changed, 1085 insertions(+), 33 deletions(-)
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index 84a4c92b048..919377b17fa 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -3,6 +3,7 @@
### Bug Fixes
1. SQL Parser: Preserve unary NOT as NotExpression for scalar-subquery table
extraction in PostgreSQL -
[#38187](https://github.com/apache/shardingsphere/pull/38187)
+1. SQL Binder: Add DialectFunctionOption to handle wrong skip column bind in
ColumnSegmentBinder -
[#38350](https://github.com/apache/shardingsphere/pull/38350)
1. JDBC: Fix stale generated values leaking into prepared statement
executeBatch calls without pending batches -
[#38160](https://github.com/apache/shardingsphere/pull/38160)
### Enhancements
diff --git
a/database/connector/core/src/main/java/org/apache/shardingsphere/database/connector/core/metadata/database/metadata/DialectDatabaseMetaData.java
b/database/connector/core/src/main/java/org/apache/shardingsphere/database/connector/core/metadata/database/metadata/DialectDatabaseMetaData.java
index 342b0d455c8..b84874ecdfd 100644
---
a/database/connector/core/src/main/java/org/apache/shardingsphere/database/connector/core/metadata/database/metadata/DialectDatabaseMetaData.java
+++
b/database/connector/core/src/main/java/org/apache/shardingsphere/database/connector/core/metadata/database/metadata/DialectDatabaseMetaData.java
@@ -25,6 +25,8 @@ import
org.apache.shardingsphere.database.connector.core.metadata.database.metad
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.connection.DialectConnectionOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.datatype.DefaultDataTypeOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.datatype.DialectDataTypeOption;
+import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.function.DialectFunctionOption;
+import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.function.DefaultFunctionOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.index.DialectIndexOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.join.DialectJoinOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.keygen.DialectGeneratedKeyOption;
@@ -195,4 +197,13 @@ public interface DialectDatabaseMetaData extends
DatabaseTypedSPI {
default DialectProtocolVersionOption getProtocolVersionOption() {
return new DialectProtocolVersionOption("");
}
+
+ /**
+ * Get function option.
+ *
+ * @return function option
+ */
+ default DialectFunctionOption getFunctionOption() {
+ return new DefaultFunctionOption();
+ }
}
diff --git
a/database/connector/core/src/main/java/org/apache/shardingsphere/database/connector/core/metadata/database/metadata/option/function/DefaultFunctionOption.java
b/database/connector/core/src/main/java/org/apache/shardingsphere/database/connector/core/metadata/database/metadata/option/function/DefaultFunctionOption.java
new file mode 100644
index 00000000000..74390af6776
--- /dev/null
+++
b/database/connector/core/src/main/java/org/apache/shardingsphere/database/connector/core/metadata/database/metadata/option/function/DefaultFunctionOption.java
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+package
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.function;
+
+/**
+ * Default function option.
+ */
+public final class DefaultFunctionOption implements DialectFunctionOption {
+
+ @Override
+ public String getIfNullFunctionName() {
+ return "IFNULL";
+ }
+}
diff --git
a/database/connector/core/src/main/java/org/apache/shardingsphere/database/connector/core/metadata/database/metadata/option/function/DialectFunctionOption.java
b/database/connector/core/src/main/java/org/apache/shardingsphere/database/connector/core/metadata/database/metadata/option/function/DialectFunctionOption.java
new file mode 100644
index 00000000000..9198f9d256a
--- /dev/null
+++
b/database/connector/core/src/main/java/org/apache/shardingsphere/database/connector/core/metadata/database/metadata/option/function/DialectFunctionOption.java
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+package
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.function;
+
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * Dialect function option.
+ */
+public interface DialectFunctionOption {
+
+ /**
+ * Get if null function name.
+ *
+ * @return if null function name
+ */
+ String getIfNullFunctionName();
+
+ /**
+ * Get unparenthesized function names.
+ *
+ * @return unparenthesized function names
+ */
+ default Collection<String> getUnparenthesizedFunctionNames() {
+ return Collections.emptySet();
+ }
+}
diff --git
a/database/connector/core/src/test/java/org/apache/shardingsphere/database/connector/core/metadata/database/metadata/option/function/DefaultFunctionOptionTest.java
b/database/connector/core/src/test/java/org/apache/shardingsphere/database/connector/core/metadata/database/metadata/option/function/DefaultFunctionOptionTest.java
new file mode 100644
index 00000000000..b33145475ec
--- /dev/null
+++
b/database/connector/core/src/test/java/org/apache/shardingsphere/database/connector/core/metadata/database/metadata/option/function/DefaultFunctionOptionTest.java
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+package
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.function;
+
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class DefaultFunctionOptionTest {
+
+ @Test
+ void assertGetIfNullFunctionName() {
+ assertThat(new DefaultFunctionOption().getIfNullFunctionName(),
is("IFNULL"));
+ }
+
+ @Test
+ void assertGetUnParenthesizedFunctionNames() {
+ assertTrue(new
DefaultFunctionOption().getUnparenthesizedFunctionNames().isEmpty());
+ }
+}
diff --git
a/database/connector/dialect/firebird/src/main/java/org/apache/shardingsphere/database/connector/firebird/metadata/database/FirebirdDatabaseMetaData.java
b/database/connector/dialect/firebird/src/main/java/org/apache/shardingsphere/database/connector/firebird/metadata/database/FirebirdDatabaseMetaData.java
index 7fa17ddc0ae..644da60fb4b 100644
---
a/database/connector/dialect/firebird/src/main/java/org/apache/shardingsphere/database/connector/firebird/metadata/database/FirebirdDatabaseMetaData.java
+++
b/database/connector/dialect/firebird/src/main/java/org/apache/shardingsphere/database/connector/firebird/metadata/database/FirebirdDatabaseMetaData.java
@@ -21,9 +21,11 @@ import
org.apache.shardingsphere.database.connector.core.metadata.database.enums
import
org.apache.shardingsphere.database.connector.core.metadata.database.enums.QuoteCharacter;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.DialectDatabaseMetaData;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.IdentifierPatternType;
+import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.function.DialectFunctionOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.schema.DialectSchemaOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.transaction.DialectTransactionOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.version.DialectProtocolVersionOption;
+import
org.apache.shardingsphere.database.connector.firebird.metadata.database.option.FirebirdFunctionOption;
import
org.apache.shardingsphere.database.connector.firebird.metadata.database.option.FirebirdSchemaOption;
import java.sql.Connection;
@@ -64,6 +66,11 @@ public final class FirebirdDatabaseMetaData implements
DialectDatabaseMetaData {
return new DialectProtocolVersionOption("18");
}
+ @Override
+ public DialectFunctionOption getFunctionOption() {
+ return new FirebirdFunctionOption();
+ }
+
@Override
public String getDatabaseType() {
return "Firebird";
diff --git
a/database/connector/dialect/firebird/src/main/java/org/apache/shardingsphere/database/connector/firebird/metadata/database/option/FirebirdFunctionOption.java
b/database/connector/dialect/firebird/src/main/java/org/apache/shardingsphere/database/connector/firebird/metadata/database/option/FirebirdFunctionOption.java
new file mode 100644
index 00000000000..f3e6ac005a7
--- /dev/null
+++
b/database/connector/dialect/firebird/src/main/java/org/apache/shardingsphere/database/connector/firebird/metadata/database/option/FirebirdFunctionOption.java
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+package
org.apache.shardingsphere.database.connector.firebird.metadata.database.option;
+
+import com.cedarsoftware.util.CaseInsensitiveSet;
+import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.function.DialectFunctionOption;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+/**
+ * Function option of Firebird.
+ */
+public final class FirebirdFunctionOption implements DialectFunctionOption {
+
+ private static final Collection<String> UNPARENTHESIZED_FUNCTION_NAMES =
new CaseInsensitiveSet<>(Arrays.asList(
+ "CURRENT_DATE", "CURRENT_TIME", "CURRENT_TIMESTAMP",
"CURRENT_USER"));
+
+ @Override
+ public String getIfNullFunctionName() {
+ return "IFNULL";
+ }
+
+ @Override
+ public Collection<String> getUnparenthesizedFunctionNames() {
+ return UNPARENTHESIZED_FUNCTION_NAMES;
+ }
+}
diff --git
a/database/connector/dialect/firebird/src/test/java/org/apache/shardingsphere/database/connector/firebird/metadata/database/FirebirdDatabaseMetaDataTest.java
b/database/connector/dialect/firebird/src/test/java/org/apache/shardingsphere/database/connector/firebird/metadata/database/FirebirdDatabaseMetaDataTest.java
index 5003d1fcb15..756e65e544d 100644
---
a/database/connector/dialect/firebird/src/test/java/org/apache/shardingsphere/database/connector/firebird/metadata/database/FirebirdDatabaseMetaDataTest.java
+++
b/database/connector/dialect/firebird/src/test/java/org/apache/shardingsphere/database/connector/firebird/metadata/database/FirebirdDatabaseMetaDataTest.java
@@ -25,6 +25,7 @@ import
org.apache.shardingsphere.database.connector.core.metadata.database.metad
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.transaction.DialectTransactionOption;
import
org.apache.shardingsphere.database.connector.core.spi.DatabaseTypedSPILoader;
import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import
org.apache.shardingsphere.database.connector.firebird.metadata.database.option.FirebirdFunctionOption;
import
org.apache.shardingsphere.database.connector.firebird.metadata.database.option.FirebirdSchemaOption;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.junit.jupiter.api.Test;
@@ -84,4 +85,9 @@ class FirebirdDatabaseMetaDataTest {
void assertGetProtocolVersionOption() {
assertThat(dialectDatabaseMetaData.getProtocolVersionOption().getDefaultVersion(),
is("18"));
}
+
+ @Test
+ void assertGetFunctionOption() {
+ assertThat(dialectDatabaseMetaData.getFunctionOption(),
isA(FirebirdFunctionOption.class));
+ }
}
diff --git
a/database/connector/dialect/firebird/src/test/java/org/apache/shardingsphere/database/connector/firebird/metadata/database/option/FirebirdFunctionOptionTest.java
b/database/connector/dialect/firebird/src/test/java/org/apache/shardingsphere/database/connector/firebird/metadata/database/option/FirebirdFunctionOptionTest.java
new file mode 100644
index 00000000000..db6e453d453
--- /dev/null
+++
b/database/connector/dialect/firebird/src/test/java/org/apache/shardingsphere/database/connector/firebird/metadata/database/option/FirebirdFunctionOptionTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+
+package
org.apache.shardingsphere.database.connector.firebird.metadata.database.option;
+
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class FirebirdFunctionOptionTest {
+
+ private final FirebirdFunctionOption functionOption = new
FirebirdFunctionOption();
+
+ @Test
+ void assertGetIfNullFunctionName() {
+ assertThat(functionOption.getIfNullFunctionName(), is("IFNULL"));
+ }
+
+ @Test
+ void assertGetUnparenthesizedFunctionNames() {
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_DATE"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_TIME"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_TIMESTAMP"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_USER"));
+ }
+}
diff --git
a/database/connector/dialect/h2/src/main/java/org/apache/shardingsphere/database/connector/h2/metadata/database/H2DatabaseMetaData.java
b/database/connector/dialect/h2/src/main/java/org/apache/shardingsphere/database/connector/h2/metadata/database/H2DatabaseMetaData.java
index 9340a8eec9b..48e53d42f28 100644
---
a/database/connector/dialect/h2/src/main/java/org/apache/shardingsphere/database/connector/h2/metadata/database/H2DatabaseMetaData.java
+++
b/database/connector/dialect/h2/src/main/java/org/apache/shardingsphere/database/connector/h2/metadata/database/H2DatabaseMetaData.java
@@ -21,7 +21,9 @@ import
org.apache.shardingsphere.database.connector.core.metadata.database.enums
import
org.apache.shardingsphere.database.connector.core.metadata.database.enums.QuoteCharacter;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.DialectDatabaseMetaData;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.IdentifierPatternType;
+import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.function.DialectFunctionOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.transaction.DialectTransactionOption;
+import
org.apache.shardingsphere.database.connector.h2.metadata.database.option.H2FunctionOption;
import java.sql.Connection;
import java.util.Collections;
@@ -51,6 +53,11 @@ public final class H2DatabaseMetaData implements
DialectDatabaseMetaData {
return new DialectTransactionOption(false, false, false, false, true,
Connection.TRANSACTION_READ_COMMITTED, false, false,
Collections.singleton("org.h2.jdbcx.JdbcDataSource"));
}
+ @Override
+ public DialectFunctionOption getFunctionOption() {
+ return new H2FunctionOption();
+ }
+
@Override
public String getDatabaseType() {
return "H2";
diff --git
a/database/connector/dialect/h2/src/main/java/org/apache/shardingsphere/database/connector/h2/metadata/database/option/H2FunctionOption.java
b/database/connector/dialect/h2/src/main/java/org/apache/shardingsphere/database/connector/h2/metadata/database/option/H2FunctionOption.java
new file mode 100644
index 00000000000..f251443f408
--- /dev/null
+++
b/database/connector/dialect/h2/src/main/java/org/apache/shardingsphere/database/connector/h2/metadata/database/option/H2FunctionOption.java
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+package
org.apache.shardingsphere.database.connector.h2.metadata.database.option;
+
+import com.cedarsoftware.util.CaseInsensitiveSet;
+import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.function.DialectFunctionOption;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+/**
+ * Function option of H2.
+ */
+public final class H2FunctionOption implements DialectFunctionOption {
+
+ private static final Collection<String> UNPARENTHESIZED_FUNCTION_NAMES =
new CaseInsensitiveSet<>(Arrays.asList(
+ "CURRENT_DATE", "CURRENT_TIME", "CURRENT_TIMESTAMP",
"CURRENT_USER", "LOCALTIME", "LOCALTIMESTAMP", "SESSION_USER", "USER"));
+
+ @Override
+ public String getIfNullFunctionName() {
+ return "IFNULL";
+ }
+
+ @Override
+ public Collection<String> getUnparenthesizedFunctionNames() {
+ return UNPARENTHESIZED_FUNCTION_NAMES;
+ }
+}
diff --git
a/database/connector/dialect/h2/src/test/java/org/apache/shardingsphere/database/connector/h2/metadata/database/H2DatabaseMetaDataTest.java
b/database/connector/dialect/h2/src/test/java/org/apache/shardingsphere/database/connector/h2/metadata/database/H2DatabaseMetaDataTest.java
index 9a98706909f..daf0326fd25 100644
---
a/database/connector/dialect/h2/src/test/java/org/apache/shardingsphere/database/connector/h2/metadata/database/H2DatabaseMetaDataTest.java
+++
b/database/connector/dialect/h2/src/test/java/org/apache/shardingsphere/database/connector/h2/metadata/database/H2DatabaseMetaDataTest.java
@@ -24,6 +24,7 @@ import
org.apache.shardingsphere.database.connector.core.metadata.database.metad
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.transaction.DialectTransactionOption;
import
org.apache.shardingsphere.database.connector.core.spi.DatabaseTypedSPILoader;
import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import
org.apache.shardingsphere.database.connector.h2.metadata.database.option.H2FunctionOption;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.junit.jupiter.api.Test;
@@ -31,6 +32,7 @@ import java.sql.Connection;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.isA;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -67,4 +69,9 @@ class H2DatabaseMetaDataTest {
assertThat(actual.getXaDriverClassNames().size(), is(1));
assertTrue(actual.getXaDriverClassNames().contains("org.h2.jdbcx.JdbcDataSource"));
}
+
+ @Test
+ void assertGetFunctionOption() {
+ assertThat(dialectDatabaseMetaData.getFunctionOption(),
isA(H2FunctionOption.class));
+ }
}
diff --git
a/database/connector/dialect/h2/src/test/java/org/apache/shardingsphere/database/connector/h2/metadata/database/option/H2FunctionOptionTest.java
b/database/connector/dialect/h2/src/test/java/org/apache/shardingsphere/database/connector/h2/metadata/database/option/H2FunctionOptionTest.java
new file mode 100644
index 00000000000..261fff3cfda
--- /dev/null
+++
b/database/connector/dialect/h2/src/test/java/org/apache/shardingsphere/database/connector/h2/metadata/database/option/H2FunctionOptionTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+package
org.apache.shardingsphere.database.connector.h2.metadata.database.option;
+
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class H2FunctionOptionTest {
+
+ private final H2FunctionOption functionOption = new H2FunctionOption();
+
+ @Test
+ void assertGetIfNullFunctionName() {
+ assertThat(functionOption.getIfNullFunctionName(), is("IFNULL"));
+ }
+
+ @Test
+ void assertGetUnparenthesizedFunctionNames() {
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_DATE"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_TIME"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_TIMESTAMP"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_USER"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("LOCALTIME"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("LOCALTIMESTAMP"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("SESSION_USER"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("USER"));
+ }
+}
diff --git
a/database/connector/dialect/hive/src/main/java/org/apache/shardingsphere/database/connector/hive/metadata/database/HiveDatabaseMetaData.java
b/database/connector/dialect/hive/src/main/java/org/apache/shardingsphere/database/connector/hive/metadata/database/HiveDatabaseMetaData.java
index a189e02d227..bbc54051c44 100644
---
a/database/connector/dialect/hive/src/main/java/org/apache/shardingsphere/database/connector/hive/metadata/database/HiveDatabaseMetaData.java
+++
b/database/connector/dialect/hive/src/main/java/org/apache/shardingsphere/database/connector/hive/metadata/database/HiveDatabaseMetaData.java
@@ -21,9 +21,11 @@ import
org.apache.shardingsphere.database.connector.core.metadata.database.enums
import
org.apache.shardingsphere.database.connector.core.metadata.database.enums.QuoteCharacter;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.DialectDatabaseMetaData;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.IdentifierPatternType;
+import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.function.DialectFunctionOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.schema.DefaultSchemaOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.schema.DialectSchemaOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.sqlbatch.DialectSQLBatchOption;
+import
org.apache.shardingsphere.database.connector.hive.metadata.database.option.HiveFunctionOption;
/**
* Database meta data of Hive.
@@ -55,6 +57,11 @@ public final class HiveDatabaseMetaData implements
DialectDatabaseMetaData {
return new DialectSQLBatchOption(false);
}
+ @Override
+ public DialectFunctionOption getFunctionOption() {
+ return new HiveFunctionOption();
+ }
+
@Override
public String getDatabaseType() {
return "Hive";
diff --git
a/database/connector/dialect/hive/src/main/java/org/apache/shardingsphere/database/connector/hive/metadata/database/option/HiveFunctionOption.java
b/database/connector/dialect/hive/src/main/java/org/apache/shardingsphere/database/connector/hive/metadata/database/option/HiveFunctionOption.java
new file mode 100644
index 00000000000..9bf5d441a78
--- /dev/null
+++
b/database/connector/dialect/hive/src/main/java/org/apache/shardingsphere/database/connector/hive/metadata/database/option/HiveFunctionOption.java
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+package
org.apache.shardingsphere.database.connector.hive.metadata.database.option;
+
+import com.cedarsoftware.util.CaseInsensitiveSet;
+import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.function.DialectFunctionOption;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+/**
+ * Function option of Hive.
+ */
+public final class HiveFunctionOption implements DialectFunctionOption {
+
+ private static final Collection<String> UNPARENTHESIZED_FUNCTION_NAMES =
new CaseInsensitiveSet<>(Arrays.asList(
+ "CURRENT_DATE", "CURRENT_TIMESTAMP", "CURRENT_USER"));
+
+ @Override
+ public String getIfNullFunctionName() {
+ return "IFNULL";
+ }
+
+ @Override
+ public Collection<String> getUnparenthesizedFunctionNames() {
+ return UNPARENTHESIZED_FUNCTION_NAMES;
+ }
+}
diff --git
a/database/connector/dialect/hive/src/test/java/org/apache/shardingsphere/database/connector/hive/metadata/database/HiveDatabaseMetaDataTest.java
b/database/connector/dialect/hive/src/test/java/org/apache/shardingsphere/database/connector/hive/metadata/database/HiveDatabaseMetaDataTest.java
index dee8916a6e3..04ff520e07a 100644
---
a/database/connector/dialect/hive/src/test/java/org/apache/shardingsphere/database/connector/hive/metadata/database/HiveDatabaseMetaDataTest.java
+++
b/database/connector/dialect/hive/src/test/java/org/apache/shardingsphere/database/connector/hive/metadata/database/HiveDatabaseMetaDataTest.java
@@ -25,6 +25,7 @@ import
org.apache.shardingsphere.database.connector.core.metadata.database.metad
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.schema.DialectSchemaOption;
import
org.apache.shardingsphere.database.connector.core.spi.DatabaseTypedSPILoader;
import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import
org.apache.shardingsphere.database.connector.hive.metadata.database.option.HiveFunctionOption;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.junit.jupiter.api.Test;
@@ -67,4 +68,9 @@ class HiveDatabaseMetaDataTest {
void assertGetSQLBatchOption() {
assertFalse(dialectDatabaseMetaData.getSQLBatchOption().isSupportSQLBatch());
}
+
+ @Test
+ void assertGetFunctionOption() {
+ assertThat(dialectDatabaseMetaData.getFunctionOption(),
isA(HiveFunctionOption.class));
+ }
}
diff --git
a/database/connector/dialect/hive/src/test/java/org/apache/shardingsphere/database/connector/hive/metadata/database/option/HiveFunctionOptionTest.java
b/database/connector/dialect/hive/src/test/java/org/apache/shardingsphere/database/connector/hive/metadata/database/option/HiveFunctionOptionTest.java
new file mode 100644
index 00000000000..be923fbb34f
--- /dev/null
+++
b/database/connector/dialect/hive/src/test/java/org/apache/shardingsphere/database/connector/hive/metadata/database/option/HiveFunctionOptionTest.java
@@ -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.
+ */
+
+package
org.apache.shardingsphere.database.connector.hive.metadata.database.option;
+
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class HiveFunctionOptionTest {
+
+ private final HiveFunctionOption functionOption = new HiveFunctionOption();
+
+ @Test
+ void assertGetIfNullFunctionName() {
+ assertThat(functionOption.getIfNullFunctionName(), is("IFNULL"));
+ }
+
+ @Test
+ void assertGetUnparenthesizedFunctionNames() {
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_DATE"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_TIMESTAMP"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_USER"));
+ }
+}
diff --git
a/database/connector/dialect/mysql/src/main/java/org/apache/shardingsphere/database/connector/mysql/metadata/database/MySQLDatabaseMetaData.java
b/database/connector/dialect/mysql/src/main/java/org/apache/shardingsphere/database/connector/mysql/metadata/database/MySQLDatabaseMetaData.java
index a1626a5480e..44d8f94b945 100644
---
a/database/connector/dialect/mysql/src/main/java/org/apache/shardingsphere/database/connector/mysql/metadata/database/MySQLDatabaseMetaData.java
+++
b/database/connector/dialect/mysql/src/main/java/org/apache/shardingsphere/database/connector/mysql/metadata/database/MySQLDatabaseMetaData.java
@@ -24,11 +24,13 @@ import
org.apache.shardingsphere.database.connector.core.metadata.database.metad
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.column.DialectColumnOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.connection.DialectConnectionOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.datatype.DialectDataTypeOption;
+import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.function.DialectFunctionOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.join.DialectJoinOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.keygen.DialectGeneratedKeyOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.transaction.DialectTransactionOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.version.DialectProtocolVersionOption;
import
org.apache.shardingsphere.database.connector.mysql.metadata.database.option.MySQLDataTypeOption;
+import
org.apache.shardingsphere.database.connector.mysql.metadata.database.option.MySQLFunctionOption;
import java.sql.Connection;
import java.util.Arrays;
@@ -90,6 +92,11 @@ public final class MySQLDatabaseMetaData implements
DialectDatabaseMetaData {
return new DialectProtocolVersionOption("5.7.22");
}
+ @Override
+ public DialectFunctionOption getFunctionOption() {
+ return new MySQLFunctionOption();
+ }
+
@Override
public String getDatabaseType() {
return "MySQL";
diff --git
a/database/connector/dialect/mysql/src/main/java/org/apache/shardingsphere/database/connector/mysql/metadata/database/option/MySQLFunctionOption.java
b/database/connector/dialect/mysql/src/main/java/org/apache/shardingsphere/database/connector/mysql/metadata/database/option/MySQLFunctionOption.java
new file mode 100644
index 00000000000..7a98b54d3bb
--- /dev/null
+++
b/database/connector/dialect/mysql/src/main/java/org/apache/shardingsphere/database/connector/mysql/metadata/database/option/MySQLFunctionOption.java
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+
+package
org.apache.shardingsphere.database.connector.mysql.metadata.database.option;
+
+import com.cedarsoftware.util.CaseInsensitiveSet;
+import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.function.DialectFunctionOption;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+/**
+ * MySQL function option.
+ */
+public final class MySQLFunctionOption implements DialectFunctionOption {
+
+ private static final Collection<String> UNPARENTHESIZED_FUNCTION_NAMES =
new CaseInsensitiveSet<>(Arrays.asList(
+ "CURRENT_DATE", "CURRENT_TIME", "CURRENT_TIMESTAMP",
"CURRENT_USER", "LOCALTIME",
+ "LOCALTIMESTAMP", "SESSION_USER", "SYSTEM_USER", "UTC_DATE",
"UTC_TIME", "UTC_TIMESTAMP"));
+
+ @Override
+ public String getIfNullFunctionName() {
+ return "IFNULL";
+ }
+
+ @Override
+ public Collection<String> getUnparenthesizedFunctionNames() {
+ return UNPARENTHESIZED_FUNCTION_NAMES;
+ }
+}
diff --git
a/database/connector/dialect/mysql/src/test/java/org/apache/shardingsphere/database/connector/mysql/metadata/database/MySQLDatabaseMetaDataTest.java
b/database/connector/dialect/mysql/src/test/java/org/apache/shardingsphere/database/connector/mysql/metadata/database/MySQLDatabaseMetaDataTest.java
index 5907f6169c0..14f8bbe4ef4 100644
---
a/database/connector/dialect/mysql/src/test/java/org/apache/shardingsphere/database/connector/mysql/metadata/database/MySQLDatabaseMetaDataTest.java
+++
b/database/connector/dialect/mysql/src/test/java/org/apache/shardingsphere/database/connector/mysql/metadata/database/MySQLDatabaseMetaDataTest.java
@@ -28,6 +28,7 @@ import
org.apache.shardingsphere.database.connector.core.metadata.database.metad
import
org.apache.shardingsphere.database.connector.core.spi.DatabaseTypedSPILoader;
import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
import
org.apache.shardingsphere.database.connector.mysql.metadata.database.option.MySQLDataTypeOption;
+import
org.apache.shardingsphere.database.connector.mysql.metadata.database.option.MySQLFunctionOption;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.junit.jupiter.api.Test;
@@ -112,4 +113,9 @@ class MySQLDatabaseMetaDataTest {
void assertGetProtocolVersionOption() {
assertThat(dialectDatabaseMetaData.getProtocolVersionOption().getDefaultVersion(),
is("5.7.22"));
}
+
+ @Test
+ void assertGetFunctionOption() {
+ assertThat(dialectDatabaseMetaData.getFunctionOption(),
isA(MySQLFunctionOption.class));
+ }
}
diff --git
a/database/connector/dialect/mysql/src/test/java/org/apache/shardingsphere/database/connector/mysql/metadata/database/option/MySQLFunctionOptionTest.java
b/database/connector/dialect/mysql/src/test/java/org/apache/shardingsphere/database/connector/mysql/metadata/database/option/MySQLFunctionOptionTest.java
new file mode 100644
index 00000000000..6f1a1c72c84
--- /dev/null
+++
b/database/connector/dialect/mysql/src/test/java/org/apache/shardingsphere/database/connector/mysql/metadata/database/option/MySQLFunctionOptionTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+package
org.apache.shardingsphere.database.connector.mysql.metadata.database.option;
+
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class MySQLFunctionOptionTest {
+
+ private final MySQLFunctionOption functionOption = new
MySQLFunctionOption();
+
+ @Test
+ void assertGetIfNullFunctionName() {
+ assertThat(functionOption.getIfNullFunctionName(), is("IFNULL"));
+ }
+
+ @Test
+ void assertGetUnparenthesizedFunctionNames() {
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_DATE"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_TIME"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_TIMESTAMP"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_USER"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("LOCALTIME"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("LOCALTIMESTAMP"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("SESSION_USER"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("SYSTEM_USER"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("UTC_DATE"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("UTC_TIME"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("UTC_TIMESTAMP"));
+ }
+}
diff --git
a/database/connector/dialect/opengauss/src/main/java/org/apache/shardingsphere/database/connector/opengauss/metadata/database/OpenGaussDatabaseMetaData.java
b/database/connector/dialect/opengauss/src/main/java/org/apache/shardingsphere/database/connector/opengauss/metadata/database/OpenGaussDatabaseMetaData.java
index 1dc8843f78f..a09be3bd13b 100644
---
a/database/connector/dialect/opengauss/src/main/java/org/apache/shardingsphere/database/connector/opengauss/metadata/database/OpenGaussDatabaseMetaData.java
+++
b/database/connector/dialect/opengauss/src/main/java/org/apache/shardingsphere/database/connector/opengauss/metadata/database/OpenGaussDatabaseMetaData.java
@@ -22,6 +22,7 @@ import
org.apache.shardingsphere.database.connector.core.metadata.database.enums
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.DialectDatabaseMetaData;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.IdentifierPatternType;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.datatype.DialectDataTypeOption;
+import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.function.DialectFunctionOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.index.DialectIndexOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.schema.DialectSchemaOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.table.DialectDriverQuerySystemCatalogOption;
@@ -30,6 +31,7 @@ import
org.apache.shardingsphere.database.connector.core.metadata.database.metad
import
org.apache.shardingsphere.database.connector.opengauss.metadata.database.option.OpenGaussDataTypeOption;
import
org.apache.shardingsphere.database.connector.opengauss.metadata.database.option.OpenGaussDriverQuerySystemCatalogOption;
import
org.apache.shardingsphere.database.connector.opengauss.metadata.database.option.OpenGaussSchemaOption;
+import
org.apache.shardingsphere.database.connector.postgresql.metadata.database.option.PostgreSQLFunctionOption;
import java.sql.Connection;
import java.util.Collections;
@@ -75,6 +77,11 @@ public final class OpenGaussDatabaseMetaData implements
DialectDatabaseMetaData
return new DialectIndexOption(true);
}
+ @Override
+ public DialectFunctionOption getFunctionOption() {
+ return new PostgreSQLFunctionOption();
+ }
+
@Override
public DialectTransactionOption getTransactionOption() {
return new DialectTransactionOption(true, false, false, true, false,
Connection.TRANSACTION_READ_COMMITTED, true, true,
Collections.singleton("org.opengauss.xa.PGXADataSource"));
diff --git
a/database/connector/dialect/opengauss/src/test/java/org/apache/shardingsphere/database/connector/opengauss/metadata/database/OpenGaussDatabaseMetaDataTest.java
b/database/connector/dialect/opengauss/src/test/java/org/apache/shardingsphere/database/connector/opengauss/metadata/database/OpenGaussDatabaseMetaDataTest.java
index 1c6ac4f70a5..626f2f6d68f 100644
---
a/database/connector/dialect/opengauss/src/test/java/org/apache/shardingsphere/database/connector/opengauss/metadata/database/OpenGaussDatabaseMetaDataTest.java
+++
b/database/connector/dialect/opengauss/src/test/java/org/apache/shardingsphere/database/connector/opengauss/metadata/database/OpenGaussDatabaseMetaDataTest.java
@@ -28,6 +28,7 @@ import
org.apache.shardingsphere.database.connector.core.spi.DatabaseTypedSPILoa
import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
import
org.apache.shardingsphere.database.connector.opengauss.metadata.database.option.OpenGaussDataTypeOption;
import
org.apache.shardingsphere.database.connector.opengauss.metadata.database.option.OpenGaussSchemaOption;
+import
org.apache.shardingsphere.database.connector.postgresql.metadata.database.option.PostgreSQLFunctionOption;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.junit.jupiter.api.Test;
@@ -117,4 +118,9 @@ class OpenGaussDatabaseMetaDataTest {
void assertIsCaseSensitive() {
assertTrue(dialectDatabaseMetaData.isCaseSensitive());
}
+
+ @Test
+ void assertGetFunctionOption() {
+ assertThat(dialectDatabaseMetaData.getFunctionOption(),
isA(PostgreSQLFunctionOption.class));
+ }
}
diff --git
a/database/connector/dialect/oracle/src/main/java/org/apache/shardingsphere/database/connector/oracle/metadata/database/OracleDatabaseMetaData.java
b/database/connector/dialect/oracle/src/main/java/org/apache/shardingsphere/database/connector/oracle/metadata/database/OracleDatabaseMetaData.java
index 6cf685b618b..00ff73e44b3 100644
---
a/database/connector/dialect/oracle/src/main/java/org/apache/shardingsphere/database/connector/oracle/metadata/database/OracleDatabaseMetaData.java
+++
b/database/connector/dialect/oracle/src/main/java/org/apache/shardingsphere/database/connector/oracle/metadata/database/OracleDatabaseMetaData.java
@@ -24,11 +24,13 @@ import
org.apache.shardingsphere.database.connector.core.metadata.database.metad
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.altertable.DialectAlterTableOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.connection.DialectConnectionOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.datatype.DialectDataTypeOption;
+import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.function.DialectFunctionOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.index.DialectIndexOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.pagination.DialectPaginationOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.schema.DialectSchemaOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.transaction.DialectTransactionOption;
import
org.apache.shardingsphere.database.connector.oracle.metadata.database.option.OracleDataTypeOption;
+import
org.apache.shardingsphere.database.connector.oracle.metadata.database.option.OracleFunctionOption;
import
org.apache.shardingsphere.database.connector.oracle.metadata.database.option.OracleSchemaOption;
import java.sql.Connection;
@@ -90,6 +92,11 @@ public final class OracleDatabaseMetaData implements
DialectDatabaseMetaData {
return Optional.of(new DialectAlterTableOption(true, true));
}
+ @Override
+ public DialectFunctionOption getFunctionOption() {
+ return new OracleFunctionOption();
+ }
+
@Override
public String getDatabaseType() {
return "Oracle";
diff --git
a/database/connector/dialect/oracle/src/main/java/org/apache/shardingsphere/database/connector/oracle/metadata/database/option/OracleFunctionOption.java
b/database/connector/dialect/oracle/src/main/java/org/apache/shardingsphere/database/connector/oracle/metadata/database/option/OracleFunctionOption.java
new file mode 100644
index 00000000000..58791a9e31e
--- /dev/null
+++
b/database/connector/dialect/oracle/src/main/java/org/apache/shardingsphere/database/connector/oracle/metadata/database/option/OracleFunctionOption.java
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+package
org.apache.shardingsphere.database.connector.oracle.metadata.database.option;
+
+import com.cedarsoftware.util.CaseInsensitiveSet;
+import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.function.DialectFunctionOption;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+/**
+ * Oracle function option.
+ */
+public final class OracleFunctionOption implements DialectFunctionOption {
+
+ // TODO remove ROWNUM_ and ROW_NUMBER, move DAY to anthor method
@duanzhengqiang
+ private static final Collection<String> UNPARENTHESIZED_FUNCTION_NAMES =
new CaseInsensitiveSet<>(Arrays.asList(
+ "CURRENT_DATE", "CURRENT_TIME", "CURRENT_TIMESTAMP",
"CURRENT_USER", "CURRVAL", "DAY", "DBTIMEZONE", "LEVEL", "LOCALTIME",
"LOCALTIMESTAMP",
+ "NEXTVAL", "ORA_ROWSCN", "ROWID", "ROWNUM", "ROWNUM_",
"ROW_NUMBER", "SESSIONTIMEZONE", "SESSION_USER", "SYSDATE", "SYSTIMESTAMP",
"UID", "USER"));
+
+ @Override
+ public String getIfNullFunctionName() {
+ return "NVL";
+ }
+
+ @Override
+ public Collection<String> getUnparenthesizedFunctionNames() {
+ return UNPARENTHESIZED_FUNCTION_NAMES;
+ }
+}
diff --git
a/database/connector/dialect/oracle/src/test/java/org/apache/shardingsphere/database/connector/oracle/metadata/database/OracleDatabaseMetaDataTest.java
b/database/connector/dialect/oracle/src/test/java/org/apache/shardingsphere/database/connector/oracle/metadata/database/OracleDatabaseMetaDataTest.java
index b2652ba674d..7964b77a106 100644
---
a/database/connector/dialect/oracle/src/test/java/org/apache/shardingsphere/database/connector/oracle/metadata/database/OracleDatabaseMetaDataTest.java
+++
b/database/connector/dialect/oracle/src/test/java/org/apache/shardingsphere/database/connector/oracle/metadata/database/OracleDatabaseMetaDataTest.java
@@ -28,6 +28,7 @@ import
org.apache.shardingsphere.database.connector.core.metadata.database.metad
import
org.apache.shardingsphere.database.connector.core.spi.DatabaseTypedSPILoader;
import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
import
org.apache.shardingsphere.database.connector.oracle.metadata.database.option.OracleDataTypeOption;
+import
org.apache.shardingsphere.database.connector.oracle.metadata.database.option.OracleFunctionOption;
import
org.apache.shardingsphere.database.connector.oracle.metadata.database.option.OracleSchemaOption;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.junit.jupiter.api.Test;
@@ -112,4 +113,9 @@ class OracleDatabaseMetaDataTest {
assertTrue(actualAlterTableOption.get().isSupportMergeDropColumns());
assertTrue(actualAlterTableOption.get().isContainsParenthesesOnMergeDropColumns());
}
+
+ @Test
+ void assertGetFunctionOption() {
+ assertThat(dialectDatabaseMetaData.getFunctionOption(),
isA(OracleFunctionOption.class));
+ }
}
diff --git
a/database/connector/dialect/oracle/src/test/java/org/apache/shardingsphere/database/connector/oracle/metadata/database/option/OracleFunctionOptionTest.java
b/database/connector/dialect/oracle/src/test/java/org/apache/shardingsphere/database/connector/oracle/metadata/database/option/OracleFunctionOptionTest.java
new file mode 100644
index 00000000000..f02c542322f
--- /dev/null
+++
b/database/connector/dialect/oracle/src/test/java/org/apache/shardingsphere/database/connector/oracle/metadata/database/option/OracleFunctionOptionTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+package
org.apache.shardingsphere.database.connector.oracle.metadata.database.option;
+
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class OracleFunctionOptionTest {
+
+ private final OracleFunctionOption functionOption = new
OracleFunctionOption();
+
+ @Test
+ void assertGetIfNullFunctionName() {
+ assertThat(functionOption.getIfNullFunctionName(), is("NVL"));
+ }
+
+ @Test
+ void assertGetUnparenthesizedFunctionNames() {
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_DATE"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_TIME"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_TIMESTAMP"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_USER"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRVAL"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("DAY"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("DBTIMEZONE"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("LEVEL"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("LOCALTIME"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("LOCALTIMESTAMP"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("NEXTVAL"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("ORA_ROWSCN"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("ROWID"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("ROWNUM"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("ROWNUM_"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("ROW_NUMBER"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("SESSIONTIMEZONE"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("SESSION_USER"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("SYSDATE"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("SYSTIMESTAMP"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("UID"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("USER"));
+ }
+}
diff --git
a/database/connector/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/connector/postgresql/metadata/database/PostgreSQLDatabaseMetaData.java
b/database/connector/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/connector/postgresql/metadata/database/PostgreSQLDatabaseMetaData.java
index 492c430b18e..6e9006e1dc0 100644
---
a/database/connector/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/connector/postgresql/metadata/database/PostgreSQLDatabaseMetaData.java
+++
b/database/connector/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/connector/postgresql/metadata/database/PostgreSQLDatabaseMetaData.java
@@ -22,11 +22,13 @@ import
org.apache.shardingsphere.database.connector.core.metadata.database.enums
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.DialectDatabaseMetaData;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.IdentifierPatternType;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.datatype.DialectDataTypeOption;
+import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.function.DialectFunctionOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.index.DialectIndexOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.schema.DialectSchemaOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.transaction.DialectTransactionOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.version.DialectProtocolVersionOption;
import
org.apache.shardingsphere.database.connector.postgresql.metadata.database.option.PostgreSQLDataTypeOption;
+import
org.apache.shardingsphere.database.connector.postgresql.metadata.database.option.PostgreSQLFunctionOption;
import
org.apache.shardingsphere.database.connector.postgresql.metadata.database.option.PostgreSQLSchemaOption;
import java.sql.Connection;
@@ -67,6 +69,11 @@ public final class PostgreSQLDatabaseMetaData implements
DialectDatabaseMetaData
return new DialectIndexOption(true);
}
+ @Override
+ public DialectFunctionOption getFunctionOption() {
+ return new PostgreSQLFunctionOption();
+ }
+
@Override
public DialectTransactionOption getTransactionOption() {
return new DialectTransactionOption(false, false, false, true, false,
Connection.TRANSACTION_READ_COMMITTED, true, true,
Collections.singleton("org.postgresql.xa.PGXADataSource"));
diff --git
a/database/connector/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/connector/postgresql/metadata/database/option/PostgreSQLFunctionOption.java
b/database/connector/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/connector/postgresql/metadata/database/option/PostgreSQLFunctionOption.java
new file mode 100644
index 00000000000..66872b3a842
--- /dev/null
+++
b/database/connector/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/connector/postgresql/metadata/database/option/PostgreSQLFunctionOption.java
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+
+package
org.apache.shardingsphere.database.connector.postgresql.metadata.database.option;
+
+import com.cedarsoftware.util.CaseInsensitiveSet;
+import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.function.DialectFunctionOption;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+/**
+ * PostgreSQL function option.
+ */
+public final class PostgreSQLFunctionOption implements DialectFunctionOption {
+
+ private static final Collection<String> UNPARENTHESIZED_FUNCTION_NAMES =
new CaseInsensitiveSet<>(Arrays.asList(
+ "CURRENT_CATALOG", "CURRENT_DATE", "CURRENT_ROLE",
"CURRENT_SCHEMA", "CURRENT_TIME",
+ "CURRENT_TIMESTAMP", "CURRENT_USER", "LOCALTIME",
"LOCALTIMESTAMP", "SESSION_USER", "USER"));
+
+ @Override
+ public String getIfNullFunctionName() {
+ return "COALESCE";
+ }
+
+ @Override
+ public Collection<String> getUnparenthesizedFunctionNames() {
+ return UNPARENTHESIZED_FUNCTION_NAMES;
+ }
+}
diff --git
a/database/connector/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/connector/postgresql/metadata/database/PostgreSQLDatabaseMetaDataTest.java
b/database/connector/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/connector/postgresql/metadata/database/PostgreSQLDatabaseMetaDataTest.java
index 5e77668a3de..a9e7a553172 100644
---
a/database/connector/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/connector/postgresql/metadata/database/PostgreSQLDatabaseMetaDataTest.java
+++
b/database/connector/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/connector/postgresql/metadata/database/PostgreSQLDatabaseMetaDataTest.java
@@ -25,6 +25,7 @@ import
org.apache.shardingsphere.database.connector.core.metadata.database.metad
import
org.apache.shardingsphere.database.connector.core.spi.DatabaseTypedSPILoader;
import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
import
org.apache.shardingsphere.database.connector.postgresql.metadata.database.option.PostgreSQLDataTypeOption;
+import
org.apache.shardingsphere.database.connector.postgresql.metadata.database.option.PostgreSQLFunctionOption;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.junit.jupiter.api.Test;
@@ -102,4 +103,9 @@ class PostgreSQLDatabaseMetaDataTest {
void assertIsCaseSensitive() {
assertTrue(dialectDatabaseMetaData.isCaseSensitive());
}
+
+ @Test
+ void assertGetFunctionOption() {
+ assertThat(dialectDatabaseMetaData.getFunctionOption(),
isA(PostgreSQLFunctionOption.class));
+ }
}
diff --git
a/database/connector/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/connector/postgresql/metadata/database/option/PostgreSQLFunctionOptionTest.java
b/database/connector/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/connector/postgresql/metadata/database/option/PostgreSQLFunctionOptionTest.java
new file mode 100644
index 00000000000..db6e6bbbe67
--- /dev/null
+++
b/database/connector/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/connector/postgresql/metadata/database/option/PostgreSQLFunctionOptionTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+package
org.apache.shardingsphere.database.connector.postgresql.metadata.database.option;
+
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class PostgreSQLFunctionOptionTest {
+
+ private final PostgreSQLFunctionOption functionOption = new
PostgreSQLFunctionOption();
+
+ @Test
+ void assertGetIfNullFunctionName() {
+ assertThat(functionOption.getIfNullFunctionName(), is("COALESCE"));
+ }
+
+ @Test
+ void assertGetUnparenthesizedFunctionNames() {
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_CATALOG"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_DATE"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_ROLE"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_SCHEMA"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_TIME"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_TIMESTAMP"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_USER"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("LOCALTIME"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("LOCALTIMESTAMP"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("SESSION_USER"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("USER"));
+ }
+}
diff --git
a/database/connector/dialect/presto/src/main/java/org/apache/shardingsphere/database/connector/presto/metadata/database/PrestoDatabaseMetaData.java
b/database/connector/dialect/presto/src/main/java/org/apache/shardingsphere/database/connector/presto/metadata/database/PrestoDatabaseMetaData.java
index 6d94563ceb9..b4a9a359154 100644
---
a/database/connector/dialect/presto/src/main/java/org/apache/shardingsphere/database/connector/presto/metadata/database/PrestoDatabaseMetaData.java
+++
b/database/connector/dialect/presto/src/main/java/org/apache/shardingsphere/database/connector/presto/metadata/database/PrestoDatabaseMetaData.java
@@ -21,8 +21,10 @@ import
org.apache.shardingsphere.database.connector.core.metadata.database.enums
import
org.apache.shardingsphere.database.connector.core.metadata.database.enums.QuoteCharacter;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.DialectDatabaseMetaData;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.IdentifierPatternType;
+import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.function.DialectFunctionOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.schema.DefaultSchemaOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.schema.DialectSchemaOption;
+import
org.apache.shardingsphere.database.connector.presto.metadata.database.option.PrestoFunctionOption;
/**
* Database meta data of Presto.
@@ -49,6 +51,11 @@ public final class PrestoDatabaseMetaData implements
DialectDatabaseMetaData {
return new DefaultSchemaOption(false, "default");
}
+ @Override
+ public DialectFunctionOption getFunctionOption() {
+ return new PrestoFunctionOption();
+ }
+
@Override
public String getDatabaseType() {
return "Presto";
diff --git
a/database/connector/dialect/presto/src/main/java/org/apache/shardingsphere/database/connector/presto/metadata/database/option/PrestoFunctionOption.java
b/database/connector/dialect/presto/src/main/java/org/apache/shardingsphere/database/connector/presto/metadata/database/option/PrestoFunctionOption.java
new file mode 100644
index 00000000000..f9891fb722e
--- /dev/null
+++
b/database/connector/dialect/presto/src/main/java/org/apache/shardingsphere/database/connector/presto/metadata/database/option/PrestoFunctionOption.java
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+package
org.apache.shardingsphere.database.connector.presto.metadata.database.option;
+
+import com.cedarsoftware.util.CaseInsensitiveSet;
+import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.function.DialectFunctionOption;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+/**
+ * Function option of Presto.
+ */
+public final class PrestoFunctionOption implements DialectFunctionOption {
+
+ private static final Collection<String> UNPARENTHESIZED_FUNCTION_NAMES =
new CaseInsensitiveSet<>(Arrays.asList(
+ "CURRENT_DATE", "CURRENT_TIME", "CURRENT_TIMESTAMP",
"CURRENT_USER", "LOCALTIME", "LOCALTIMESTAMP"));
+
+ @Override
+ public String getIfNullFunctionName() {
+ return "IFNULL";
+ }
+
+ @Override
+ public Collection<String> getUnparenthesizedFunctionNames() {
+ return UNPARENTHESIZED_FUNCTION_NAMES;
+ }
+}
diff --git
a/database/connector/dialect/presto/src/test/java/org/apache/shardingsphere/database/connector/presto/metadata/database/PrestoDatabaseMetaDataTest.java
b/database/connector/dialect/presto/src/test/java/org/apache/shardingsphere/database/connector/presto/metadata/database/PrestoDatabaseMetaDataTest.java
index 4c9f907db35..651f1d1746b 100644
---
a/database/connector/dialect/presto/src/test/java/org/apache/shardingsphere/database/connector/presto/metadata/database/PrestoDatabaseMetaDataTest.java
+++
b/database/connector/dialect/presto/src/test/java/org/apache/shardingsphere/database/connector/presto/metadata/database/PrestoDatabaseMetaDataTest.java
@@ -25,6 +25,7 @@ import
org.apache.shardingsphere.database.connector.core.metadata.database.metad
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.schema.DialectSchemaOption;
import
org.apache.shardingsphere.database.connector.core.spi.DatabaseTypedSPILoader;
import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import
org.apache.shardingsphere.database.connector.presto.metadata.database.option.PrestoFunctionOption;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.junit.jupiter.api.Test;
@@ -64,4 +65,9 @@ class PrestoDatabaseMetaDataTest {
assertThat(actual.getDefaultSchema().get(), is("default"));
assertFalse(actual.getDefaultSystemSchema().isPresent());
}
+
+ @Test
+ void assertGetFunctionOption() {
+ assertThat(dialectDatabaseMetaData.getFunctionOption(),
isA(PrestoFunctionOption.class));
+ }
}
diff --git
a/database/connector/dialect/presto/src/test/java/org/apache/shardingsphere/database/connector/presto/metadata/database/option/PrestoFunctionOptionTest.java
b/database/connector/dialect/presto/src/test/java/org/apache/shardingsphere/database/connector/presto/metadata/database/option/PrestoFunctionOptionTest.java
new file mode 100644
index 00000000000..e5b757ce41c
--- /dev/null
+++
b/database/connector/dialect/presto/src/test/java/org/apache/shardingsphere/database/connector/presto/metadata/database/option/PrestoFunctionOptionTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+
+package
org.apache.shardingsphere.database.connector.presto.metadata.database.option;
+
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class PrestoFunctionOptionTest {
+
+ private final PrestoFunctionOption functionOption = new
PrestoFunctionOption();
+
+ @Test
+ void assertGetIfNullFunctionName() {
+ assertThat(functionOption.getIfNullFunctionName(), is("IFNULL"));
+ }
+
+ @Test
+ void assertGetUnparenthesizedFunctionNames() {
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_DATE"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_TIME"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_TIMESTAMP"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_USER"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("LOCALTIME"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("LOCALTIMESTAMP"));
+ }
+}
diff --git
a/database/connector/dialect/sql92/src/main/java/org/apache/shardingsphere/database/connector/sql92/metadata/database/SQL92DatabaseMetaData.java
b/database/connector/dialect/sql92/src/main/java/org/apache/shardingsphere/database/connector/sql92/metadata/database/SQL92DatabaseMetaData.java
index 75fb264f042..85c02e79b4f 100644
---
a/database/connector/dialect/sql92/src/main/java/org/apache/shardingsphere/database/connector/sql92/metadata/database/SQL92DatabaseMetaData.java
+++
b/database/connector/dialect/sql92/src/main/java/org/apache/shardingsphere/database/connector/sql92/metadata/database/SQL92DatabaseMetaData.java
@@ -21,6 +21,8 @@ import
org.apache.shardingsphere.database.connector.core.metadata.database.enums
import
org.apache.shardingsphere.database.connector.core.metadata.database.enums.QuoteCharacter;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.DialectDatabaseMetaData;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.IdentifierPatternType;
+import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.function.DialectFunctionOption;
+import
org.apache.shardingsphere.database.connector.sql92.metadata.database.option.SQL92FunctionOption;
/**
* Database meta data of SQL92.
@@ -42,6 +44,11 @@ public final class SQL92DatabaseMetaData implements
DialectDatabaseMetaData {
return NullsOrderType.LOW;
}
+ @Override
+ public DialectFunctionOption getFunctionOption() {
+ return new SQL92FunctionOption();
+ }
+
@Override
public String getDatabaseType() {
return "SQL92";
diff --git
a/database/connector/dialect/sql92/src/main/java/org/apache/shardingsphere/database/connector/sql92/metadata/database/SQL92DatabaseMetaData.java
b/database/connector/dialect/sql92/src/main/java/org/apache/shardingsphere/database/connector/sql92/metadata/database/option/SQL92FunctionOption.java
similarity index 53%
copy from
database/connector/dialect/sql92/src/main/java/org/apache/shardingsphere/database/connector/sql92/metadata/database/SQL92DatabaseMetaData.java
copy to
database/connector/dialect/sql92/src/main/java/org/apache/shardingsphere/database/connector/sql92/metadata/database/option/SQL92FunctionOption.java
index 75fb264f042..0c936d093b6 100644
---
a/database/connector/dialect/sql92/src/main/java/org/apache/shardingsphere/database/connector/sql92/metadata/database/SQL92DatabaseMetaData.java
+++
b/database/connector/dialect/sql92/src/main/java/org/apache/shardingsphere/database/connector/sql92/metadata/database/option/SQL92FunctionOption.java
@@ -15,35 +15,29 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.database.connector.sql92.metadata.database;
+package
org.apache.shardingsphere.database.connector.sql92.metadata.database.option;
-import
org.apache.shardingsphere.database.connector.core.metadata.database.enums.NullsOrderType;
-import
org.apache.shardingsphere.database.connector.core.metadata.database.enums.QuoteCharacter;
-import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.DialectDatabaseMetaData;
-import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.IdentifierPatternType;
+import com.cedarsoftware.util.CaseInsensitiveSet;
+import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.function.DialectFunctionOption;
+
+import java.util.Arrays;
+import java.util.Collection;
/**
- * Database meta data of SQL92.
+ * Function option of SQL92.
*/
-public final class SQL92DatabaseMetaData implements DialectDatabaseMetaData {
-
- @Override
- public QuoteCharacter getQuoteCharacter() {
- return QuoteCharacter.QUOTE;
- }
+public final class SQL92FunctionOption implements DialectFunctionOption {
- @Override
- public IdentifierPatternType getIdentifierPatternType() {
- return IdentifierPatternType.KEEP_ORIGIN;
- }
+ private static final Collection<String> UNPARENTHESIZED_FUNCTION_NAMES =
new CaseInsensitiveSet<>(Arrays.asList(
+ "CURRENT_DATE", "CURRENT_TIME", "CURRENT_TIMESTAMP",
"CURRENT_USER", "SESSION_USER", "USER"));
@Override
- public NullsOrderType getDefaultNullsOrderType() {
- return NullsOrderType.LOW;
+ public String getIfNullFunctionName() {
+ return "IFNULL";
}
@Override
- public String getDatabaseType() {
- return "SQL92";
+ public Collection<String> getUnparenthesizedFunctionNames() {
+ return UNPARENTHESIZED_FUNCTION_NAMES;
}
}
diff --git
a/database/connector/dialect/sql92/src/test/java/org/apache/shardingsphere/database/connector/sql92/metadata/database/SQL92DatabaseMetaDataTest.java
b/database/connector/dialect/sql92/src/test/java/org/apache/shardingsphere/database/connector/sql92/metadata/database/SQL92DatabaseMetaDataTest.java
index 86e07bbd61d..501cbe6277d 100644
---
a/database/connector/dialect/sql92/src/test/java/org/apache/shardingsphere/database/connector/sql92/metadata/database/SQL92DatabaseMetaDataTest.java
+++
b/database/connector/dialect/sql92/src/test/java/org/apache/shardingsphere/database/connector/sql92/metadata/database/SQL92DatabaseMetaDataTest.java
@@ -23,11 +23,13 @@ import
org.apache.shardingsphere.database.connector.core.metadata.database.metad
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.IdentifierPatternType;
import
org.apache.shardingsphere.database.connector.core.spi.DatabaseTypedSPILoader;
import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import
org.apache.shardingsphere.database.connector.sql92.metadata.database.option.SQL92FunctionOption;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.isA;
class SQL92DatabaseMetaDataTest {
@@ -49,4 +51,9 @@ class SQL92DatabaseMetaDataTest {
void assertGetDefaultNullsOrderType() {
assertThat(dialectDatabaseMetaData.getDefaultNullsOrderType(),
is(NullsOrderType.LOW));
}
+
+ @Test
+ void assertGetFunctionOption() {
+ assertThat(dialectDatabaseMetaData.getFunctionOption(),
isA(SQL92FunctionOption.class));
+ }
}
diff --git
a/database/connector/dialect/sql92/src/test/java/org/apache/shardingsphere/database/connector/sql92/metadata/database/option/SQL92FunctionOptionTest.java
b/database/connector/dialect/sql92/src/test/java/org/apache/shardingsphere/database/connector/sql92/metadata/database/option/SQL92FunctionOptionTest.java
new file mode 100644
index 00000000000..1bfd57bae36
--- /dev/null
+++
b/database/connector/dialect/sql92/src/test/java/org/apache/shardingsphere/database/connector/sql92/metadata/database/option/SQL92FunctionOptionTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+
+package
org.apache.shardingsphere.database.connector.sql92.metadata.database.option;
+
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class SQL92FunctionOptionTest {
+
+ private final SQL92FunctionOption functionOption = new
SQL92FunctionOption();
+
+ @Test
+ void assertGetIfNullFunctionName() {
+ assertThat(functionOption.getIfNullFunctionName(), is("IFNULL"));
+ }
+
+ @Test
+ void assertGetUnparenthesizedFunctionNames() {
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_DATE"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_TIME"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_TIMESTAMP"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_USER"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("SESSION_USER"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("USER"));
+ }
+}
diff --git
a/database/connector/dialect/sqlserver/src/main/java/org/apache/shardingsphere/database/connector/sql92/sqlserver/metadata/database/SQLServerDatabaseMetaData.java
b/database/connector/dialect/sqlserver/src/main/java/org/apache/shardingsphere/database/connector/sql92/sqlserver/metadata/database/SQLServerDatabaseMetaData.java
index 3c614adf0ce..e528545bb96 100644
---
a/database/connector/dialect/sqlserver/src/main/java/org/apache/shardingsphere/database/connector/sql92/sqlserver/metadata/database/SQLServerDatabaseMetaData.java
+++
b/database/connector/dialect/sqlserver/src/main/java/org/apache/shardingsphere/database/connector/sql92/sqlserver/metadata/database/SQLServerDatabaseMetaData.java
@@ -22,10 +22,12 @@ import
org.apache.shardingsphere.database.connector.core.metadata.database.enums
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.DialectDatabaseMetaData;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.IdentifierPatternType;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.altertable.DialectAlterTableOption;
+import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.function.DialectFunctionOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.pagination.DialectPaginationOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.schema.DefaultSchemaOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.schema.DialectSchemaOption;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.transaction.DialectTransactionOption;
+import
org.apache.shardingsphere.database.connector.sql92.sqlserver.metadata.database.option.SQLServerFunctionOption;
import java.sql.Connection;
import java.util.Collections;
@@ -67,6 +69,11 @@ public final class SQLServerDatabaseMetaData implements
DialectDatabaseMetaData
return new DialectPaginationOption(true, "ROW_NUMBER", true);
}
+ @Override
+ public DialectFunctionOption getFunctionOption() {
+ return new SQLServerFunctionOption();
+ }
+
@Override
public Optional<DialectAlterTableOption> getAlterTableOption() {
return Optional.of(new DialectAlterTableOption(true, false));
diff --git
a/database/connector/dialect/sqlserver/src/main/java/org/apache/shardingsphere/database/connector/sql92/sqlserver/metadata/database/option/SQLServerFunctionOption.java
b/database/connector/dialect/sqlserver/src/main/java/org/apache/shardingsphere/database/connector/sql92/sqlserver/metadata/database/option/SQLServerFunctionOption.java
new file mode 100644
index 00000000000..4338f41b46c
--- /dev/null
+++
b/database/connector/dialect/sqlserver/src/main/java/org/apache/shardingsphere/database/connector/sql92/sqlserver/metadata/database/option/SQLServerFunctionOption.java
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+
+package
org.apache.shardingsphere.database.connector.sql92.sqlserver.metadata.database.option;
+
+import com.cedarsoftware.util.CaseInsensitiveSet;
+import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.function.DialectFunctionOption;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+/**
+ * Function option of SQLServer.
+ */
+public final class SQLServerFunctionOption implements DialectFunctionOption {
+
+ // TODO remove ROWNUM, ROWNUM_ and ROW_NUMBER @duanzhengqiang
+ private static final Collection<String> UNPARENTHESIZED_FUNCTION_NAMES =
new CaseInsensitiveSet<>(Arrays.asList(
+ "CURRENT_TIMESTAMP", "CURRENT_USER", "ROWNUM", "ROWNUM_",
"ROW_NUMBER", "SESSION_USER", "SYSTEM_USER", "USER"));
+
+ @Override
+ public String getIfNullFunctionName() {
+ return "IFNULL";
+ }
+
+ @Override
+ public Collection<String> getUnparenthesizedFunctionNames() {
+ return UNPARENTHESIZED_FUNCTION_NAMES;
+ }
+}
diff --git
a/database/connector/dialect/sqlserver/src/test/java/org/apache/shardingsphere/database/connector/sql92/sqlserver/metadata/database/SQLServerDatabaseMetaDataTest.java
b/database/connector/dialect/sqlserver/src/test/java/org/apache/shardingsphere/database/connector/sql92/sqlserver/metadata/database/SQLServerDatabaseMetaDataTest.java
index a71d382f9ee..37e6fff3bf6 100644
---
a/database/connector/dialect/sqlserver/src/test/java/org/apache/shardingsphere/database/connector/sql92/sqlserver/metadata/database/SQLServerDatabaseMetaDataTest.java
+++
b/database/connector/dialect/sqlserver/src/test/java/org/apache/shardingsphere/database/connector/sql92/sqlserver/metadata/database/SQLServerDatabaseMetaDataTest.java
@@ -27,6 +27,7 @@ import
org.apache.shardingsphere.database.connector.core.metadata.database.metad
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.transaction.DialectTransactionOption;
import
org.apache.shardingsphere.database.connector.core.spi.DatabaseTypedSPILoader;
import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import
org.apache.shardingsphere.database.connector.sql92.sqlserver.metadata.database.option.SQLServerFunctionOption;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.junit.jupiter.api.Test;
@@ -34,6 +35,7 @@ import java.sql.Connection;
import java.util.Optional;
import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.isA;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -97,4 +99,9 @@ class SQLServerDatabaseMetaDataTest {
assertTrue(actual.map(DialectAlterTableOption::isSupportMergeDropColumns).orElse(false));
assertFalse(actual.map(DialectAlterTableOption::isContainsParenthesesOnMergeDropColumns).orElse(true));
}
+
+ @Test
+ void assertGetFunctionOption() {
+ assertThat(dialectDatabaseMetaData.getFunctionOption(),
isA(SQLServerFunctionOption.class));
+ }
}
diff --git
a/database/connector/dialect/sqlserver/src/test/java/org/apache/shardingsphere/database/connector/sql92/sqlserver/metadata/database/option/SQLServerFunctionOptionTest.java
b/database/connector/dialect/sqlserver/src/test/java/org/apache/shardingsphere/database/connector/sql92/sqlserver/metadata/database/option/SQLServerFunctionOptionTest.java
new file mode 100644
index 00000000000..65e6b8d8d54
--- /dev/null
+++
b/database/connector/dialect/sqlserver/src/test/java/org/apache/shardingsphere/database/connector/sql92/sqlserver/metadata/database/option/SQLServerFunctionOptionTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+package
org.apache.shardingsphere.database.connector.sql92.sqlserver.metadata.database.option;
+
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class SQLServerFunctionOptionTest {
+
+ private final SQLServerFunctionOption functionOption = new
SQLServerFunctionOption();
+
+ @Test
+ void assertGetIfNullFunctionName() {
+ assertThat(functionOption.getIfNullFunctionName(), is("IFNULL"));
+ }
+
+ @Test
+ void assertGetUnparenthesizedFunctionNames() {
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_TIMESTAMP"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("CURRENT_USER"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("ROWNUM"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("ROWNUM_"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("ROW_NUMBER"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("SESSION_USER"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("SYSTEM_USER"));
+
assertTrue(functionOption.getUnparenthesizedFunctionNames().contains("USER"));
+ }
+}
diff --git
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/segment/dml/expression/type/ColumnSegmentBinder.java
b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/segment/dml/expression/type/ColumnSegmentBinder.java
index eeb3b943d4f..9c0e2f08ac7 100644
---
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/segment/dml/expression/type/ColumnSegmentBinder.java
+++
b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/segment/dml/expression/type/ColumnSegmentBinder.java
@@ -18,7 +18,6 @@
package
org.apache.shardingsphere.infra.binder.engine.segment.dml.expression.type;
import com.cedarsoftware.util.CaseInsensitiveMap.CaseInsensitiveString;
-import com.cedarsoftware.util.CaseInsensitiveSet;
import com.google.common.base.Strings;
import com.google.common.collect.Multimap;
import lombok.AccessLevel;
@@ -26,6 +25,7 @@ import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.RequiredArgsConstructor;
import org.apache.groovy.util.Maps;
+import
org.apache.shardingsphere.database.connector.core.type.DatabaseTypeRegistry;
import org.apache.shardingsphere.infra.binder.engine.segment.SegmentType;
import
org.apache.shardingsphere.infra.binder.engine.segment.dml.from.context.TableSegmentBinderContext;
import
org.apache.shardingsphere.infra.binder.engine.segment.dml.from.context.type.FunctionTableSegmentBinderContext;
@@ -48,7 +48,6 @@ import
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.bound
import
org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -62,9 +61,6 @@ import java.util.Optional;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class ColumnSegmentBinder {
- private static final Collection<String> EXCLUDE_BIND_COLUMNS = new
CaseInsensitiveSet<>(Arrays.asList(
- "ROWNUM", "ROW_NUMBER", "ROWNUM_", "ROWID", "SYSDATE",
"SYSTIMESTAMP", "CURRENT_TIMESTAMP", "LOCALTIMESTAMP", "UID", "USER",
"NEXTVAL", "LEVEL", "DAY"));
-
private static final Map<SegmentType, String> SEGMENT_TYPE_MESSAGES =
Maps.of(SegmentType.PROJECTION, "field list", SegmentType.JOIN_ON, "on clause",
SegmentType.JOIN_USING, "from clause",
SegmentType.PREDICATE, "where clause", SegmentType.HAVING, "having
clause", SegmentType.ORDER_BY, "order clause", SegmentType.GROUP_BY, "group
statement", SegmentType.INSERT_COLUMNS,
"field list");
@@ -84,7 +80,7 @@ public final class ColumnSegmentBinder {
public static ColumnSegment bind(final ColumnSegment segment, final
SegmentType parentSegmentType, final SQLStatementBinderContext binderContext,
final Multimap<CaseInsensitiveString,
TableSegmentBinderContext> tableBinderContexts,
final Multimap<CaseInsensitiveString,
TableSegmentBinderContext> outerTableBinderContexts) {
- if (EXCLUDE_BIND_COLUMNS.contains(segment.getIdentifier().getValue()))
{
+ if (isUnparenthesizedFunction(segment, binderContext)) {
return segment;
}
ColumnSegment result = copy(segment);
@@ -106,6 +102,11 @@ public final class ColumnSegmentBinder {
return result;
}
+ private static boolean isUnparenthesizedFunction(final ColumnSegment
segment, final SQLStatementBinderContext binderContext) {
+ return new
DatabaseTypeRegistry(binderContext.getSqlStatement().getDatabaseType())
+
.getDialectDatabaseMetaData().getFunctionOption().getUnparenthesizedFunctionNames().contains(segment.getIdentifier().getValue());
+ }
+
private static OwnerSegment bindOwnerTableContext(final OwnerSegment
owner, final ColumnSegment inputColumnSegment) {
IdentifierValue originalDatabase = null == inputColumnSegment ? null :
inputColumnSegment.getColumnBoundInfo().getOriginalDatabase();
IdentifierValue originalSchema = null == inputColumnSegment ? null :
inputColumnSegment.getColumnBoundInfo().getOriginalSchema();
diff --git
a/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/segment/dml/assign/AssignmentSegmentBinderTest.java
b/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/segment/dml/assign/AssignmentSegmentBinderTest.java
index cfe5a472f01..afc7125f21b 100644
---
a/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/segment/dml/assign/AssignmentSegmentBinderTest.java
+++
b/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/segment/dml/assign/AssignmentSegmentBinderTest.java
@@ -23,7 +23,12 @@ import com.google.common.collect.Multimap;
import
org.apache.shardingsphere.infra.binder.engine.segment.dml.from.context.TableSegmentBinderContext;
import
org.apache.shardingsphere.infra.binder.engine.segment.dml.from.context.type.SimpleTableSegmentBinderContext;
import
org.apache.shardingsphere.infra.binder.engine.statement.SQLStatementBinderContext;
+import org.apache.shardingsphere.infra.hint.HintValueContext;
+import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import
org.apache.shardingsphere.sql.parser.statement.core.enums.TableSourceType;
+import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dml.SelectStatement;
+import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.assignment.ColumnAssignmentSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.assignment.SetAssignmentSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.column.ColumnSegment;
@@ -42,6 +47,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
class AssignmentSegmentBinderTest {
@@ -57,9 +63,15 @@ class AssignmentSegmentBinderTest {
Multimap<CaseInsensitiveString, TableSegmentBinderContext>
tableBinderContexts = LinkedHashMultimap.create();
tableBinderContexts.put(CaseInsensitiveString.of("t_order"),
new SimpleTableSegmentBinderContext(Collections.singleton(new
ColumnProjectionSegment(boundOrderIdColumn)), TableSourceType.PHYSICAL_TABLE));
- SetAssignmentSegment actual =
AssignmentSegmentBinder.bind(setAssignmentSegment,
mock(SQLStatementBinderContext.class), tableBinderContexts,
LinkedHashMultimap.create());
+ SetAssignmentSegment actual =
AssignmentSegmentBinder.bind(setAssignmentSegment, createBinderContext(),
tableBinderContexts, LinkedHashMultimap.create());
assertThat(actual, not(setAssignmentSegment));
assertThat(actual.getAssignments().iterator().next(),
not(setAssignmentSegment.getAssignments().iterator().next()));
assertThat(actual.getAssignments().iterator().next().getColumns().iterator().next().getColumnBoundInfo().getOriginalTable().getValue(),
is("t_order"));
}
+
+ private SQLStatementBinderContext createBinderContext() {
+ SelectStatement selectStatement = mock(SelectStatement.class);
+
when(selectStatement.getDatabaseType()).thenReturn(TypedSPILoader.getService(DatabaseType.class,
"MySQL"));
+ return new
SQLStatementBinderContext(mock(ShardingSphereMetaData.class), "foo_db", new
HintValueContext(), selectStatement);
+ }
}
diff --git
a/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/segment/dml/expression/type/ColumnSegmentBinderTest.java
b/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/segment/dml/expression/type/ColumnSegmentBinderTest.java
index 9a2c4f8a3dc..13a8d5db80a 100644
---
a/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/segment/dml/expression/type/ColumnSegmentBinderTest.java
+++
b/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/segment/dml/expression/type/ColumnSegmentBinderTest.java
@@ -35,6 +35,8 @@ import
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.bound
import
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.bound.TableSegmentBoundInfo;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dml.SelectStatement;
import
org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
+import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.junit.jupiter.api.Test;
import java.util.Collections;
@@ -46,9 +48,16 @@ import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
class ColumnSegmentBinderTest {
+ private SQLStatementBinderContext createBinderContext() {
+ SelectStatement selectStatement = mock(SelectStatement.class);
+
when(selectStatement.getDatabaseType()).thenReturn(TypedSPILoader.getService(DatabaseType.class,
"MySQL"));
+ return new
SQLStatementBinderContext(mock(ShardingSphereMetaData.class), "foo_db", new
HintValueContext(), selectStatement);
+ }
+
@Test
void assertBindWithMultiTablesJoinAndNoOwner() {
Multimap<CaseInsensitiveString, TableSegmentBinderContext>
tableBinderContexts = LinkedHashMultimap.create();
@@ -63,7 +72,7 @@ class ColumnSegmentBinderTest {
tableBinderContexts.put(CaseInsensitiveString.of("t_order_item"),
new SimpleTableSegmentBinderContext(Collections.singleton(new
ColumnProjectionSegment(boundItemIdColumn)), TableSourceType.PHYSICAL_TABLE));
ColumnSegment columnSegment = new ColumnSegment(0, 0, new
IdentifierValue("order_id"));
- SQLStatementBinderContext binderContext = new
SQLStatementBinderContext(mock(ShardingSphereMetaData.class), "foo_db", new
HintValueContext(), mock(SelectStatement.class));
+ SQLStatementBinderContext binderContext = createBinderContext();
ColumnSegment actual = ColumnSegmentBinder.bind(columnSegment,
SegmentType.JOIN_ON, binderContext, tableBinderContexts,
LinkedHashMultimap.create());
assertNotNull(actual.getColumnBoundInfo());
assertNull(actual.getOtherUsingColumnBoundInfo());
@@ -86,7 +95,7 @@ class ColumnSegmentBinderTest {
new IdentifierValue("t_order_item"), new
IdentifierValue("status"), TableSourceType.PHYSICAL_TABLE));
outerTableBinderContexts.put(CaseInsensitiveString.of("t_order_item"),
new SimpleTableSegmentBinderContext(Collections.singleton(new
ColumnProjectionSegment(boundOrderItemStatusColumn)),
TableSourceType.PHYSICAL_TABLE));
- SQLStatementBinderContext binderContext = new
SQLStatementBinderContext(mock(ShardingSphereMetaData.class), "foo_db", new
HintValueContext(), mock(SelectStatement.class));
+ SQLStatementBinderContext binderContext = createBinderContext();
ColumnSegment columnSegment = new ColumnSegment(0, 0, new
IdentifierValue("status"));
ColumnSegment actual = ColumnSegmentBinder.bind(columnSegment,
SegmentType.PROJECTION, binderContext, LinkedHashMultimap.create(),
outerTableBinderContexts);
assertNotNull(actual.getColumnBoundInfo());
@@ -110,7 +119,7 @@ class ColumnSegmentBinderTest {
new IdentifierValue("t_order_item"), new
IdentifierValue("status"), TableSourceType.PHYSICAL_TABLE));
tableBinderContexts.put(CaseInsensitiveString.of("temp"),
new SimpleTableSegmentBinderContext(Collections.singleton(new
ColumnProjectionSegment(boundOrderItemColumn)),
TableSourceType.PHYSICAL_TABLE));
- SQLStatementBinderContext binderContext = new
SQLStatementBinderContext(mock(ShardingSphereMetaData.class), "foo_db", new
HintValueContext(), mock(SelectStatement.class));
+ SQLStatementBinderContext binderContext = createBinderContext();
ColumnSegment columnSegment = new ColumnSegment(0, 0, new
IdentifierValue("status"));
columnSegment.setOwner(new OwnerSegment(0, 0, new
IdentifierValue("temp")));
assertThrows(AmbiguousColumnException.class, () ->
ColumnSegmentBinder.bind(columnSegment, SegmentType.PROJECTION, binderContext,
tableBinderContexts, LinkedHashMultimap.create()));
@@ -129,7 +138,7 @@ class ColumnSegmentBinderTest {
new IdentifierValue("t_order_item"), new
IdentifierValue("status"), TableSourceType.PHYSICAL_TABLE));
tableBinderContexts.put(CaseInsensitiveString.of("temp"),
new SimpleTableSegmentBinderContext(Collections.singleton(new
ColumnProjectionSegment(boundOrderItemColumn)),
TableSourceType.PHYSICAL_TABLE));
- SQLStatementBinderContext binderContext = new
SQLStatementBinderContext(mock(ShardingSphereMetaData.class), "foo_db", new
HintValueContext(), mock(SelectStatement.class));
+ SQLStatementBinderContext binderContext = createBinderContext();
ColumnSegment columnSegment = new ColumnSegment(0, 0, new
IdentifierValue("status"));
columnSegment.setOwner(new OwnerSegment(0, 0, new
IdentifierValue("temp")));
ColumnSegment actual = ColumnSegmentBinder.bind(columnSegment,
SegmentType.PROJECTION, binderContext, tableBinderContexts,
LinkedHashMultimap.create());
@@ -156,7 +165,7 @@ class ColumnSegmentBinderTest {
new SimpleTableSegmentBinderContext(Collections.singleton(new
ColumnProjectionSegment(boundItemIdColumn)), TableSourceType.PHYSICAL_TABLE));
ColumnSegment columnSegment = new ColumnSegment(0, 0, new
IdentifierValue("order_id"));
columnSegment.setOwner(new OwnerSegment(0, 0, new
IdentifierValue("t_order")));
- SQLStatementBinderContext binderContext = new
SQLStatementBinderContext(mock(ShardingSphereMetaData.class), "foo_db", new
HintValueContext(), mock(SelectStatement.class));
+ SQLStatementBinderContext binderContext = createBinderContext();
ColumnSegment actual = ColumnSegmentBinder.bind(columnSegment,
SegmentType.JOIN_ON, binderContext, tableBinderContexts,
LinkedHashMultimap.create());
assertTrue(actual.getOwner().isPresent());
assertTrue(actual.getOwner().get().getTableBoundInfo().isPresent());
diff --git
a/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/segment/dml/expression/type/OuterJoinExpressionBinderTest.java
b/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/segment/dml/expression/type/OuterJoinExpressionBinderTest.java
index 052af1fe8fd..0d337db5b31 100644
---
a/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/segment/dml/expression/type/OuterJoinExpressionBinderTest.java
+++
b/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/segment/dml/expression/type/OuterJoinExpressionBinderTest.java
@@ -24,6 +24,8 @@ import
org.apache.shardingsphere.infra.binder.engine.segment.SegmentType;
import
org.apache.shardingsphere.infra.binder.engine.segment.dml.from.context.TableSegmentBinderContext;
import
org.apache.shardingsphere.infra.binder.engine.segment.dml.from.context.type.SimpleTableSegmentBinderContext;
import
org.apache.shardingsphere.infra.binder.engine.statement.SQLStatementBinderContext;
+import org.apache.shardingsphere.infra.hint.HintValueContext;
+import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import
org.apache.shardingsphere.sql.parser.statement.core.enums.TableSourceType;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.column.ColumnSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.item.ColumnProjectionSegment;
@@ -31,7 +33,10 @@ import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.join.Oute
import
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.OwnerSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.bound.ColumnSegmentBoundInfo;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.bound.TableSegmentBoundInfo;
+import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dml.SelectStatement;
import
org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
+import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.junit.jupiter.api.Test;
import java.util.Collections;
@@ -39,6 +44,7 @@ import java.util.Collections;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
class OuterJoinExpressionBinderTest {
@@ -55,11 +61,17 @@ class OuterJoinExpressionBinderTest {
column.setOwner(new OwnerSegment(0, 0, new
IdentifierValue("t_order")));
OuterJoinExpression originalExpression = new OuterJoinExpression(0, 0,
column, "+", "t_order.order_id(+)");
OuterJoinExpression actual = OuterJoinExpressionBinder.bind(
- originalExpression, SegmentType.PREDICATE,
mock(SQLStatementBinderContext.class), tableBinderContexts,
LinkedHashMultimap.create());
+ originalExpression, SegmentType.PREDICATE,
createBinderContext(), tableBinderContexts, LinkedHashMultimap.create());
assertThat(actual.getStartIndex(),
is(originalExpression.getStartIndex()));
assertThat(actual.getStopIndex(),
is(originalExpression.getStopIndex()));
assertThat(actual.getColumnName().getIdentifier().getValue(),
is("order_id"));
assertThat(actual.getJoinOperator(), is("+"));
assertThat(actual.getText(), is("t_order.order_id(+)"));
}
+
+ private SQLStatementBinderContext createBinderContext() {
+ SelectStatement selectStatement = mock(SelectStatement.class);
+
when(selectStatement.getDatabaseType()).thenReturn(TypedSPILoader.getService(DatabaseType.class,
"MySQL"));
+ return new
SQLStatementBinderContext(mock(ShardingSphereMetaData.class), "foo_db", new
HintValueContext(), selectStatement);
+ }
}