ptupitsyn commented on code in PR #2912:
URL: https://github.com/apache/ignite-3/pull/2912#discussion_r1412095168
##########
modules/client-common/src/main/java/org/apache/ignite/internal/jdbc/proto/event/JdbcQuerySingleResult.java:
##########
@@ -161,10 +194,19 @@ public void writeBinary(ClientMessagePacker packer) {
packer.packLong(updateCnt);
packer.packBoolean(last);
- packer.packInt(items.size());
+ packer.packIntArray(decimalScales);
+
+ int[] columnTypes = new int[this.columnTypes.size()];
+ for (int i = 0; i < this.columnTypes.size(); i++) {
+ columnTypes[i] = this.columnTypes.get(i).id();
+ }
+
+ packer.packIntArray(columnTypes);
Review Comment:
Avoid array allocation:
```suggestion
packer.packInt(this.columnTypes.size());
for (int i = 0; i < this.columnTypes.size(); i++) {
packer.packInt(this.columnTypes.get(i).id());
}
```
##########
modules/client-common/src/main/java/org/apache/ignite/internal/jdbc/proto/event/JdbcQuerySingleResult.java:
##########
@@ -186,13 +228,21 @@ public void readBinary(ClientMessageUnpacker unpacker) {
updateCnt = unpacker.unpackLong();
last = unpacker.unpackBoolean();
- int size = unpacker.unpackInt();
+ decimalScales = unpacker.unpackIntArray();
+ int[] columnTypeIds = unpacker.unpackIntArray();
- items = new ArrayList<>(size);
+ columnTypes = new ArrayList<>(columnTypeIds.length);
+ for (int columnType : columnTypeIds) {
+ columnTypes.add(ColumnType.getById(columnType));
+ }
Review Comment:
Avoid array allocation:
```java
int count = unpacker.unpackInt();
columnTypes = new ArrayList<>(count);
for (int i = 0; i < count; i++) {
columnTypes.add(ColumnType.getById(unpacker.unpackInt()));
}
```
--
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]