Skip to content

Commit c2b07ad

Browse files
committed
Fix CI
1 parent ed42808 commit c2b07ad

3 files changed

Lines changed: 33 additions & 29 deletions

File tree

kvrocks/src/main/java/org/apache/calcite/adapter/kvrocks/KvrocksDataProcess.java

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.util.List;
2626

2727
import redis.clients.jedis.Jedis;
28+
import redis.clients.jedis.StreamEntry;
2829
import redis.clients.jedis.StreamEntryID;
2930

3031
import static java.util.Objects.requireNonNull;
@@ -52,11 +53,12 @@ public class KvrocksDataProcess {
5253
this.fields = fieldInfo.getFields();
5354

5455
String type = jedis.type(tableName);
55-
this.dataType = requireNonNull(KvrocksDataType.fromTypeName(type),
56-
() -> "unsupported Kvrocks data type: " + type);
57-
this.dataFormat = requireNonNull(
58-
KvrocksDataFormat.fromTypeName(fieldInfo.getDataFormat()),
59-
() -> "unsupported data format: " + fieldInfo.getDataFormat());
56+
this.dataType =
57+
requireNonNull(KvrocksDataType.fromTypeName(type));
58+
this.dataFormat =
59+
requireNonNull(
60+
KvrocksDataFormat.fromTypeName(
61+
fieldInfo.getDataFormat()));
6062

6163
this.objectMapper = new ObjectMapper();
6264
objectMapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
@@ -99,17 +101,19 @@ private List<Object[]> readString() {
99101
/** Reads entries from a Kvrocks Stream via XRANGE. */
100102
private List<Object[]> readStream() {
101103
List<Object[]> rows = new ArrayList<>();
102-
jedis.xrange(tableName, (StreamEntryID) null, (StreamEntryID) null,
103-
Integer.MAX_VALUE).forEach(entry -> {
104-
// Each stream entry has an ID and a map of field-value pairs.
105-
// We serialize the map as a JSON string and parse it.
104+
List<StreamEntry> entries =
105+
jedis.xrange(tableName, (StreamEntryID) null,
106+
(StreamEntryID) null, Integer.MAX_VALUE);
107+
for (StreamEntry entry : entries) {
106108
try {
107-
String json = objectMapper.writeValueAsString(entry.getFields());
109+
String json =
110+
objectMapper.writeValueAsString(entry.getFields());
108111
rows.add(parseRow(json));
109112
} catch (Exception e) {
110-
throw new RuntimeException("Failed to serialize stream entry", e);
113+
throw new RuntimeException(
114+
"Failed to serialize stream entry", e);
111115
}
112-
});
116+
}
113117
return rows;
114118
}
115119

kvrocks/src/main/java/org/apache/calcite/adapter/kvrocks/KvrocksTable.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ static Table create(KvrocksSchema schema, String tableName,
9898
/** Creates a table from an operand map (used by {@link KvrocksTableFactory}). */
9999
static Table create(KvrocksSchema schema, String tableName,
100100
Map operand, @Nullable RelProtoDataType protoRowType) {
101-
KvrocksConfig config = new KvrocksConfig(
102-
schema.host, schema.port, schema.database,
101+
KvrocksConfig config =
102+
new KvrocksConfig(schema.host, schema.port, schema.database,
103103
schema.password, schema.namespace);
104104
return create(schema, tableName, config, protoRowType);
105105
}

kvrocks/src/test/resources/log4j2-test.xml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
3-
Licensed to the Apache Software Foundation (ASF) under one or more
4-
contributor license agreements. See the NOTICE file distributed with
5-
this work for additional information regarding copyright ownership.
6-
The ASF licenses this file to you under the Apache License, Version 2.0
7-
(the "License"); you may not use this file except in compliance with
8-
the License. You may obtain a copy of the License at
9-
10-
http://www.apache.org/licenses/LICENSE-2.0
11-
12-
Unless required by applicable law or agreed to in writing, software
13-
distributed under the License is distributed on an "AS IS" BASIS,
14-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
See the License for the specific language governing permissions and
16-
limitations under the License.
17-
-->
3+
~ Licensed to the Apache Software Foundation (ASF) under one or more
4+
~ contributor license agreements. See the NOTICE file distributed with
5+
~ this work for additional information regarding copyright ownership.
6+
~ The ASF licenses this file to you under the Apache License, Version 2.0
7+
~ (the "License"); you may not use this file except in compliance with
8+
~ the License. You may obtain a copy of the License at
9+
~
10+
~ http://www.apache.org/licenses/LICENSE-2.0
11+
~
12+
~ Unless required by applicable law or agreed to in writing, software
13+
~ distributed under the License is distributed on an "AS IS" BASIS,
14+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
~ See the License for the specific language governing permissions and
16+
~ limitations under the License.
17+
-->
1818
<Configuration status="WARN">
1919
<Appenders>
2020
<Console name="Console" target="SYSTEM_OUT">

0 commit comments

Comments
 (0)