strongduanmu commented on code in PR #27331:
URL: https://github.com/apache/shardingsphere/pull/27331#discussion_r1271450407


##########
infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/segment/select/projection/util/ProjectionUtilsTest.java:
##########
@@ -0,0 +1,64 @@
+/*
+ * 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.infra.binder.segment.select.projection.util;
+
+import org.apache.shardingsphere.infra.database.mysql.MySQLDatabaseType;
+import 
org.apache.shardingsphere.infra.database.opengauss.OpenGaussDatabaseType;
+import org.apache.shardingsphere.infra.database.oracle.OracleDatabaseType;
+import 
org.apache.shardingsphere.infra.database.postgresql.PostgreSQLDatabaseType;
+import org.apache.shardingsphere.infra.database.spi.DatabaseType;
+import org.apache.shardingsphere.infra.util.quote.QuoteCharacter;
+import 
org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+
+public class ProjectionUtilsTest {

Review Comment:
   Please remove public modifier for ProjectionUtilsTest.



##########
infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/segment/select/projection/util/ProjectionUtilsTest.java:
##########
@@ -0,0 +1,64 @@
+/*
+ * 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.infra.binder.segment.select.projection.util;
+
+import org.apache.shardingsphere.infra.database.mysql.MySQLDatabaseType;
+import 
org.apache.shardingsphere.infra.database.opengauss.OpenGaussDatabaseType;
+import org.apache.shardingsphere.infra.database.oracle.OracleDatabaseType;
+import 
org.apache.shardingsphere.infra.database.postgresql.PostgreSQLDatabaseType;
+import org.apache.shardingsphere.infra.database.spi.DatabaseType;
+import org.apache.shardingsphere.infra.util.quote.QuoteCharacter;
+import 
org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+
+public class ProjectionUtilsTest {
+    
+    @Test
+    void assertGetColumnLabelFromAlias() {
+        IdentifierValue alias = null;
+        DatabaseType databaseType = null;
+        alias = new IdentifierValue("Data", QuoteCharacter.NONE);
+        assertThat(ProjectionUtils.getColumnLabelFromAlias(alias, 
databaseType), is(alias.getValue()));

Review Comment:
   Can you remove alias and new IdentifierValue here directly?



##########
infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/segment/select/projection/util/ProjectionUtilsTest.java:
##########
@@ -0,0 +1,64 @@
+/*
+ * 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.infra.binder.segment.select.projection.util;
+
+import org.apache.shardingsphere.infra.database.mysql.MySQLDatabaseType;
+import 
org.apache.shardingsphere.infra.database.opengauss.OpenGaussDatabaseType;
+import org.apache.shardingsphere.infra.database.oracle.OracleDatabaseType;
+import 
org.apache.shardingsphere.infra.database.postgresql.PostgreSQLDatabaseType;
+import org.apache.shardingsphere.infra.database.spi.DatabaseType;
+import org.apache.shardingsphere.infra.util.quote.QuoteCharacter;
+import 
org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+
+public class ProjectionUtilsTest {
+    
+    @Test
+    void assertGetColumnLabelFromAlias() {
+        IdentifierValue alias = null;
+        DatabaseType databaseType = null;
+        alias = new IdentifierValue("Data", QuoteCharacter.NONE);
+        assertThat(ProjectionUtils.getColumnLabelFromAlias(alias, 
databaseType), is(alias.getValue()));
+        alias = new IdentifierValue("Data");
+        databaseType = new PostgreSQLDatabaseType();

Review Comment:
   Same suggestion with databaseType.



##########
infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/segment/select/projection/util/ProjectionUtilsTest.java:
##########
@@ -0,0 +1,64 @@
+/*
+ * 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.infra.binder.segment.select.projection.util;
+
+import org.apache.shardingsphere.infra.database.mysql.MySQLDatabaseType;
+import 
org.apache.shardingsphere.infra.database.opengauss.OpenGaussDatabaseType;
+import org.apache.shardingsphere.infra.database.oracle.OracleDatabaseType;
+import 
org.apache.shardingsphere.infra.database.postgresql.PostgreSQLDatabaseType;
+import org.apache.shardingsphere.infra.database.spi.DatabaseType;
+import org.apache.shardingsphere.infra.util.quote.QuoteCharacter;
+import 
org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+
+public class ProjectionUtilsTest {
+    
+    @Test
+    void assertGetColumnLabelFromAlias() {
+        IdentifierValue alias = null;
+        DatabaseType databaseType = null;
+        alias = new IdentifierValue("Data", QuoteCharacter.NONE);
+        assertThat(ProjectionUtils.getColumnLabelFromAlias(alias, 
databaseType), is(alias.getValue()));
+        alias = new IdentifierValue("Data");
+        databaseType = new PostgreSQLDatabaseType();
+        assertThat(ProjectionUtils.getColumnLabelFromAlias(alias, 
databaseType), is(alias.getValue().toLowerCase()));

Review Comment:
   Can you change expected string to constant?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to