xuzifu666 commented on code in PR #4756: URL: https://github.com/apache/calcite/pull/4756#discussion_r2710726363
########## redis/src/test/java/org/apache/calcite/adapter/redis/RedisAdapterConfigCaseBase.java: ########## @@ -0,0 +1,202 @@ +/* + * 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.calcite.adapter.redis; + +import org.apache.calcite.config.CalciteSystemProperty; +import org.apache.calcite.test.CalciteAssert; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +import org.junit.jupiter.api.Test; + +import redis.clients.jedis.Protocol; + +import static org.junit.jupiter.api.Assertions.assertNotNull; + +/** + * Tests for the {@code org.apache.calcite.adapter.redis} package. + */ +public class RedisAdapterConfigCaseBase extends RedisAdapterCaseBase { Review Comment: This is a minor fix. Is it possible to directly test all cases using a test method in ```RedisAdapterCaseBase```? Of course, these comments are necessary. ########## redis/src/main/java/org/apache/calcite/adapter/redis/RedisSchema.java: ########## @@ -86,10 +87,15 @@ public RedisTableFieldInfo getTableFieldInfo(String tableName) { if (jsonCustomTable.name.equals(tableName)) { Map<String, Object> map = requireNonNull(jsonCustomTable.operand, "operand"); - if (map.get("dataFormat") == null) { + if (ObjectUtils.isEmpty(map.get("dataFormat"))) { throw new RuntimeException("dataFormat is null"); Review Comment: Exception messages should be consistent and clear. It's recommended to keep them the same as the messages below(line 94), for example: "dataFormat is null, it must be raw, csv, or json". ########## redis/src/main/java/org/apache/calcite/adapter/redis/RedisSchema.java: ########## @@ -86,10 +87,15 @@ public RedisTableFieldInfo getTableFieldInfo(String tableName) { if (jsonCustomTable.name.equals(tableName)) { Map<String, Object> map = requireNonNull(jsonCustomTable.operand, "operand"); - if (map.get("dataFormat") == null) { + if (ObjectUtils.isEmpty(map.get("dataFormat"))) { Review Comment: This class contains some hard-coded variables, such as ```dataFormat```, ```fields```, and ```keyDelimiter```. It is recommended to modify these to final constants for easier maintenance by future developers. -- 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]
