This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang 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 530515d9aed Fix mysql jdbc and proxy side boolean type queries in
federated queries (#30503)
530515d9aed is described below
commit 530515d9aedb6b83f2076b09d49bce874cfde1b0
Author: niu niu <[email protected]>
AuthorDate: Thu Mar 21 09:11:14 2024 +0800
Fix mysql jdbc and proxy side boolean type queries in federated queries
(#30503)
* Fix mysql jdbc and proxy side boolean type queries in federated queries
* Format code
* Add sql federation column type converter spi
---
.../spi/SQLFederationColumnTypeConverter.java | 44 +++++++++++++++++++
.../resultset/SQLFederationResultSet.java | 7 ++-
.../resultset/SQLFederationResultSetMetaData.java | 14 +++++-
.../converter/MySQLColumnTypeConverter.java | 50 ++++++++++++++++++++++
.../converter/OpenGaussColumnTypeConverter.java | 43 +++++++++++++++++++
.../converter/OracleColumnTypeConverter.java | 43 +++++++++++++++++++
.../converter/PostgreSQLColumnTypeConverter.java | 43 +++++++++++++++++++
...federation.spi.SQLFederationColumnTypeConverter | 21 +++++++++
.../resultset/SQLFederationResultSetTest.java | 2 +
.../SQLFederationColumnTypeConverterFixture.java | 40 +++++++++++++++++
...federation.spi.SQLFederationColumnTypeConverter | 18 ++++++++
.../resources/cases/dql/dql-integration-select.xml | 12 ++++++
12 files changed, 334 insertions(+), 3 deletions(-)
diff --git
a/kernel/sql-federation/api/src/main/java/org/apache/shardingsphere/sqlfederation/spi/SQLFederationColumnTypeConverter.java
b/kernel/sql-federation/api/src/main/java/org/apache/shardingsphere/sqlfederation/spi/SQLFederationColumnTypeConverter.java
new file mode 100644
index 00000000000..9297445e7e3
--- /dev/null
+++
b/kernel/sql-federation/api/src/main/java/org/apache/shardingsphere/sqlfederation/spi/SQLFederationColumnTypeConverter.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.sqlfederation.spi;
+
+import org.apache.shardingsphere.infra.database.core.spi.DatabaseTypedSPI;
+
+import java.util.Optional;
+
+/**
+ * SQL federation column type convert.
+ */
+public interface SQLFederationColumnTypeConverter extends DatabaseTypedSPI {
+
+ /**
+ * Transforming the column results of a federated query.
+ *
+ * @param columnValue column value
+ * @return convert column value result
+ */
+ Optional<Object> convertColumnValue(Object columnValue);
+
+ /**
+ * Converting the column types of a federated query.
+ *
+ * @param columnType column type
+ * @return convert column type result
+ */
+ Optional<Integer> convertColumnType(Integer columnType);
+}
diff --git
a/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/SQLFederationResultSet.java
b/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/SQLFederationResultSet.java
index 84b2fedab14..9f6b1caea58 100644
---
a/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/SQLFederationResultSet.java
+++
b/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/SQLFederationResultSet.java
@@ -23,9 +23,11 @@ import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.schema.Schema;
import
org.apache.shardingsphere.infra.binder.context.segment.select.projection.Projection;
import
org.apache.shardingsphere.infra.binder.context.statement.dml.SelectStatementContext;
+import
org.apache.shardingsphere.infra.database.core.spi.DatabaseTypedSPILoader;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import
org.apache.shardingsphere.infra.executor.sql.execute.result.query.impl.driver.jdbc.type.util.ResultSetUtils;
import
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema;
+import
org.apache.shardingsphere.sqlfederation.spi.SQLFederationColumnTypeConverter;
import java.io.InputStream;
import java.io.Reader;
@@ -69,6 +71,8 @@ public final class SQLFederationResultSet extends
AbstractUnsupportedOperationRe
private final SQLFederationResultSetMetaData resultSetMetaData;
+ private final SQLFederationColumnTypeConverter
sqlFederationColumnTypeConverter;
+
private Object[] currentRows;
private boolean wasNull;
@@ -78,6 +82,7 @@ public final class SQLFederationResultSet extends
AbstractUnsupportedOperationRe
public SQLFederationResultSet(final Enumerator<Object> enumerator, final
ShardingSphereSchema schema, final Schema sqlFederationSchema,
final SelectStatementContext
selectStatementContext, final RelDataType resultColumnType) {
this.enumerator = enumerator;
+ this.sqlFederationColumnTypeConverter =
DatabaseTypedSPILoader.getService(SQLFederationColumnTypeConverter.class,
selectStatementContext.getDatabaseType());
columnLabelAndIndexes = new
CaseInsensitiveMap<>(selectStatementContext.getProjectionsContext().getExpandProjections().size(),
1F);
Map<Integer, String> indexAndColumnLabels = new
CaseInsensitiveMap<>(selectStatementContext.getProjectionsContext().getExpandProjections().size(),
1F);
handleColumnLabelAndIndex(columnLabelAndIndexes, indexAndColumnLabels,
selectStatementContext);
@@ -464,7 +469,7 @@ public final class SQLFederationResultSet extends
AbstractUnsupportedOperationRe
ShardingSpherePreconditions.checkState(!INVALID_FEDERATION_TYPES.contains(type),
() -> new SQLFeatureNotSupportedException(String.format("Get value from `%s`",
type.getName())));
Object result = currentRows[columnIndex - 1];
wasNull = null == result;
- return result;
+ return
sqlFederationColumnTypeConverter.convertColumnValue(result).orElse(result);
}
private Object getCalendarValue(final int columnIndex) {
diff --git
a/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/SQLFederationResultSetMetaData.java
b/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/SQLFederationResultSetMetaData.java
index a91af4933a9..20d6cf5da6c 100644
---
a/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/SQLFederationResultSetMetaData.java
+++
b/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/SQLFederationResultSetMetaData.java
@@ -22,11 +22,14 @@ import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.rel.type.RelDataTypeFactory;
import org.apache.calcite.schema.Schema;
import org.apache.calcite.schema.Table;
+import org.apache.calcite.sql.type.SqlTypeName;
import
org.apache.shardingsphere.infra.binder.context.segment.select.projection.Projection;
import
org.apache.shardingsphere.infra.binder.context.segment.select.projection.impl.ColumnProjection;
import
org.apache.shardingsphere.infra.binder.context.statement.dml.SelectStatementContext;
import org.apache.shardingsphere.infra.database.core.DefaultDatabase;
+import
org.apache.shardingsphere.infra.database.core.spi.DatabaseTypedSPILoader;
import
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema;
+import
org.apache.shardingsphere.sqlfederation.spi.SQLFederationColumnTypeConverter;
import java.sql.ResultSetMetaData;
import java.util.List;
@@ -50,6 +53,8 @@ public final class SQLFederationResultSetMetaData extends
WrapperAdapter impleme
private final Map<Integer, String> indexAndColumnLabels;
+ private final SQLFederationColumnTypeConverter
sqlFederationColumnTypeConverter;
+
public SQLFederationResultSetMetaData(final ShardingSphereSchema schema,
final Schema sqlFederationSchema,
final SelectStatementContext
selectStatementContext, final RelDataType resultColumnType, final Map<Integer,
String> indexAndColumnLabels) {
this.schema = schema;
@@ -58,6 +63,7 @@ public final class SQLFederationResultSetMetaData extends
WrapperAdapter impleme
this.selectStatementContext = selectStatementContext;
this.resultColumnType = resultColumnType;
this.indexAndColumnLabels = indexAndColumnLabels;
+ this.sqlFederationColumnTypeConverter =
DatabaseTypedSPILoader.getService(SQLFederationColumnTypeConverter.class,
selectStatementContext.getDatabaseType());
}
@Override
@@ -147,12 +153,16 @@ public final class SQLFederationResultSetMetaData extends
WrapperAdapter impleme
@Override
public int getColumnType(final int column) {
- return resultColumnType.getFieldList().get(column -
1).getType().getSqlTypeName().getJdbcOrdinal();
+ int jdbcType = resultColumnType.getFieldList().get(column -
1).getType().getSqlTypeName().getJdbcOrdinal();
+ return
sqlFederationColumnTypeConverter.convertColumnType(jdbcType).orElse(jdbcType);
}
@Override
public String getColumnTypeName(final int column) {
- return resultColumnType.getFieldList().get(column -
1).getType().getSqlTypeName().getName();
+ SqlTypeName originalSqlTypeName =
resultColumnType.getFieldList().get(column - 1).getType().getSqlTypeName();
+ SqlTypeName convertSqlTypeName =
+
SqlTypeName.getNameForJdbcType(sqlFederationColumnTypeConverter.convertColumnType(originalSqlTypeName.getJdbcOrdinal()).orElse(originalSqlTypeName.getJdbcOrdinal()));
+ return null == convertSqlTypeName ? originalSqlTypeName.getName() :
convertSqlTypeName.getName();
}
@Override
diff --git
a/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/converter/MySQLColumnTypeConverter.java
b/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/converter/MySQLColumnTypeConverter.java
new file mode 100644
index 00000000000..bde5c78a703
--- /dev/null
+++
b/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/converter/MySQLColumnTypeConverter.java
@@ -0,0 +1,50 @@
+/*
+ * 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.sqlfederation.resultset.converter;
+
+import org.apache.calcite.sql.type.SqlTypeName;
+import
org.apache.shardingsphere.sqlfederation.spi.SQLFederationColumnTypeConverter;
+
+import java.util.Optional;
+
+/**
+ * MySQL column type converter.
+ */
+public final class MySQLColumnTypeConverter implements
SQLFederationColumnTypeConverter {
+
+ @Override
+ public Optional<Object> convertColumnValue(final Object columnValue) {
+ if (columnValue instanceof Boolean) {
+ return Optional.of((Boolean) columnValue ? 1 : 0);
+ }
+ return Optional.empty();
+ }
+
+ @Override
+ public Optional<Integer> convertColumnType(final Integer columnType) {
+ if (SqlTypeName.BOOLEAN.getJdbcOrdinal() == columnType) {
+ return Optional.of(SqlTypeName.BIGINT.getJdbcOrdinal());
+ }
+ return Optional.empty();
+ }
+
+ @Override
+ public String getDatabaseType() {
+ return "MySQL";
+ }
+}
diff --git
a/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/converter/OpenGaussColumnTypeConverter.java
b/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/converter/OpenGaussColumnTypeConverter.java
new file mode 100644
index 00000000000..31bf8e10a5d
--- /dev/null
+++
b/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/converter/OpenGaussColumnTypeConverter.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.sqlfederation.resultset.converter;
+
+import
org.apache.shardingsphere.sqlfederation.spi.SQLFederationColumnTypeConverter;
+
+import java.util.Optional;
+
+/**
+ * OpenGauss column type converter.
+ */
+public final class OpenGaussColumnTypeConverter implements
SQLFederationColumnTypeConverter {
+
+ @Override
+ public Optional<Object> convertColumnValue(final Object columnValue) {
+ return Optional.empty();
+ }
+
+ @Override
+ public Optional<Integer> convertColumnType(final Integer columnType) {
+ return Optional.empty();
+ }
+
+ @Override
+ public String getDatabaseType() {
+ return "openGauss";
+ }
+}
diff --git
a/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/converter/OracleColumnTypeConverter.java
b/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/converter/OracleColumnTypeConverter.java
new file mode 100644
index 00000000000..f9a1b436f2b
--- /dev/null
+++
b/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/converter/OracleColumnTypeConverter.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.sqlfederation.resultset.converter;
+
+import
org.apache.shardingsphere.sqlfederation.spi.SQLFederationColumnTypeConverter;
+
+import java.util.Optional;
+
+/**
+ * Oracle column type converter.
+ */
+public final class OracleColumnTypeConverter implements
SQLFederationColumnTypeConverter {
+
+ @Override
+ public Optional<Object> convertColumnValue(final Object columnValue) {
+ return Optional.empty();
+ }
+
+ @Override
+ public Optional<Integer> convertColumnType(final Integer columnType) {
+ return Optional.empty();
+ }
+
+ @Override
+ public String getDatabaseType() {
+ return "Oracle";
+ }
+}
diff --git
a/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/converter/PostgreSQLColumnTypeConverter.java
b/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/converter/PostgreSQLColumnTypeConverter.java
new file mode 100644
index 00000000000..41647d4dd9d
--- /dev/null
+++
b/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/converter/PostgreSQLColumnTypeConverter.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.sqlfederation.resultset.converter;
+
+import
org.apache.shardingsphere.sqlfederation.spi.SQLFederationColumnTypeConverter;
+
+import java.util.Optional;
+
+/**
+ * PostgreSQL column type converter.
+ */
+public final class PostgreSQLColumnTypeConverter implements
SQLFederationColumnTypeConverter {
+
+ @Override
+ public Optional<Object> convertColumnValue(final Object columnValue) {
+ return Optional.empty();
+ }
+
+ @Override
+ public Optional<Integer> convertColumnType(final Integer columnType) {
+ return Optional.empty();
+ }
+
+ @Override
+ public String getDatabaseType() {
+ return "PostgreSQL";
+ }
+}
diff --git
a/kernel/sql-federation/core/src/main/resources/META-INF/services/org.apache.shardingsphere.sqlfederation.spi.SQLFederationColumnTypeConverter
b/kernel/sql-federation/core/src/main/resources/META-INF/services/org.apache.shardingsphere.sqlfederation.spi.SQLFederationColumnTypeConverter
new file mode 100644
index 00000000000..3c1898d3a1f
--- /dev/null
+++
b/kernel/sql-federation/core/src/main/resources/META-INF/services/org.apache.shardingsphere.sqlfederation.spi.SQLFederationColumnTypeConverter
@@ -0,0 +1,21 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+org.apache.shardingsphere.sqlfederation.resultset.converter.MySQLColumnTypeConverter
+org.apache.shardingsphere.sqlfederation.resultset.converter.OracleColumnTypeConverter
+org.apache.shardingsphere.sqlfederation.resultset.converter.OpenGaussColumnTypeConverter
+org.apache.shardingsphere.sqlfederation.resultset.converter.PostgreSQLColumnTypeConverter
diff --git
a/kernel/sql-federation/core/src/test/java/org/apache/shardingsphere/sqlfederation/resultset/SQLFederationResultSetTest.java
b/kernel/sql-federation/core/src/test/java/org/apache/shardingsphere/sqlfederation/resultset/SQLFederationResultSetTest.java
index a305ec13997..d6ef527980b 100644
---
a/kernel/sql-federation/core/src/test/java/org/apache/shardingsphere/sqlfederation/resultset/SQLFederationResultSetTest.java
+++
b/kernel/sql-federation/core/src/test/java/org/apache/shardingsphere/sqlfederation/resultset/SQLFederationResultSetTest.java
@@ -25,6 +25,7 @@ import
org.apache.shardingsphere.infra.binder.context.segment.table.TablesContex
import
org.apache.shardingsphere.infra.binder.context.statement.dml.SelectStatementContext;
import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
import
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import
org.apache.shardingsphere.sqlfederation.optimizer.metadata.schema.SQLFederationSchema;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
@@ -80,6 +81,7 @@ class SQLFederationResultSetTest {
TablesContext tablesContext = mock(TablesContext.class);
when(tablesContext.getTableNames()).thenReturn(Collections.emptyList());
when(result.getTablesContext()).thenReturn(tablesContext);
+
when(result.getDatabaseType()).thenReturn(TypedSPILoader.getService(DatabaseType.class,
"FIXTURE"));
return result;
}
diff --git
a/kernel/sql-federation/core/src/test/java/org/apache/shardingsphere/sqlfederation/resultset/fixture/converter/SQLFederationColumnTypeConverterFixture.java
b/kernel/sql-federation/core/src/test/java/org/apache/shardingsphere/sqlfederation/resultset/fixture/converter/SQLFederationColumnTypeConverterFixture.java
new file mode 100644
index 00000000000..af393b2c996
--- /dev/null
+++
b/kernel/sql-federation/core/src/test/java/org/apache/shardingsphere/sqlfederation/resultset/fixture/converter/SQLFederationColumnTypeConverterFixture.java
@@ -0,0 +1,40 @@
+/*
+ * 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.sqlfederation.resultset.fixture.converter;
+
+import
org.apache.shardingsphere.sqlfederation.spi.SQLFederationColumnTypeConverter;
+
+import java.util.Optional;
+
+public final class SQLFederationColumnTypeConverterFixture implements
SQLFederationColumnTypeConverter {
+
+ @Override
+ public Optional<Object> convertColumnValue(final Object columnValue) {
+ return Optional.empty();
+ }
+
+ @Override
+ public Optional<Integer> convertColumnType(final Integer columnType) {
+ return Optional.empty();
+ }
+
+ @Override
+ public String getDatabaseType() {
+ return "FIXTURE";
+ }
+}
diff --git
a/kernel/sql-federation/core/src/test/resources/META-INF/services/org.apache.shardingsphere.sqlfederation.spi.SQLFederationColumnTypeConverter
b/kernel/sql-federation/core/src/test/resources/META-INF/services/org.apache.shardingsphere.sqlfederation.spi.SQLFederationColumnTypeConverter
new file mode 100644
index 00000000000..be5ddc4baa6
--- /dev/null
+++
b/kernel/sql-federation/core/src/test/resources/META-INF/services/org.apache.shardingsphere.sqlfederation.spi.SQLFederationColumnTypeConverter
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+org.apache.shardingsphere.sqlfederation.resultset.fixture.converter.SQLFederationColumnTypeConverterFixture
diff --git
a/test/e2e/sql/src/test/resources/cases/dql/dql-integration-select.xml
b/test/e2e/sql/src/test/resources/cases/dql/dql-integration-select.xml
index 2d80a0016d0..3de0a3e7b5f 100644
--- a/test/e2e/sql/src/test/resources/cases/dql/dql-integration-select.xml
+++ b/test/e2e/sql/src/test/resources/cases/dql/dql-integration-select.xml
@@ -24,6 +24,18 @@
<test-case sql="SELECT 1 as a" db-types="PostgreSQL,openGauss"
scenario-types="db,dbtbl_with_readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt,empty_rules,encrypt,encrypt_and_readwrite_splitting,encrypt_shadow,mask,mask_encrypt,mask_encrypt_sharding,mask_sharding,passthrough,rdl_empty_rules,readwrite_splitting,readwrite_splitting_and_shadow,shadow,sharding_and_encrypt,sharding_and_shadow,sharding_encrypt_shadow,tbl"
>
<assertion />
</test-case>
+
+ <test-case sql="SELECT 1=1, 1!=1" db-types="MySQL"
scenario-types="db_tbl_sql_federation" >
+ <assertion />
+ </test-case>
+
+ <test-case sql="SELECT 1=1, 1!=1, 1>1, 1<1, 1>=1, 1<=1"
db-types="MySQL" scenario-types="db_tbl_sql_federation" >
+ <assertion />
+ </test-case>
+
+ <test-case sql="SELECT count(*) > 0 from t_order" db-types="MySQL"
scenario-types="db_tbl_sql_federation" >
+ <assertion expected-data-source-name="read_dataset" />
+ </test-case>
<test-case sql="SELECT t_order.* FROM t_order t_order WHERE user_id = ?
AND order_id = ?"
scenario-types="db,tbl,dbtbl_with_readwrite_splitting,readwrite_splitting">
<assertion parameters="10:int, 1000:int"
expected-data-source-name="read_dataset" />