This is an automated email from the ASF dual-hosted git repository.
ptupitsyn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new b395b21855 IGNITE-19270 Thin 3.0: Streamline type codes (#1969)
b395b21855 is described below
commit b395b21855dd924e8bb2601a09c813bdbb5f62c5
Author: Pavel Tupitsyn <[email protected]>
AuthorDate: Fri Apr 21 16:37:12 2023 +0300
IGNITE-19270 Thin 3.0: Streamline type codes (#1969)
Replace multiple sets of column types and codes used by the client protocol
(`ColumnType`, `ClientDataType`, `ClientColumnTypeConverter`) with a single one
- `ColumnType` from the public API.
---
.../client/proto/ClientBinaryTupleUtils.java | 79 +++----
.../client/proto/ClientColumnTypeConverter.java | 241 ---------------------
.../internal/client/proto/ClientDataType.java | 80 -------
.../internal/client/proto/ColumnTypeConverter.java | 58 +++++
.../proto/ClientColumnTypeConverterTest.java | 38 ----
.../client/proto/ColumnTypeConverterTest.java | 64 ++++++
.../requests/sql/ClientSqlExecuteRequest.java | 3 +-
.../handler/requests/table/ClientTableCommon.java | 38 ++--
.../client/handler/requests/table/ClientTuple.java | 4 +-
.../internal/client/sql/ClientAsyncResultSet.java | 3 +-
.../internal/client/sql/ClientColumnMetadata.java | 4 +-
.../ignite/internal/client/table/ClientColumn.java | 21 +-
.../ignite/internal/client/table/ClientSchema.java | 27 +--
.../ignite/internal/client/table/ClientTable.java | 3 +-
.../ignite/internal/client/table/ClientTuple.java | 3 +-
.../client/table/ClientTupleSerializer.java | 37 ++--
.../org/apache/ignite/client/ClientTupleTest.java | 46 ++--
.../cpp/ignite/client/detail/client_data_type.h | 190 ----------------
.../ignite/client/detail/compute/compute_impl.cpp | 3 +-
.../cpp/ignite/client/detail/table/schema.h | 4 +-
.../platforms/cpp/ignite/client/detail/utils.cpp | 6 +-
.../SerializerHandlerBenchmarksBase.cs | 8 +-
.../dotnet/Apache.Ignite.Tests/FakeServer.cs | 18 +-
.../Linq/ResultSelectorCacheKeyTests.cs | 6 +-
.../Proto/BinaryTuple/BinaryTupleTests.cs | 70 +++---
.../Proto/ColocationHashTests.cs | 40 ++--
...nsionsTests.cs => ColumnTypeExtensionsTests.cs} | 26 +--
.../Sql/IgniteDbDataReaderTests.cs | 30 +--
.../dotnet/Apache.Ignite.Tests/Sql/SqlTests.cs | 2 +-
.../Serialization/ObjectSerializerHandlerTests.cs | 6 +-
.../platforms/dotnet/Apache.Ignite.sln.DotSettings | 1 +
.../Apache.Ignite/Internal/Linq/ResultSelector.cs | 6 +-
.../Proto/BinaryTuple/BinaryTupleBuilder.cs | 69 +++---
.../Proto/BinaryTuple/BinaryTupleReader.cs | 40 ++--
.../Apache.Ignite/Internal/Proto/ClientDataType.cs | 79 -------
.../Internal/Proto/ClientDataTypeExtensions.cs | 56 -----
.../Internal/Proto/ClientOpExtensions.cs | 3 +-
.../Internal/Proto/MsgPack/MsgPackReader.cs | 3 +-
.../Apache.Ignite/Internal/Sql/ColumnMetadata.cs | 2 +-
.../Internal/Sql/ColumnTypeExtensions.cs | 145 +++++++++++++
.../dotnet/Apache.Ignite/Internal/Sql/ResultSet.cs | 2 +-
.../dotnet/Apache.Ignite/Internal/Sql/Sql.cs | 38 ++--
.../Internal/Sql/SqlColumnTypeExtensions.cs | 143 ------------
.../dotnet/Apache.Ignite/Internal/Table/Column.cs | 31 ++-
.../Table/Serialization/ObjectSerializerHandler.cs | 23 +-
.../dotnet/Apache.Ignite/Internal/Table/Table.cs | 3 +-
.../Apache.Ignite/Internal/Table/TemporalTypes.cs | 4 +-
.../Sql/{SqlColumnType.cs => ColumnType.cs} | 2 +-
.../dotnet/Apache.Ignite/Sql/IColumnMetadata.cs | 2 +-
.../dotnet/Apache.Ignite/Sql/IgniteDbDataReader.cs | 9 +-
.../runner/app/PlatformTestNodeRunner.java | 34 +--
.../internal/table/ItThinClientColocationTest.java | 2 +-
52 files changed, 630 insertions(+), 1225 deletions(-)
diff --git
a/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientBinaryTupleUtils.java
b/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientBinaryTupleUtils.java
index 279b1f048d..8232844980 100644
---
a/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientBinaryTupleUtils.java
+++
b/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientBinaryTupleUtils.java
@@ -17,25 +17,6 @@
package org.apache.ignite.internal.client.proto;
-import static org.apache.ignite.internal.client.proto.ClientDataType.BITMASK;
-import static org.apache.ignite.internal.client.proto.ClientDataType.BOOLEAN;
-import static org.apache.ignite.internal.client.proto.ClientDataType.BYTES;
-import static org.apache.ignite.internal.client.proto.ClientDataType.DATE;
-import static org.apache.ignite.internal.client.proto.ClientDataType.DATETIME;
-import static org.apache.ignite.internal.client.proto.ClientDataType.DECIMAL;
-import static org.apache.ignite.internal.client.proto.ClientDataType.DOUBLE;
-import static org.apache.ignite.internal.client.proto.ClientDataType.DURATION;
-import static org.apache.ignite.internal.client.proto.ClientDataType.FLOAT;
-import static org.apache.ignite.internal.client.proto.ClientDataType.INT16;
-import static org.apache.ignite.internal.client.proto.ClientDataType.INT32;
-import static org.apache.ignite.internal.client.proto.ClientDataType.INT64;
-import static org.apache.ignite.internal.client.proto.ClientDataType.INT8;
-import static org.apache.ignite.internal.client.proto.ClientDataType.NUMBER;
-import static org.apache.ignite.internal.client.proto.ClientDataType.PERIOD;
-import static org.apache.ignite.internal.client.proto.ClientDataType.STRING;
-import static org.apache.ignite.internal.client.proto.ClientDataType.TIME;
-import static org.apache.ignite.internal.client.proto.ClientDataType.TIMESTAMP;
-import static org.apache.ignite.internal.client.proto.ClientDataType.UUID;
import static org.apache.ignite.lang.ErrorGroups.Client.PROTOCOL_ERR;
import java.math.BigDecimal;
@@ -54,6 +35,7 @@ import java.util.UUID;
import org.apache.ignite.internal.binarytuple.BinaryTupleBuilder;
import org.apache.ignite.internal.binarytuple.BinaryTupleReader;
import org.apache.ignite.lang.IgniteException;
+import org.apache.ignite.sql.ColumnType;
/**
* Client binary tuple utils.
@@ -72,7 +54,8 @@ public class ClientBinaryTupleUtils {
return null;
}
- int type = reader.intValue(index);
+ int typeCode = reader.intValue(index);
+ ColumnType type = ColumnTypeConverter.fromOrdinalOrThrow(typeCode);
int valIdx = index + 2;
switch (type) {
@@ -103,7 +86,7 @@ public class ClientBinaryTupleUtils {
case STRING:
return reader.stringValue(valIdx);
- case BYTES:
+ case BYTE_ARRAY:
return reader.bytesValue(valIdx);
case BITMASK:
@@ -134,7 +117,7 @@ public class ClientBinaryTupleUtils {
return reader.periodValue(valIdx);
default:
- throw unsupportedTypeException(type);
+ throw unsupportedTypeException(typeCode);
}
}
@@ -150,88 +133,88 @@ public class ClientBinaryTupleUtils {
builder.appendNull(); // Scale.
builder.appendNull(); // Value.
} else if (obj instanceof Byte) {
- appendTypeAndScale(builder, INT8);
+ appendTypeAndScale(builder, ColumnType.INT8);
builder.appendByte((Byte) obj);
} else if (obj instanceof Short) {
- appendTypeAndScale(builder, INT16);
+ appendTypeAndScale(builder, ColumnType.INT16);
builder.appendShort((Short) obj);
} else if (obj instanceof Integer) {
- appendTypeAndScale(builder, INT32);
+ appendTypeAndScale(builder, ColumnType.INT32);
builder.appendInt((Integer) obj);
} else if (obj instanceof Long) {
- appendTypeAndScale(builder, INT64);
+ appendTypeAndScale(builder, ColumnType.INT64);
builder.appendLong((Long) obj);
} else if (obj instanceof Float) {
- appendTypeAndScale(builder, FLOAT);
+ appendTypeAndScale(builder, ColumnType.FLOAT);
builder.appendFloat((Float) obj);
} else if (obj instanceof Double) {
- appendTypeAndScale(builder, DOUBLE);
+ appendTypeAndScale(builder, ColumnType.DOUBLE);
builder.appendDouble((Double) obj);
} else if (obj instanceof BigDecimal) {
BigDecimal bigDecimal = (BigDecimal) obj;
- appendTypeAndScale(builder, DECIMAL, bigDecimal.scale());
+ appendTypeAndScale(builder, ColumnType.DECIMAL,
bigDecimal.scale());
builder.appendDecimal(bigDecimal, bigDecimal.scale());
} else if (obj instanceof java.util.UUID) {
- appendTypeAndScale(builder, UUID);
+ appendTypeAndScale(builder, ColumnType.UUID);
builder.appendUuid((UUID) obj);
} else if (obj instanceof String) {
- appendTypeAndScale(builder, STRING);
+ appendTypeAndScale(builder, ColumnType.STRING);
builder.appendString((String) obj);
} else if (obj instanceof byte[]) {
- appendTypeAndScale(builder, BYTES);
+ appendTypeAndScale(builder, ColumnType.BYTE_ARRAY);
builder.appendBytes((byte[]) obj);
} else if (obj instanceof BitSet) {
- appendTypeAndScale(builder, BITMASK);
+ appendTypeAndScale(builder, ColumnType.BITMASK);
builder.appendBitmask((BitSet) obj);
} else if (obj instanceof LocalDate) {
- appendTypeAndScale(builder, DATE);
+ appendTypeAndScale(builder, ColumnType.DATE);
builder.appendDate((LocalDate) obj);
} else if (obj instanceof LocalTime) {
- appendTypeAndScale(builder, TIME);
+ appendTypeAndScale(builder, ColumnType.TIME);
builder.appendTime((LocalTime) obj);
} else if (obj instanceof LocalDateTime) {
- appendTypeAndScale(builder, DATETIME);
+ appendTypeAndScale(builder, ColumnType.DATETIME);
builder.appendDateTime((LocalDateTime) obj);
} else if (obj instanceof Instant) {
- appendTypeAndScale(builder, TIMESTAMP);
+ appendTypeAndScale(builder, ColumnType.TIMESTAMP);
builder.appendTimestamp((Instant) obj);
} else if (obj instanceof Timestamp) {
- appendTypeAndScale(builder, DATETIME);
+ appendTypeAndScale(builder, ColumnType.DATETIME);
Timestamp timeStamp = (Timestamp) obj;
LocalDateTime localDateTime = timeStamp.toLocalDateTime();
builder.appendDateTime(localDateTime);
} else if (obj instanceof Date) {
- appendTypeAndScale(builder, DATE);
+ appendTypeAndScale(builder, ColumnType.DATE);
Date date = (Date) obj;
builder.appendDate(date.toLocalDate());
} else if (obj instanceof Time) {
- appendTypeAndScale(builder, TIME);
+ appendTypeAndScale(builder, ColumnType.TIME);
Time time = (Time) obj;
builder.appendTime(time.toLocalTime());
} else if (obj instanceof BigInteger) {
- appendTypeAndScale(builder, NUMBER);
+ appendTypeAndScale(builder, ColumnType.NUMBER);
builder.appendNumber((BigInteger) obj);
} else if (obj instanceof Boolean) {
- appendTypeAndScale(builder, BOOLEAN);
+ appendTypeAndScale(builder, ColumnType.BOOLEAN);
builder.appendByte((byte) ((Boolean) obj ? 1 : 0));
} else if (obj instanceof Duration) {
- appendTypeAndScale(builder, DURATION);
+ appendTypeAndScale(builder, ColumnType.DURATION);
builder.appendDuration((Duration) obj);
} else if (obj instanceof Period) {
- appendTypeAndScale(builder, PERIOD);
+ appendTypeAndScale(builder, ColumnType.PERIOD);
builder.appendPeriod((Period) obj);
} else {
throw unsupportedTypeException(obj.getClass());
}
}
- private static void appendTypeAndScale(BinaryTupleBuilder builder, int
type, int scale) {
- builder.appendInt(type);
+ private static void appendTypeAndScale(BinaryTupleBuilder builder,
ColumnType type, int scale) {
+ builder.appendInt(type.ordinal());
builder.appendInt(scale);
}
- private static void appendTypeAndScale(BinaryTupleBuilder builder, int
type) {
- builder.appendInt(type);
+ private static void appendTypeAndScale(BinaryTupleBuilder builder,
ColumnType type) {
+ builder.appendInt(type.ordinal());
builder.appendInt(0);
}
diff --git
a/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientColumnTypeConverter.java
b/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientColumnTypeConverter.java
deleted file mode 100644
index de1577a3cc..0000000000
---
a/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientColumnTypeConverter.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * 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.ignite.internal.client.proto;
-
-import org.apache.ignite.sql.ColumnType;
-
-/**
- * SQL column type utils.
- */
-public class ClientColumnTypeConverter {
- /**
- * Converts SQL column type to wire code.
- *
- * @param columnType Column type.
- * @return Wire code.
- */
- public static int sqlColumnTypeToOrdinal(ColumnType columnType) {
- switch (columnType) {
- case BOOLEAN:
- return 0;
-
- case INT8:
- return 1;
-
- case INT16:
- return 2;
-
- case INT32:
- return 3;
-
- case INT64:
- return 4;
-
- case FLOAT:
- return 5;
-
- case DOUBLE:
- return 6;
-
- case DECIMAL:
- return 7;
-
- case DATE:
- return 8;
-
- case TIME:
- return 9;
-
- case DATETIME:
- return 10;
-
- case TIMESTAMP:
- return 11;
-
- case UUID:
- return 12;
-
- case BITMASK:
- return 13;
-
- case STRING:
- return 14;
-
- case BYTE_ARRAY:
- return 15;
-
- case PERIOD:
- return 16;
-
- case DURATION:
- return 17;
-
- case NUMBER:
- return 18;
-
- case NULL:
- return 19;
-
- default:
- throw new IllegalArgumentException("Invalid column type: " +
columnType);
- }
- }
-
- /**
- * Converts wire SQL type code to column type.
- *
- * @param ordinal Type code.
- * @return Column type.
- */
- public static ColumnType ordinalToSqlColumnType(int ordinal) {
- switch (ordinal) {
- case 0:
- return ColumnType.BOOLEAN;
-
- case 1:
- return ColumnType.INT8;
-
- case 2:
- return ColumnType.INT16;
-
- case 3:
- return ColumnType.INT32;
-
- case 4:
- return ColumnType.INT64;
-
- case 5:
- return ColumnType.FLOAT;
-
- case 6:
- return ColumnType.DOUBLE;
-
- case 7:
- return ColumnType.DECIMAL;
-
- case 8:
- return ColumnType.DATE;
-
- case 9:
- return ColumnType.TIME;
-
- case 10:
- return ColumnType.DATETIME;
-
- case 11:
- return ColumnType.TIMESTAMP;
-
- case 12:
- return ColumnType.UUID;
-
- case 13:
- return ColumnType.BITMASK;
-
- case 14:
- return ColumnType.STRING;
-
- case 15:
- return ColumnType.BYTE_ARRAY;
-
- case 16:
- return ColumnType.PERIOD;
-
- case 17:
- return ColumnType.DURATION;
-
- case 18:
- return ColumnType.NUMBER;
-
- case 19:
- return ColumnType.NULL;
-
- default:
- throw new IllegalArgumentException("Invalid column type code:
" + ordinal);
- }
- }
-
- /**
- * Converts client data type ({@link ClientDataType}) code to column type.
- *
- * @param ordinal Type code.
- * @return Column type.
- */
- public static ColumnType clientDataTypeToSqlColumnType(int ordinal) {
- switch (ordinal) {
- case ClientDataType.BOOLEAN:
- return ColumnType.BOOLEAN;
-
- case ClientDataType.INT8:
- return ColumnType.INT8;
-
- case ClientDataType.INT16:
- return ColumnType.INT16;
-
- case ClientDataType.INT32:
- return ColumnType.INT32;
-
- case ClientDataType.INT64:
- return ColumnType.INT64;
-
- case ClientDataType.FLOAT:
- return ColumnType.FLOAT;
-
- case ClientDataType.DOUBLE:
- return ColumnType.DOUBLE;
-
- case ClientDataType.DECIMAL:
- return ColumnType.DECIMAL;
-
- case ClientDataType.DATE:
- return ColumnType.DATE;
-
- case ClientDataType.TIME:
- return ColumnType.TIME;
-
- case ClientDataType.DATETIME:
- return ColumnType.DATETIME;
-
- case ClientDataType.TIMESTAMP:
- return ColumnType.TIMESTAMP;
-
- case ClientDataType.UUID:
- return ColumnType.UUID;
-
- case ClientDataType.BITMASK:
- return ColumnType.BITMASK;
-
- case ClientDataType.STRING:
- return ColumnType.STRING;
-
- case ClientDataType.BYTES:
- return ColumnType.BYTE_ARRAY;
-
- case ClientDataType.PERIOD:
- return ColumnType.PERIOD;
-
- case ClientDataType.DURATION:
- return ColumnType.DURATION;
-
- case ClientDataType.NUMBER:
- return ColumnType.NUMBER;
-
- default:
- throw new IllegalArgumentException("Invalid ClientDataType
code: " + ordinal);
- }
- }
-}
diff --git
a/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientDataType.java
b/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientDataType.java
deleted file mode 100644
index f75a31100e..0000000000
---
a/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientDataType.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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.ignite.internal.client.proto;
-
-/**
- * Client data types.
- */
-public class ClientDataType {
- /** Byte. */
- public static final int INT8 = 1;
-
- /** Short. */
- public static final int INT16 = 2;
-
- /** Int. */
- public static final int INT32 = 3;
-
- /** Long. */
- public static final int INT64 = 4;
-
- /** Float. */
- public static final int FLOAT = 5;
-
- /** Double. */
- public static final int DOUBLE = 6;
-
- /** Decimal. */
- public static final int DECIMAL = 7;
-
- /** UUID. */
- public static final int UUID = 8;
-
- /** String. */
- public static final int STRING = 9;
-
- /** Byte array. */
- public static final int BYTES = 10;
-
- /** BitMask. */
- public static final int BITMASK = 11;
-
- /** Date. */
- public static final int DATE = 12;
-
- /** Time. */
- public static final int TIME = 13;
-
- /** DateTime. */
- public static final int DATETIME = 14;
-
- /** Timestamp. */
- public static final int TIMESTAMP = 15;
-
- /** Number. */
- public static final int NUMBER = 16;
-
- /** Boolean. */
- public static final int BOOLEAN = 17;
-
- /** Duration. */
- public static final int DURATION = 18;
-
- /** Period. */
- public static final int PERIOD = 19;
-}
diff --git
a/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ColumnTypeConverter.java
b/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ColumnTypeConverter.java
new file mode 100644
index 0000000000..2863cfb7ba
--- /dev/null
+++
b/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ColumnTypeConverter.java
@@ -0,0 +1,58 @@
+/*
+ * 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.ignite.internal.client.proto;
+
+import org.apache.ignite.lang.ErrorGroups.Client;
+import org.apache.ignite.lang.IgniteException;
+import org.apache.ignite.sql.ColumnType;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Column type utils.
+ */
+public class ColumnTypeConverter {
+ /** Enum values. */
+ private static final ColumnType[] VALS = ColumnType.values();
+
+ /**
+ * Converts wire SQL type code to column type.
+ *
+ * @param ordinal Type code.
+ * @return Column type.
+ */
+ public static ColumnType fromOrdinalOrThrow(int ordinal) {
+ var columnType = fromOrdinal(ordinal);
+
+ if (columnType == null) {
+ throw new IgniteException(Client.PROTOCOL_ERR, "Invalid column
type code: " + ordinal);
+ }
+
+ return columnType;
+ }
+
+ /**
+ * Efficiently gets enumerated value from its ordinal.
+ *
+ * @param ord Ordinal value.
+ * @return Enumerated value.
+ */
+ @Nullable
+ private static ColumnType fromOrdinal(int ord) {
+ return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
+ }
+}
diff --git
a/modules/client-common/src/test/java/org/apache/ignite/internal/client/proto/ClientColumnTypeConverterTest.java
b/modules/client-common/src/test/java/org/apache/ignite/internal/client/proto/ClientColumnTypeConverterTest.java
deleted file mode 100644
index 3bec9d388a..0000000000
---
a/modules/client-common/src/test/java/org/apache/ignite/internal/client/proto/ClientColumnTypeConverterTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.ignite.internal.client.proto;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-import org.apache.ignite.sql.ColumnType;
-import org.junit.jupiter.api.Test;
-
-/**
- * Tests column type converter.
- */
-public class ClientColumnTypeConverterTest {
- @Test
- public void testConvertAllTypes() {
- for (ColumnType columnType : ColumnType.values()) {
- int ordinal =
ClientColumnTypeConverter.sqlColumnTypeToOrdinal(columnType);
- ColumnType resColumnType =
ClientColumnTypeConverter.ordinalToSqlColumnType(ordinal);
-
- assertEquals(columnType, resColumnType);
- }
- }
-}
diff --git
a/modules/client-common/src/test/java/org/apache/ignite/internal/client/proto/ColumnTypeConverterTest.java
b/modules/client-common/src/test/java/org/apache/ignite/internal/client/proto/ColumnTypeConverterTest.java
new file mode 100644
index 0000000000..17d4934165
--- /dev/null
+++
b/modules/client-common/src/test/java/org/apache/ignite/internal/client/proto/ColumnTypeConverterTest.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.ignite.internal.client.proto;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.apache.ignite.sql.ColumnType;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Column type converter tests.
+ */
+public class ColumnTypeConverterTest {
+ /**
+ * Client protocol relies on this order of column types. Do not change.
+ * If a change to ColumnType enum is required, fix ColumnTypeConverter.
+ */
+ private static final ColumnType[] EXPECTED_VALS = {
+ ColumnType.BOOLEAN,
+ ColumnType.INT8,
+ ColumnType.INT16,
+ ColumnType.INT32,
+ ColumnType.INT64,
+ ColumnType.FLOAT,
+ ColumnType.DOUBLE,
+ ColumnType.DECIMAL,
+ ColumnType.DATE,
+ ColumnType.TIME,
+ ColumnType.DATETIME,
+ ColumnType.TIMESTAMP,
+ ColumnType.UUID,
+ ColumnType.BITMASK,
+ ColumnType.STRING,
+ ColumnType.BYTE_ARRAY,
+ ColumnType.PERIOD,
+ ColumnType.DURATION,
+ ColumnType.NUMBER
+ };
+
+ @Test
+ public void testColumnTypeConverter() {
+ for (int i = 0; i < EXPECTED_VALS.length; i++) {
+ ColumnType expectedVal = EXPECTED_VALS[i];
+ ColumnType actualVal = ColumnTypeConverter.fromOrdinalOrThrow(i);
+
+ assertEquals(expectedVal, actualVal);
+ }
+ }
+}
diff --git
a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlExecuteRequest.java
b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlExecuteRequest.java
index 3375b703ef..b68da2fc36 100644
---
a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlExecuteRequest.java
+++
b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlExecuteRequest.java
@@ -31,7 +31,6 @@ import org.apache.ignite.client.handler.ClientResource;
import org.apache.ignite.client.handler.ClientResourceRegistry;
import org.apache.ignite.internal.binarytuple.BinaryTupleReader;
import org.apache.ignite.internal.client.proto.ClientBinaryTupleUtils;
-import org.apache.ignite.internal.client.proto.ClientColumnTypeConverter;
import org.apache.ignite.internal.client.proto.ClientMessagePacker;
import org.apache.ignite.internal.client.proto.ClientMessageUnpacker;
import org.apache.ignite.internal.util.ArrayUtils;
@@ -194,7 +193,7 @@ public class ClientSqlExecuteRequest {
out.packString(col.name());
out.packBoolean(col.nullable());
-
out.packInt(ClientColumnTypeConverter.sqlColumnTypeToOrdinal(col.type()));
+ out.packInt(col.type().ordinal());
out.packInt(col.scale());
out.packInt(col.precision());
diff --git
a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTableCommon.java
b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTableCommon.java
index 5b2c2d3423..6c9d18b126 100644
---
a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTableCommon.java
+++
b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTableCommon.java
@@ -35,7 +35,6 @@ import
org.apache.ignite.client.handler.ClientResourceRegistry;
import org.apache.ignite.internal.binarytuple.BinaryTupleBuilder;
import org.apache.ignite.internal.binarytuple.BinaryTupleContainer;
import org.apache.ignite.internal.binarytuple.BinaryTupleReader;
-import org.apache.ignite.internal.client.proto.ClientDataType;
import org.apache.ignite.internal.client.proto.ClientMessagePacker;
import org.apache.ignite.internal.client.proto.ClientMessageUnpacker;
import org.apache.ignite.internal.client.proto.TuplePart;
@@ -53,6 +52,7 @@ import org.apache.ignite.internal.table.TableImpl;
import org.apache.ignite.lang.IgniteException;
import org.apache.ignite.lang.IgniteInternalCheckedException;
import org.apache.ignite.lang.NodeStoppingException;
+import org.apache.ignite.sql.ColumnType;
import org.apache.ignite.table.Tuple;
import org.apache.ignite.table.manager.IgniteTables;
import org.apache.ignite.tx.Transaction;
@@ -89,7 +89,7 @@ public class ClientTableCommon {
packer.packArrayHeader(7);
packer.packString(col.name());
- packer.packInt(getClientDataType(col.type().spec()));
+ packer.packInt(getColumnType(col.type().spec()).ordinal());
packer.packBoolean(schema.isKeyColumn(colIdx));
packer.packBoolean(col.nullable());
packer.packBoolean(colocationCols.contains(col));
@@ -372,55 +372,55 @@ public class ClientTableCommon {
* @param spec Type spec.
* @return Client type code.
*/
- public static int getClientDataType(NativeTypeSpec spec) {
+ public static ColumnType getColumnType(NativeTypeSpec spec) {
switch (spec) {
case INT8:
- return ClientDataType.INT8;
+ return ColumnType.INT8;
case INT16:
- return ClientDataType.INT16;
+ return ColumnType.INT16;
case INT32:
- return ClientDataType.INT32;
+ return ColumnType.INT32;
case INT64:
- return ClientDataType.INT64;
+ return ColumnType.INT64;
case FLOAT:
- return ClientDataType.FLOAT;
+ return ColumnType.FLOAT;
case DOUBLE:
- return ClientDataType.DOUBLE;
+ return ColumnType.DOUBLE;
case DECIMAL:
- return ClientDataType.DECIMAL;
+ return ColumnType.DECIMAL;
case NUMBER:
- return ClientDataType.NUMBER;
+ return ColumnType.NUMBER;
case UUID:
- return ClientDataType.UUID;
+ return ColumnType.UUID;
case STRING:
- return ClientDataType.STRING;
+ return ColumnType.STRING;
case BYTES:
- return ClientDataType.BYTES;
+ return ColumnType.BYTE_ARRAY;
case BITMASK:
- return ClientDataType.BITMASK;
+ return ColumnType.BITMASK;
case DATE:
- return ClientDataType.DATE;
+ return ColumnType.DATE;
case TIME:
- return ClientDataType.TIME;
+ return ColumnType.TIME;
case DATETIME:
- return ClientDataType.DATETIME;
+ return ColumnType.DATETIME;
case TIMESTAMP:
- return ClientDataType.TIMESTAMP;
+ return ColumnType.TIMESTAMP;
default:
throw new IgniteException(PROTOCOL_ERR, "Unsupported native
type: " + spec);
diff --git
a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTuple.java
b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTuple.java
index 066442a41f..6531e8200d 100644
---
a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTuple.java
+++
b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTuple.java
@@ -19,7 +19,6 @@ package org.apache.ignite.client.handler.requests.table;
import java.util.BitSet;
import org.apache.ignite.internal.binarytuple.BinaryTupleReader;
-import org.apache.ignite.internal.client.proto.ClientColumnTypeConverter;
import org.apache.ignite.internal.client.table.MutableTupleBinaryTupleAdapter;
import org.apache.ignite.internal.schema.Column;
import org.apache.ignite.internal.schema.NativeTypeSpec;
@@ -80,9 +79,8 @@ class ClientTuple extends MutableTupleBinaryTupleAdapter {
@Override
protected ColumnType schemaColumnType(int columnIndex) {
NativeTypeSpec spec = schema.column(columnIndex).type().spec();
- int clientTypeCode = ClientTableCommon.getClientDataType(spec);
- return
ClientColumnTypeConverter.clientDataTypeToSqlColumnType(clientTypeCode);
+ return ClientTableCommon.getColumnType(spec);
}
/** {@inheritDoc} */
diff --git
a/modules/client/src/main/java/org/apache/ignite/internal/client/sql/ClientAsyncResultSet.java
b/modules/client/src/main/java/org/apache/ignite/internal/client/sql/ClientAsyncResultSet.java
index 553bf4c9cc..de22ff0d8f 100644
---
a/modules/client/src/main/java/org/apache/ignite/internal/client/sql/ClientAsyncResultSet.java
+++
b/modules/client/src/main/java/org/apache/ignite/internal/client/sql/ClientAsyncResultSet.java
@@ -25,7 +25,6 @@ import java.util.List;
import java.util.concurrent.CompletableFuture;
import org.apache.ignite.internal.binarytuple.BinaryTupleReader;
import org.apache.ignite.internal.client.ClientChannel;
-import org.apache.ignite.internal.client.proto.ClientColumnTypeConverter;
import org.apache.ignite.internal.client.proto.ClientMessageUnpacker;
import org.apache.ignite.internal.client.proto.ClientOp;
import org.apache.ignite.internal.client.proto.TuplePart;
@@ -316,7 +315,7 @@ class ClientAsyncResultSet<T> implements AsyncResultSet<T> {
var schemaColumn = new ClientColumn(
metaColumn.name(),
-
ClientColumnTypeConverter.sqlColumnTypeToOrdinal(metaColumn.type()),
+ metaColumn.type(),
metaColumn.nullable(),
true,
false,
diff --git
a/modules/client/src/main/java/org/apache/ignite/internal/client/sql/ClientColumnMetadata.java
b/modules/client/src/main/java/org/apache/ignite/internal/client/sql/ClientColumnMetadata.java
index 2f76d7c322..ccdd88a097 100644
---
a/modules/client/src/main/java/org/apache/ignite/internal/client/sql/ClientColumnMetadata.java
+++
b/modules/client/src/main/java/org/apache/ignite/internal/client/sql/ClientColumnMetadata.java
@@ -18,8 +18,8 @@
package org.apache.ignite.internal.client.sql;
import java.util.List;
-import org.apache.ignite.internal.client.proto.ClientColumnTypeConverter;
import org.apache.ignite.internal.client.proto.ClientMessageUnpacker;
+import org.apache.ignite.internal.client.proto.ColumnTypeConverter;
import org.apache.ignite.sql.ColumnMetadata;
import org.apache.ignite.sql.ColumnType;
@@ -58,7 +58,7 @@ public class ClientColumnMetadata implements ColumnMetadata {
name = unpacker.unpackString();
nullable = unpacker.unpackBoolean();
- type =
ClientColumnTypeConverter.ordinalToSqlColumnType(unpacker.unpackInt());
+ type = ColumnTypeConverter.fromOrdinalOrThrow(unpacker.unpackInt());
scale = unpacker.unpackInt();
precision = unpacker.unpackInt();
diff --git
a/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientColumn.java
b/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientColumn.java
index 99169d84f2..699d66a4ad 100644
---
a/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientColumn.java
+++
b/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientColumn.java
@@ -17,7 +17,7 @@
package org.apache.ignite.internal.client.table;
-import org.apache.ignite.internal.client.proto.ClientDataType;
+import org.apache.ignite.sql.ColumnType;
/**
* Schema column.
@@ -26,8 +26,8 @@ public class ClientColumn {
/** Column name. */
private final String name;
- /** Column type code (see {@link ClientDataType}). */
- private final int type;
+ /** Column type code. */
+ private final ColumnType type;
/** Nullable flag. */
private final boolean nullable;
@@ -51,13 +51,13 @@ public class ClientColumn {
* Constructor.
*
* @param name Column name.
- * @param type Column type code.
+ * @param type Column type.
* @param nullable Nullable flag.
* @param isKey Key column flag.
* @param isColocation Colocation column flag.
* @param schemaIndex Index of the column in the schema.
*/
- public ClientColumn(String name, int type, boolean nullable, boolean
isKey, boolean isColocation, int schemaIndex) {
+ public ClientColumn(String name, ColumnType type, boolean nullable,
boolean isKey, boolean isColocation, int schemaIndex) {
this(name, type, nullable, isKey, isColocation, schemaIndex, 0, 0);
}
@@ -73,8 +73,9 @@ public class ClientColumn {
*/
public ClientColumn(
String name,
- int type,
- boolean nullable, boolean isKey,
+ ColumnType type,
+ boolean nullable,
+ boolean isKey,
boolean isColocation,
int schemaIndex,
int scale,
@@ -97,11 +98,11 @@ public class ClientColumn {
}
/**
- * Client data type, see {@link ClientDataType}.
+ * Column type.
*
- * @return Data type code.
+ * @return Type.
*/
- public int type() {
+ public ColumnType type() {
return type;
}
diff --git
a/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientSchema.java
b/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientSchema.java
index 755b536a28..580cdd6ea2 100644
---
a/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientSchema.java
+++
b/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientSchema.java
@@ -17,33 +17,18 @@
package org.apache.ignite.internal.client.table;
-import static org.apache.ignite.internal.client.proto.ClientDataType.BITMASK;
-import static org.apache.ignite.internal.client.proto.ClientDataType.BYTES;
-import static org.apache.ignite.internal.client.proto.ClientDataType.DATE;
-import static org.apache.ignite.internal.client.proto.ClientDataType.DATETIME;
-import static org.apache.ignite.internal.client.proto.ClientDataType.DECIMAL;
-import static org.apache.ignite.internal.client.proto.ClientDataType.DOUBLE;
-import static org.apache.ignite.internal.client.proto.ClientDataType.FLOAT;
-import static org.apache.ignite.internal.client.proto.ClientDataType.INT16;
-import static org.apache.ignite.internal.client.proto.ClientDataType.INT32;
-import static org.apache.ignite.internal.client.proto.ClientDataType.INT64;
-import static org.apache.ignite.internal.client.proto.ClientDataType.INT8;
-import static org.apache.ignite.internal.client.proto.ClientDataType.NUMBER;
-import static org.apache.ignite.internal.client.proto.ClientDataType.STRING;
-import static org.apache.ignite.internal.client.proto.ClientDataType.TIME;
-import static org.apache.ignite.internal.client.proto.ClientDataType.TIMESTAMP;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.ignite.internal.client.proto.ClientDataType;
import org.apache.ignite.internal.client.proto.TuplePart;
import org.apache.ignite.internal.marshaller.BinaryMode;
import org.apache.ignite.internal.marshaller.Marshaller;
import org.apache.ignite.internal.marshaller.MarshallerColumn;
import org.apache.ignite.lang.ColumnNotFoundException;
+import org.apache.ignite.lang.ErrorGroups.Client;
import org.apache.ignite.lang.IgniteException;
+import org.apache.ignite.sql.ColumnType;
import org.apache.ignite.table.mapper.Mapper;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -189,7 +174,7 @@ public class ClientSchema {
return Marshaller.createMarshaller(cols, mapper, part ==
TuplePart.KEY);
}
- private static BinaryMode mode(int dataType) {
+ private static BinaryMode mode(ColumnType dataType) {
switch (dataType) {
case INT8:
return BinaryMode.BYTE;
@@ -209,13 +194,13 @@ public class ClientSchema {
case DOUBLE:
return BinaryMode.DOUBLE;
- case ClientDataType.UUID:
+ case UUID:
return BinaryMode.UUID;
case STRING:
return BinaryMode.STRING;
- case BYTES:
+ case BYTE_ARRAY:
return BinaryMode.BYTE_ARR;
case DECIMAL:
@@ -240,7 +225,7 @@ public class ClientSchema {
return BinaryMode.TIMESTAMP;
default:
- throw new IgniteException("Unknown client data type: " +
dataType);
+ throw new IgniteException(Client.PROTOCOL_ERR, "Unknown client
data type: " + dataType);
}
}
}
diff --git
a/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientTable.java
b/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientTable.java
index 91c1a18bad..b359f97aca 100644
---
a/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientTable.java
+++
b/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientTable.java
@@ -36,6 +36,7 @@ import org.apache.ignite.internal.client.PayloadOutputChannel;
import org.apache.ignite.internal.client.ReliableChannel;
import org.apache.ignite.internal.client.proto.ClientMessageUnpacker;
import org.apache.ignite.internal.client.proto.ClientOp;
+import org.apache.ignite.internal.client.proto.ColumnTypeConverter;
import org.apache.ignite.internal.client.tx.ClientTransaction;
import org.apache.ignite.internal.logger.IgniteLogger;
import org.apache.ignite.internal.tostring.IgniteToStringBuilder;
@@ -196,7 +197,7 @@ public class ClientTable implements Table {
assert propCnt >= 7;
var name = in.unpackString();
- var type = in.unpackInt();
+ var type = ColumnTypeConverter.fromOrdinalOrThrow(in.unpackInt());
var isKey = in.unpackBoolean();
var isNullable = in.unpackBoolean();
var isColocation = in.unpackBoolean();
diff --git
a/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientTuple.java
b/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientTuple.java
index 3961811226..e114c3bcdf 100644
---
a/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientTuple.java
+++
b/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientTuple.java
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.client.table;
import org.apache.ignite.internal.binarytuple.BinaryTupleReader;
-import org.apache.ignite.internal.client.proto.ClientColumnTypeConverter;
import org.apache.ignite.internal.util.IgniteNameUtils;
import org.apache.ignite.sql.ColumnType;
import org.jetbrains.annotations.NotNull;
@@ -61,7 +60,7 @@ public class ClientTuple extends
MutableTupleBinaryTupleAdapter {
protected ColumnType schemaColumnType(int columnIndex) {
ClientColumn column = schema.columns()[columnIndex];
- return
ClientColumnTypeConverter.clientDataTypeToSqlColumnType(column.type());
+ return column.type();
}
@Override
diff --git
a/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientTupleSerializer.java
b/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientTupleSerializer.java
index 0d2eb30d37..8b11c524bb 100644
---
a/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientTupleSerializer.java
+++
b/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientTupleSerializer.java
@@ -36,7 +36,6 @@ import java.util.UUID;
import org.apache.ignite.internal.binarytuple.BinaryTupleBuilder;
import org.apache.ignite.internal.binarytuple.BinaryTupleReader;
import org.apache.ignite.internal.client.PayloadOutputChannel;
-import org.apache.ignite.internal.client.proto.ClientDataType;
import org.apache.ignite.internal.client.proto.ClientMessageUnpacker;
import org.apache.ignite.internal.client.proto.TuplePart;
import org.apache.ignite.internal.client.tx.ClientTransaction;
@@ -177,9 +176,7 @@ public class ClientTupleSerializer {
var noValueSet = new BitSet(columns.length);
var builder = new BinaryTupleBuilder(columns.length, true);
- for (var i = 0; i < columns.length; i++) {
- var col = columns[i];
-
+ for (ClientColumn col : columns) {
Object v = col.key()
? key.valueOrDefault(col.name(), NO_VALUE)
: val != null
@@ -330,67 +327,67 @@ public class ClientTupleSerializer {
try {
switch (col.type()) {
- case ClientDataType.INT8:
+ case INT8:
builder.appendByte((byte) v);
return;
- case ClientDataType.INT16:
+ case INT16:
builder.appendShort((short) v);
return;
- case ClientDataType.INT32:
+ case INT32:
builder.appendInt((int) v);
return;
- case ClientDataType.INT64:
+ case INT64:
builder.appendLong((long) v);
return;
- case ClientDataType.FLOAT:
+ case FLOAT:
builder.appendFloat((float) v);
return;
- case ClientDataType.DOUBLE:
+ case DOUBLE:
builder.appendDouble((double) v);
return;
- case ClientDataType.DECIMAL:
+ case DECIMAL:
builder.appendDecimalNotNull((BigDecimal) v, col.scale());
return;
- case ClientDataType.UUID:
+ case UUID:
builder.appendUuidNotNull((UUID) v);
return;
- case ClientDataType.STRING:
+ case STRING:
builder.appendStringNotNull((String) v);
return;
- case ClientDataType.BYTES:
+ case BYTE_ARRAY:
builder.appendBytesNotNull((byte[]) v);
return;
- case ClientDataType.BITMASK:
+ case BITMASK:
builder.appendBitmaskNotNull((BitSet) v);
return;
- case ClientDataType.DATE:
+ case DATE:
builder.appendDateNotNull((LocalDate) v);
return;
- case ClientDataType.TIME:
+ case TIME:
builder.appendTimeNotNull((LocalTime) v);
return;
- case ClientDataType.DATETIME:
+ case DATETIME:
builder.appendDateTimeNotNull((LocalDateTime) v);
return;
- case ClientDataType.TIMESTAMP:
+ case TIMESTAMP:
builder.appendTimestampNotNull((Instant) v);
return;
- case ClientDataType.NUMBER:
+ case NUMBER:
builder.appendNumberNotNull((BigInteger) v);
return;
diff --git
a/modules/client/src/test/java/org/apache/ignite/client/ClientTupleTest.java
b/modules/client/src/test/java/org/apache/ignite/client/ClientTupleTest.java
index eb30d1af77..0f6ae54be0 100644
--- a/modules/client/src/test/java/org/apache/ignite/client/ClientTupleTest.java
+++ b/modules/client/src/test/java/org/apache/ignite/client/ClientTupleTest.java
@@ -44,8 +44,6 @@ import java.util.stream.Collectors;
import java.util.stream.IntStream;
import org.apache.ignite.internal.binarytuple.BinaryTupleBuilder;
import org.apache.ignite.internal.binarytuple.BinaryTupleReader;
-import org.apache.ignite.internal.client.proto.ClientColumnTypeConverter;
-import org.apache.ignite.internal.client.proto.ClientDataType;
import org.apache.ignite.internal.client.table.ClientColumn;
import org.apache.ignite.internal.client.table.ClientSchema;
import org.apache.ignite.internal.client.table.ClientTuple;
@@ -60,30 +58,30 @@ import org.junit.jupiter.api.Test;
*/
public class ClientTupleTest {
private static final ClientSchema SCHEMA = new ClientSchema(1, new
ClientColumn[]{
- new ClientColumn("ID", ClientDataType.INT64, false, true, true, 0),
- new ClientColumn("NAME", ClientDataType.STRING, false, false,
false, 1)
+ new ClientColumn("ID", ColumnType.INT64, false, true, true, 0),
+ new ClientColumn("NAME", ColumnType.STRING, false, false, false, 1)
});
private static final ClientSchema FULL_SCHEMA = new ClientSchema(100, new
ClientColumn[]{
- new ClientColumn("I8", ClientDataType.INT8, false, false, false,
0),
- new ClientColumn("I16", ClientDataType.INT16, false, false, false,
1),
- new ClientColumn("I32", ClientDataType.INT32, false, false, false,
2),
- new ClientColumn("I64", ClientDataType.INT64, false, false, false,
3),
- new ClientColumn("FLOAT", ClientDataType.FLOAT, false, false,
false, 4),
- new ClientColumn("DOUBLE", ClientDataType.DOUBLE, false, false,
false, 5),
- new ClientColumn("UUID", ClientDataType.UUID, false, false, false,
6),
- new ClientColumn("STR", ClientDataType.STRING, false, false,
false, 7),
- new ClientColumn("BITS", ClientDataType.BITMASK, false, false,
false, 8),
- new ClientColumn("DATE", ClientDataType.DATE, false, false, false,
9),
- new ClientColumn("TIME", ClientDataType.TIME, false, false, false,
10),
- new ClientColumn("DATETIME", ClientDataType.DATETIME, false,
false, false, 11),
- new ClientColumn("TIMESTAMP", ClientDataType.TIMESTAMP, false,
false, false, 12),
- new ClientColumn("BOOL", ClientDataType.BOOLEAN, false, false,
false, 13),
- new ClientColumn("DECIMAL", ClientDataType.DECIMAL, false, false,
false, 14),
- new ClientColumn("BYTES", ClientDataType.BYTES, false, false,
false, 15),
- new ClientColumn("PERIOD", ClientDataType.PERIOD, false, false,
false, 16),
- new ClientColumn("DURATION", ClientDataType.DURATION, false,
false, false, 17),
- new ClientColumn("NUMBER", ClientDataType.NUMBER, false, false,
false, 18)
+ new ClientColumn("I8", ColumnType.INT8, false, false, false, 0),
+ new ClientColumn("I16", ColumnType.INT16, false, false, false, 1),
+ new ClientColumn("I32", ColumnType.INT32, false, false, false, 2),
+ new ClientColumn("I64", ColumnType.INT64, false, false, false, 3),
+ new ClientColumn("FLOAT", ColumnType.FLOAT, false, false, false,
4),
+ new ClientColumn("DOUBLE", ColumnType.DOUBLE, false, false, false,
5),
+ new ClientColumn("UUID", ColumnType.UUID, false, false, false, 6),
+ new ClientColumn("STR", ColumnType.STRING, false, false, false, 7),
+ new ClientColumn("BITS", ColumnType.BITMASK, false, false, false,
8),
+ new ClientColumn("DATE", ColumnType.DATE, false, false, false, 9),
+ new ClientColumn("TIME", ColumnType.TIME, false, false, false, 10),
+ new ClientColumn("DATETIME", ColumnType.DATETIME, false, false,
false, 11),
+ new ClientColumn("TIMESTAMP", ColumnType.TIMESTAMP, false, false,
false, 12),
+ new ClientColumn("BOOL", ColumnType.BOOLEAN, false, false, false,
13),
+ new ClientColumn("DECIMAL", ColumnType.DECIMAL, false, false,
false, 14),
+ new ClientColumn("BYTES", ColumnType.BYTE_ARRAY, false, false,
false, 15),
+ new ClientColumn("PERIOD", ColumnType.PERIOD, false, false, false,
16),
+ new ClientColumn("DURATION", ColumnType.DURATION, false, false,
false, 17),
+ new ClientColumn("NUMBER", ColumnType.NUMBER, false, false, false,
18)
});
private static final UUID GUID = UUID.randomUUID();
@@ -288,7 +286,7 @@ public class ClientTupleTest {
@Test
public void testFullSchemaHasAllTypes() {
Set<ColumnType> schemaTypes = Arrays.stream(FULL_SCHEMA.columns())
- .map(c ->
ClientColumnTypeConverter.clientDataTypeToSqlColumnType(c.type()))
+ .map(ClientColumn::type)
.collect(Collectors.toSet());
for (ColumnType columnType : ColumnType.values()) {
diff --git a/modules/platforms/cpp/ignite/client/detail/client_data_type.h
b/modules/platforms/cpp/ignite/client/detail/client_data_type.h
deleted file mode 100644
index fb0a139e34..0000000000
--- a/modules/platforms/cpp/ignite/client/detail/client_data_type.h
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-#include <ignite/common/ignite_error.h>
-#include <ignite/common/ignite_type.h>
-
-namespace ignite::detail {
-
-/**
- * Column data type encoding for the client protocol.
- */
-struct client_data_type {
- /** Byte. */
- static constexpr std::int32_t INT8 = 1;
-
- /** Short. */
- static constexpr std::int32_t INT16 = 2;
-
- /** Int. */
- static constexpr std::int32_t INT32 = 3;
-
- /** Long. */
- static constexpr std::int32_t INT64 = 4;
-
- /** Float. */
- static constexpr std::int32_t FLOAT = 5;
-
- /** Double. */
- static constexpr std::int32_t DOUBLE = 6;
-
- /** Decimal. */
- static constexpr std::int32_t DECIMAL = 7;
-
- /** UUID. */
- static constexpr std::int32_t UUID = 8;
-
- /** String. */
- static constexpr std::int32_t STRING = 9;
-
- /** Byte array. */
- static constexpr std::int32_t BYTES = 10;
-
- /** BitMask. */
- static constexpr std::int32_t BITMASK = 11;
-
- /** Date. */
- static constexpr std::int32_t DATE = 12;
-
- /** Time. */
- static constexpr std::int32_t TIME = 13;
-
- /** DateTime. */
- static constexpr std::int32_t DATETIME = 14;
-
- /** Timestamp. */
- static constexpr std::int32_t TIMESTAMP = 15;
-
- /** Number. */
- static constexpr std::int32_t NUMBER = 16;
-
- /** Boolean. */
- static constexpr std::int32_t BOOLEAN = 17;
-
- /** Duration. */
- static constexpr std::int32_t DURATION = 18;
-
- /** Period. */
- static constexpr std::int32_t PERIOD = 19;
-
- /**
- * Get the ignite type matching a client data type value.
- *
- * @param t Client data type.
- * @return Matching ignite type.
- */
- static ignite_type to_ignite_type(std::int32_t t) {
- switch (t) {
- case INT8:
- return ignite_type::INT8;
- case INT16:
- return ignite_type::INT16;
- case INT32:
- return ignite_type::INT32;
- case INT64:
- return ignite_type::INT64;
- case FLOAT:
- return ignite_type::FLOAT;
- case DOUBLE:
- return ignite_type::DOUBLE;
- case DECIMAL:
- return ignite_type::DECIMAL;
- case UUID:
- return ignite_type::UUID;
- case STRING:
- return ignite_type::STRING;
- case BYTES:
- return ignite_type::BYTE_ARRAY;
- case BITMASK:
- return ignite_type::BITMASK;
- case DATE:
- return ignite_type::DATE;
- case TIME:
- return ignite_type::TIME;
- case DATETIME:
- return ignite_type::DATETIME;
- case TIMESTAMP:
- return ignite_type::TIMESTAMP;
- case NUMBER:
- return ignite_type::NUMBER;
- case BOOLEAN:
- return ignite_type::BOOLEAN;
- case DURATION:
- return ignite_type::DURATION;
- case PERIOD:
- return ignite_type::PERIOD;
- default:
- throw ignite_error("Value is out of range for Ignite type: " +
std::to_string(t));
- }
- }
-
- /**
- * Get the client data type value matching an ignite type.
- *
- * @param t Ignite type.
- * @return Matching client data type.
- */
- static std::int32_t from_ignite_type(ignite_type t) {
- switch (t) {
- case ignite_type::BOOLEAN:
- return BOOLEAN;
- case ignite_type::INT8:
- return INT8;
- case ignite_type::INT16:
- return INT16;
- case ignite_type::INT32:
- return INT32;
- case ignite_type::INT64:
- return INT64;
- case ignite_type::FLOAT:
- return FLOAT;
- case ignite_type::DOUBLE:
- return DOUBLE;
- case ignite_type::DECIMAL:
- return DECIMAL;
- case ignite_type::DATE:
- return DATE;
- case ignite_type::TIME:
- return TIME;
- case ignite_type::DATETIME:
- return DATETIME;
- case ignite_type::TIMESTAMP:
- return TIMESTAMP;
- case ignite_type::UUID:
- return UUID;
- case ignite_type::BITMASK:
- return BITMASK;
- case ignite_type::STRING:
- return STRING;
- case ignite_type::BYTE_ARRAY:
- return BYTES;
- case ignite_type::PERIOD:
- return PERIOD;
- case ignite_type::DURATION:
- return DURATION;
- case ignite_type::NUMBER:
- return NUMBER;
- default:
- throw ignite_error("Value is out of range for Ignite type: "
- +
std::to_string(static_cast<std::underlying_type_t<ignite_type>>(t)));
- }
- }
-};
-
-} // namespace ignite::detail
diff --git
a/modules/platforms/cpp/ignite/client/detail/compute/compute_impl.cpp
b/modules/platforms/cpp/ignite/client/detail/compute/compute_impl.cpp
index e2c1b64913..73d7005a3d 100644
--- a/modules/platforms/cpp/ignite/client/detail/compute/compute_impl.cpp
+++ b/modules/platforms/cpp/ignite/client/detail/compute/compute_impl.cpp
@@ -17,7 +17,6 @@
#include "compute_impl.h"
-#include "ignite/client/detail/client_data_type.h"
#include "ignite/client/detail/utils.h"
#include "ignite/tuple/binary_tuple_builder.h"
@@ -61,7 +60,7 @@ std::optional<primitive>
read_primitive_from_binary_tuple(protocol::reader &read
auto tuple_data = reader.read_binary();
binary_tuple_parser parser(3, tuple_data);
- auto typ =
client_data_type::to_ignite_type(binary_tuple_parser::get_int32(parser.get_next().value()));
+ auto typ =
static_cast<ignite_type>(binary_tuple_parser::get_int32(parser.get_next().value()));
auto scale = binary_tuple_parser::get_int32(parser.get_next().value());
return read_next_column(parser, typ, scale);
}
diff --git a/modules/platforms/cpp/ignite/client/detail/table/schema.h
b/modules/platforms/cpp/ignite/client/detail/table/schema.h
index 81f5cdf656..696138a777 100644
--- a/modules/platforms/cpp/ignite/client/detail/table/schema.h
+++ b/modules/platforms/cpp/ignite/client/detail/table/schema.h
@@ -17,8 +17,6 @@
#pragma once
-#include "ignite/client/detail/client_data_type.h"
-
#include "ignite/common/ignite_error.h"
#include "ignite/common/ignite_type.h"
#include "ignite/protocol/utils.h"
@@ -59,7 +57,7 @@ struct column {
column res{};
res.name = protocol::unpack_object<std::string>(arr.ptr[0]);
- res.type =
client_data_type::to_ignite_type(protocol::unpack_object<std::int32_t>(arr.ptr[1]));
+ res.type =
static_cast<ignite_type>(protocol::unpack_object<std::int32_t>(arr.ptr[1]));
res.is_key = protocol::unpack_object<bool>(arr.ptr[2]);
res.nullable = protocol::unpack_object<bool>(arr.ptr[3]);
res.scale = protocol::unpack_object<std::int32_t>(arr.ptr[5]);
diff --git a/modules/platforms/cpp/ignite/client/detail/utils.cpp
b/modules/platforms/cpp/ignite/client/detail/utils.cpp
index d1908091a0..dd553f00d6 100644
--- a/modules/platforms/cpp/ignite/client/detail/utils.cpp
+++ b/modules/platforms/cpp/ignite/client/detail/utils.cpp
@@ -17,8 +17,6 @@
#include "utils.h"
-#include "client_data_type.h"
-
#include <ignite/common/bits.h>
#include <ignite/common/uuid.h>
@@ -220,7 +218,7 @@ std::vector<std::byte> pack_tuple(
* @param scale Scale.
*/
void claim_type_and_scale(binary_tuple_builder &builder, ignite_type typ,
std::int32_t scale = 0) {
- builder.claim_int32(client_data_type::from_ignite_type(typ));
+ builder.claim_int32(static_cast<std::int32_t>(typ));
builder.claim_int32(scale);
}
@@ -232,7 +230,7 @@ void claim_type_and_scale(binary_tuple_builder &builder,
ignite_type typ, std::i
* @param scale Scale.
*/
void append_type_and_scale(binary_tuple_builder &builder, ignite_type typ,
std::int32_t scale = 0) {
- builder.append_int32(client_data_type::from_ignite_type(typ));
+ builder.append_int32(static_cast<std::int32_t>(typ));
builder.append_int32(scale);
}
diff --git
a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Table/Serialization/SerializerHandlerBenchmarksBase.cs
b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Table/Serialization/SerializerHandlerBenchmarksBase.cs
index 3bae3cafb6..e9e49300b5 100644
---
a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Table/Serialization/SerializerHandlerBenchmarksBase.cs
+++
b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Table/Serialization/SerializerHandlerBenchmarksBase.cs
@@ -19,9 +19,9 @@ namespace Apache.Ignite.Benchmarks.Table.Serialization
{
using System;
using BenchmarkDotNet.Engines;
+ using Ignite.Sql;
using Ignite.Table;
using Internal.Buffers;
- using Internal.Proto;
using Internal.Table;
using Internal.Table.Serialization;
@@ -46,9 +46,9 @@ namespace Apache.Ignite.Benchmarks.Table.Serialization
internal static readonly Schema Schema = new(1, 1, new[]
{
- new Column(nameof(Car.Id), ClientDataType.Uuid, IsNullable: false,
IsColocation: true, IsKey: true, SchemaIndex: 0, Scale: 0, Precision: 0),
- new Column(nameof(Car.BodyType), ClientDataType.String,
IsNullable: false, IsColocation: false, IsKey: false, SchemaIndex: 1, Scale: 0,
Precision: 0),
- new Column(nameof(Car.Seats), ClientDataType.Int32, IsNullable:
false, IsColocation: false, IsKey: false, SchemaIndex: 2, Scale: 0, Precision:
0)
+ new Column(nameof(Car.Id), ColumnType.Uuid, IsNullable: false,
IsColocation: true, IsKey: true, SchemaIndex: 0, Scale: 0, Precision: 0),
+ new Column(nameof(Car.BodyType), ColumnType.String, IsNullable:
false, IsColocation: false, IsKey: false, SchemaIndex: 1, Scale: 0, Precision:
0),
+ new Column(nameof(Car.Seats), ColumnType.Int32, IsNullable: false,
IsColocation: false, IsKey: false, SchemaIndex: 2, Scale: 0, Precision: 0)
});
internal static readonly byte[] SerializedData = GetSerializedData();
diff --git a/modules/platforms/dotnet/Apache.Ignite.Tests/FakeServer.cs
b/modules/platforms/dotnet/Apache.Ignite.Tests/FakeServer.cs
index 38786f84a0..f11360057e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Tests/FakeServer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Tests/FakeServer.cs
@@ -261,7 +261,7 @@ namespace Apache.Ignite.Tests
var idx = i * 4;
var name = propTuple.GetString(idx);
- var type = (ClientDataType)propTuple.GetInt(idx + 1);
+ var type = (ColumnType)propTuple.GetInt(idx + 1);
var scale = propTuple.GetInt(idx + 2);
props[name] = propTuple.GetObject(idx + 3, type, scale);
@@ -292,7 +292,7 @@ namespace Apache.Ignite.Tests
writer.WriteArrayHeader(6); // Column props.
writer.Write("NAME"); // Column name.
writer.Write(false); // Nullable.
- writer.Write((int)SqlColumnType.String);
+ writer.Write((int)ColumnType.String);
writer.Write(0); // Scale.
writer.Write(0); // Precision.
writer.Write(false); // No origin.
@@ -300,7 +300,7 @@ namespace Apache.Ignite.Tests
writer.WriteArrayHeader(6); // Column props.
writer.Write("VAL"); // Column name.
writer.Write(false); // Nullable.
- writer.Write((int)SqlColumnType.String);
+ writer.Write((int)ColumnType.String);
writer.Write(0); // Scale.
writer.Write(0); // Precision.
writer.Write(false); // No origin.
@@ -325,7 +325,7 @@ namespace Apache.Ignite.Tests
writer.WriteArrayHeader(6); // Column props.
writer.Write("ID"); // Column name.
writer.Write(false); // Nullable.
- writer.Write((int)SqlColumnType.Int32);
+ writer.Write((int)ColumnType.Int32);
writer.Write(0); // Scale.
writer.Write(0); // Precision.
writer.Write(false); // No origin.
@@ -356,7 +356,7 @@ namespace Apache.Ignite.Tests
writer.WriteArrayHeader(1); // Columns.
writer.WriteArrayHeader(7); // Column props.
writer.Write("ID");
- writer.Write((int)ClientDataType.Int32);
+ writer.Write((int)ColumnType.Int32);
writer.Write(true); // Key.
writer.Write(false); // Nullable.
writer.Write(true); // Colocation.
@@ -369,7 +369,7 @@ namespace Apache.Ignite.Tests
writer.WriteArrayHeader(7); // Column props.
writer.Write("IdStr");
- writer.Write((int)ClientDataType.String);
+ writer.Write((int)ColumnType.String);
writer.Write(true); // Key.
writer.Write(false); // Nullable.
writer.Write(true); // Colocation.
@@ -378,7 +378,7 @@ namespace Apache.Ignite.Tests
writer.WriteArrayHeader(7); // Column props.
writer.Write("IdGuid");
- writer.Write((int)ClientDataType.Uuid);
+ writer.Write((int)ColumnType.Uuid);
writer.Write(true); // Key.
writer.Write(false); // Nullable.
writer.Write(true); // Colocation.
@@ -391,7 +391,7 @@ namespace Apache.Ignite.Tests
writer.WriteArrayHeader(7); // Column props.
writer.Write("IdStr");
- writer.Write((int)ClientDataType.String);
+ writer.Write((int)ColumnType.String);
writer.Write(true); // Key.
writer.Write(false); // Nullable.
writer.Write(true); // Colocation.
@@ -400,7 +400,7 @@ namespace Apache.Ignite.Tests
writer.WriteArrayHeader(7); // Column props.
writer.Write("IdGuid");
- writer.Write((int)ClientDataType.Uuid);
+ writer.Write((int)ColumnType.Uuid);
writer.Write(true); // Key.
writer.Write(false); // Nullable.
writer.Write(false); // Colocation.
diff --git
a/modules/platforms/dotnet/Apache.Ignite.Tests/Linq/ResultSelectorCacheKeyTests.cs
b/modules/platforms/dotnet/Apache.Ignite.Tests/Linq/ResultSelectorCacheKeyTests.cs
index 0f78afb6b8..0fd74a4752 100644
---
a/modules/platforms/dotnet/Apache.Ignite.Tests/Linq/ResultSelectorCacheKeyTests.cs
+++
b/modules/platforms/dotnet/Apache.Ignite.Tests/Linq/ResultSelectorCacheKeyTests.cs
@@ -67,7 +67,7 @@ public class ResultSelectorCacheKeyTests
var columns = GetColumns();
var columns2 = GetColumns();
- columns2[0] = columns2[0] with { Type = SqlColumnType.String };
+ columns2[0] = columns2[0] with { Type = ColumnType.String };
var key1 = new ResultSelectorCacheKey<object>(target, columns);
var key2 = new ResultSelectorCacheKey<object>(target, columns2);
@@ -114,14 +114,14 @@ public class ResultSelectorCacheKeyTests
{
new ColumnMetadata(
Name: "c1",
- Type: SqlColumnType.Date,
+ Type: ColumnType.Date,
Precision: 1,
Scale: 2,
Nullable: true,
Origin: null),
new ColumnMetadata(
Name: "c2",
- Type: SqlColumnType.Float,
+ Type: ColumnType.Float,
Precision: 4,
Scale: 6,
Nullable: false,
diff --git
a/modules/platforms/dotnet/Apache.Ignite.Tests/Proto/BinaryTuple/BinaryTupleTests.cs
b/modules/platforms/dotnet/Apache.Ignite.Tests/Proto/BinaryTuple/BinaryTupleTests.cs
index fbaf5a8e63..ddecbca5bf 100644
---
a/modules/platforms/dotnet/Apache.Ignite.Tests/Proto/BinaryTuple/BinaryTupleTests.cs
+++
b/modules/platforms/dotnet/Apache.Ignite.Tests/Proto/BinaryTuple/BinaryTupleTests.cs
@@ -21,7 +21,7 @@ namespace Apache.Ignite.Tests.Proto.BinaryTuple
using System.Collections;
using System.Linq;
using System.Numerics;
- using Internal.Proto;
+ using Ignite.Sql;
using Internal.Proto.BinaryTuple;
using Internal.Table;
using NodaTime;
@@ -803,43 +803,43 @@ namespace Apache.Ignite.Tests.Proto.BinaryTuple
var reader = BuildAndRead(
(ref BinaryTupleBuilder b) =>
{
- b.AppendObject(null, ClientDataType.String);
- b.AppendObject(sbyte.MaxValue, ClientDataType.Int8);
- b.AppendObject(short.MaxValue, ClientDataType.Int16);
- b.AppendObject(int.MaxValue, ClientDataType.Int32);
- b.AppendObject(long.MaxValue, ClientDataType.Int64);
- b.AppendObject(float.MaxValue, ClientDataType.Float);
- b.AppendObject(double.MaxValue, ClientDataType.Double);
- b.AppendObject(decimal.One, ClientDataType.Decimal);
- b.AppendObject(BigInteger.One, ClientDataType.Number);
- b.AppendObject("foo", ClientDataType.String);
- b.AppendObject(bitArray, ClientDataType.BitMask);
- b.AppendObject(guid, ClientDataType.Uuid);
- b.AppendObject(bytes, ClientDataType.Bytes);
- b.AppendObject(LocalTime.FromMinutesSinceMidnight(123),
ClientDataType.Time, precision: TemporalTypes.MaxTimePrecision);
- b.AppendObject(date, ClientDataType.Date);
- b.AppendObject(dateTime, ClientDataType.DateTime,
precision: TemporalTypes.MaxTimePrecision);
- b.AppendObject(Instant.FromDateTimeUtc(utcNow),
ClientDataType.Timestamp, precision: TemporalTypes.MaxTimePrecision);
+ b.AppendObject(null, ColumnType.String);
+ b.AppendObject(sbyte.MaxValue, ColumnType.Int8);
+ b.AppendObject(short.MaxValue, ColumnType.Int16);
+ b.AppendObject(int.MaxValue, ColumnType.Int32);
+ b.AppendObject(long.MaxValue, ColumnType.Int64);
+ b.AppendObject(float.MaxValue, ColumnType.Float);
+ b.AppendObject(double.MaxValue, ColumnType.Double);
+ b.AppendObject(decimal.One, ColumnType.Decimal);
+ b.AppendObject(BigInteger.One, ColumnType.Number);
+ b.AppendObject("foo", ColumnType.String);
+ b.AppendObject(bitArray, ColumnType.Bitmask);
+ b.AppendObject(guid, ColumnType.Uuid);
+ b.AppendObject(bytes, ColumnType.ByteArray);
+ b.AppendObject(LocalTime.FromMinutesSinceMidnight(123),
ColumnType.Time, precision: TemporalTypes.MaxTimePrecision);
+ b.AppendObject(date, ColumnType.Date);
+ b.AppendObject(dateTime, ColumnType.Datetime, precision:
TemporalTypes.MaxTimePrecision);
+ b.AppendObject(Instant.FromDateTimeUtc(utcNow),
ColumnType.Timestamp, precision: TemporalTypes.MaxTimePrecision);
},
17);
- Assert.IsNull(reader.GetObject(0, ClientDataType.String));
- Assert.AreEqual(sbyte.MaxValue, reader.GetObject(1,
ClientDataType.Int8));
- Assert.AreEqual(short.MaxValue, reader.GetObject(2,
ClientDataType.Int16));
- Assert.AreEqual(int.MaxValue, reader.GetObject(3,
ClientDataType.Int32));
- Assert.AreEqual(long.MaxValue, reader.GetObject(4,
ClientDataType.Int64));
- Assert.AreEqual(float.MaxValue, reader.GetObject(5,
ClientDataType.Float));
- Assert.AreEqual(double.MaxValue, reader.GetObject(6,
ClientDataType.Double));
- Assert.AreEqual(decimal.One, reader.GetObject(7,
ClientDataType.Decimal));
- Assert.AreEqual(BigInteger.One, reader.GetObject(8,
ClientDataType.Number));
- Assert.AreEqual("foo", reader.GetObject(9, ClientDataType.String));
- Assert.AreEqual(bitArray, reader.GetObject(10,
ClientDataType.BitMask));
- Assert.AreEqual(guid, reader.GetObject(11, ClientDataType.Uuid));
- Assert.AreEqual(bytes, reader.GetObject(12, ClientDataType.Bytes));
- Assert.AreEqual(LocalTime.FromMinutesSinceMidnight(123),
reader.GetObject(13, ClientDataType.Time));
- Assert.AreEqual(date, reader.GetObject(14, ClientDataType.Date));
- Assert.AreEqual(dateTime, reader.GetObject(15,
ClientDataType.DateTime));
- Assert.AreEqual(Instant.FromDateTimeUtc(utcNow),
reader.GetObject(16, ClientDataType.Timestamp));
+ Assert.IsNull(reader.GetObject(0, ColumnType.String));
+ Assert.AreEqual(sbyte.MaxValue, reader.GetObject(1,
ColumnType.Int8));
+ Assert.AreEqual(short.MaxValue, reader.GetObject(2,
ColumnType.Int16));
+ Assert.AreEqual(int.MaxValue, reader.GetObject(3,
ColumnType.Int32));
+ Assert.AreEqual(long.MaxValue, reader.GetObject(4,
ColumnType.Int64));
+ Assert.AreEqual(float.MaxValue, reader.GetObject(5,
ColumnType.Float));
+ Assert.AreEqual(double.MaxValue, reader.GetObject(6,
ColumnType.Double));
+ Assert.AreEqual(decimal.One, reader.GetObject(7,
ColumnType.Decimal));
+ Assert.AreEqual(BigInteger.One, reader.GetObject(8,
ColumnType.Number));
+ Assert.AreEqual("foo", reader.GetObject(9, ColumnType.String));
+ Assert.AreEqual(bitArray, reader.GetObject(10,
ColumnType.Bitmask));
+ Assert.AreEqual(guid, reader.GetObject(11, ColumnType.Uuid));
+ Assert.AreEqual(bytes, reader.GetObject(12, ColumnType.ByteArray));
+ Assert.AreEqual(LocalTime.FromMinutesSinceMidnight(123),
reader.GetObject(13, ColumnType.Time));
+ Assert.AreEqual(date, reader.GetObject(14, ColumnType.Date));
+ Assert.AreEqual(dateTime, reader.GetObject(15,
ColumnType.Datetime));
+ Assert.AreEqual(Instant.FromDateTimeUtc(utcNow),
reader.GetObject(16, ColumnType.Timestamp));
}
[Test]
diff --git
a/modules/platforms/dotnet/Apache.Ignite.Tests/Proto/ColocationHashTests.cs
b/modules/platforms/dotnet/Apache.Ignite.Tests/Proto/ColocationHashTests.cs
index 4378f68c0f..aeb8e9f27b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Tests/Proto/ColocationHashTests.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Tests/Proto/ColocationHashTests.cs
@@ -25,9 +25,9 @@ using System.Linq;
using System.Numerics;
using System.Reflection;
using System.Threading.Tasks;
+using Ignite.Sql;
using Ignite.Table;
using Internal.Buffers;
-using Internal.Proto;
using Internal.Proto.BinaryTuple;
using Internal.Proto.MsgPack;
using Internal.Table;
@@ -221,30 +221,30 @@ public class ColocationHashTests : IgniteTestsBase
{
var colType = value switch
{
- sbyte => ClientDataType.Int8,
- short => ClientDataType.Int16,
- int => ClientDataType.Int32,
- long => ClientDataType.Int64,
- float => ClientDataType.Float,
- double => ClientDataType.Double,
- decimal => ClientDataType.Decimal,
- Guid => ClientDataType.Uuid,
- byte[] => ClientDataType.Bytes,
- string => ClientDataType.String,
- BigInteger => ClientDataType.Number,
- BitArray => ClientDataType.BitMask,
- LocalTime => ClientDataType.Time,
- LocalDate => ClientDataType.Date,
- LocalDateTime => ClientDataType.DateTime,
- Instant => ClientDataType.Timestamp,
+ sbyte => ColumnType.Int8,
+ short => ColumnType.Int16,
+ int => ColumnType.Int32,
+ long => ColumnType.Int64,
+ float => ColumnType.Float,
+ double => ColumnType.Double,
+ decimal => ColumnType.Decimal,
+ Guid => ColumnType.Uuid,
+ byte[] => ColumnType.ByteArray,
+ string => ColumnType.String,
+ BigInteger => ColumnType.Number,
+ BitArray => ColumnType.Bitmask,
+ LocalTime => ColumnType.Time,
+ LocalDate => ColumnType.Date,
+ LocalDateTime => ColumnType.Datetime,
+ Instant => ColumnType.Timestamp,
_ => throw new Exception("Unknown type: " + value.GetType())
};
var precision = colType switch
{
- ClientDataType.Time => timePrecision,
- ClientDataType.DateTime => timePrecision,
- ClientDataType.Timestamp => timestampPrecision,
+ ColumnType.Time => timePrecision,
+ ColumnType.Datetime => timePrecision,
+ ColumnType.Timestamp => timestampPrecision,
_ => 0
};
diff --git
a/modules/platforms/dotnet/Apache.Ignite.Tests/Sql/SqlColumnTypeExtensionsTests.cs
b/modules/platforms/dotnet/Apache.Ignite.Tests/Sql/ColumnTypeExtensionsTests.cs
similarity index 56%
rename from
modules/platforms/dotnet/Apache.Ignite.Tests/Sql/SqlColumnTypeExtensionsTests.cs
rename to
modules/platforms/dotnet/Apache.Ignite.Tests/Sql/ColumnTypeExtensionsTests.cs
index ee24a7d481..f74c75ec17 100644
---
a/modules/platforms/dotnet/Apache.Ignite.Tests/Sql/SqlColumnTypeExtensionsTests.cs
+++
b/modules/platforms/dotnet/Apache.Ignite.Tests/Sql/ColumnTypeExtensionsTests.cs
@@ -23,39 +23,39 @@ using Internal.Sql;
using NUnit.Framework;
/// <summary>
-/// Tests for <see cref="SqlColumnTypeExtensions"/>.
+/// Tests for <see cref="ColumnTypeExtensions"/>.
/// </summary>
-public class SqlColumnTypeExtensionsTests
+public class ColumnTypeExtensionsTests
{
- private static readonly SqlColumnType[] SqlColumnTypes =
Enum.GetValues<SqlColumnType>();
+ private static readonly ColumnType[] SqlColumnTypes =
Enum.GetValues<ColumnType>();
[TestCaseSource(nameof(SqlColumnTypes))]
- public void TestToClrType(SqlColumnType sqlColumnType) =>
- Assert.IsNotNull(sqlColumnType.ToClrType(), sqlColumnType.ToString());
+ public void TestToClrType(ColumnType columnType) =>
+ Assert.IsNotNull(columnType.ToClrType(), columnType.ToString());
[TestCaseSource(nameof(SqlColumnTypes))]
- public void TestToSqlColumnType(SqlColumnType sqlColumnType) =>
- Assert.AreEqual(sqlColumnType,
sqlColumnType.ToClrType().ToSqlColumnType());
+ public void TestToSqlColumnType(ColumnType columnType) =>
+ Assert.AreEqual(columnType, columnType.ToClrType().ToColumnType());
[TestCaseSource(nameof(SqlColumnTypes))]
- public void TestSqlColumnTypeToSqlTypeName(SqlColumnType sqlColumnType)
+ public void TestSqlColumnTypeToSqlTypeName(ColumnType columnType)
{
- if (sqlColumnType is SqlColumnType.Duration or SqlColumnType.Period)
+ if (columnType is ColumnType.Duration or ColumnType.Period)
{
return;
}
- Assert.IsNotNull(sqlColumnType.ToSqlTypeName(),
sqlColumnType.ToString());
+ Assert.IsNotNull(columnType.ToSqlTypeName(), columnType.ToString());
}
[TestCaseSource(nameof(SqlColumnTypes))]
- public void TestClrTypeToSqlTypeName(SqlColumnType sqlColumnType)
+ public void TestClrTypeToSqlTypeName(ColumnType columnType)
{
- if (sqlColumnType is SqlColumnType.Duration or SqlColumnType.Period)
+ if (columnType is ColumnType.Duration or ColumnType.Period)
{
return;
}
- Assert.IsNotNull(sqlColumnType.ToClrType().ToSqlTypeName(),
sqlColumnType.ToString());
+ Assert.IsNotNull(columnType.ToClrType().ToSqlTypeName(),
columnType.ToString());
}
}
diff --git
a/modules/platforms/dotnet/Apache.Ignite.Tests/Sql/IgniteDbDataReaderTests.cs
b/modules/platforms/dotnet/Apache.Ignite.Tests/Sql/IgniteDbDataReaderTests.cs
index 6d7184c5e6..caccda6d3b 100644
---
a/modules/platforms/dotnet/Apache.Ignite.Tests/Sql/IgniteDbDataReaderTests.cs
+++
b/modules/platforms/dotnet/Apache.Ignite.Tests/Sql/IgniteDbDataReaderTests.cs
@@ -324,21 +324,21 @@ public class IgniteDbDataReaderTests : IgniteTestsBase
{
await using var reader = await ExecuteReader();
- Test(() => reader.GetBoolean("STR"), "STR", SqlColumnType.String,
typeof(bool), typeof(string));
- Test(() => reader.GetString("INT8"), "INT8", SqlColumnType.Int8,
typeof(string), typeof(sbyte));
- Test(() => reader.GetGuid("INT16"), "INT16", SqlColumnType.Int16,
typeof(Guid), typeof(short));
- Test(() => reader.GetDateTime("INT32"), "INT32", SqlColumnType.Int32,
typeof(DateTime), typeof(int));
- Test(() => reader.GetFloat("INT64"), "INT64", SqlColumnType.Int64,
typeof(float), typeof(long));
- Test(() => reader.GetDouble("INT64"), "INT64", SqlColumnType.Int64,
typeof(double), typeof(long));
- Test(() => reader.GetString("INT64"), "INT64", SqlColumnType.Int64,
typeof(string), typeof(long));
- Test(() => reader.GetByte("STR"), "STR", SqlColumnType.String,
typeof(byte), typeof(string));
- Test(() => reader.GetBytes("STR", 0, null!, 0, 0), "STR",
SqlColumnType.String, typeof(byte[]), typeof(string));
- Test(() => reader.GetDecimal("STR"), "STR", SqlColumnType.String,
typeof(decimal), typeof(string));
- Test(() => reader.GetInt16("STR"), "STR", SqlColumnType.String,
typeof(short), typeof(string));
- Test(() => reader.GetInt32("STR"), "STR", SqlColumnType.String,
typeof(int), typeof(string));
- Test(() => reader.GetInt64("STR"), "STR", SqlColumnType.String,
typeof(long), typeof(string));
-
- static void Test(TestDelegate testDelegate, string columnName,
SqlColumnType columnType, Type expectedType, Type actualType)
+ Test(() => reader.GetBoolean("STR"), "STR", ColumnType.String,
typeof(bool), typeof(string));
+ Test(() => reader.GetString("INT8"), "INT8", ColumnType.Int8,
typeof(string), typeof(sbyte));
+ Test(() => reader.GetGuid("INT16"), "INT16", ColumnType.Int16,
typeof(Guid), typeof(short));
+ Test(() => reader.GetDateTime("INT32"), "INT32", ColumnType.Int32,
typeof(DateTime), typeof(int));
+ Test(() => reader.GetFloat("INT64"), "INT64", ColumnType.Int64,
typeof(float), typeof(long));
+ Test(() => reader.GetDouble("INT64"), "INT64", ColumnType.Int64,
typeof(double), typeof(long));
+ Test(() => reader.GetString("INT64"), "INT64", ColumnType.Int64,
typeof(string), typeof(long));
+ Test(() => reader.GetByte("STR"), "STR", ColumnType.String,
typeof(byte), typeof(string));
+ Test(() => reader.GetBytes("STR", 0, null!, 0, 0), "STR",
ColumnType.String, typeof(byte[]), typeof(string));
+ Test(() => reader.GetDecimal("STR"), "STR", ColumnType.String,
typeof(decimal), typeof(string));
+ Test(() => reader.GetInt16("STR"), "STR", ColumnType.String,
typeof(short), typeof(string));
+ Test(() => reader.GetInt32("STR"), "STR", ColumnType.String,
typeof(int), typeof(string));
+ Test(() => reader.GetInt64("STR"), "STR", ColumnType.String,
typeof(long), typeof(string));
+
+ static void Test(TestDelegate testDelegate, string columnName,
ColumnType columnType, Type expectedType, Type actualType)
{
var ex = Assert.Throws<InvalidCastException>(testDelegate);
diff --git a/modules/platforms/dotnet/Apache.Ignite.Tests/Sql/SqlTests.cs
b/modules/platforms/dotnet/Apache.Ignite.Tests/Sql/SqlTests.cs
index 9fe2011b90..531172cb7e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Tests/Sql/SqlTests.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Tests/Sql/SqlTests.cs
@@ -299,7 +299,7 @@ namespace Apache.Ignite.Tests.Sql
Assert.AreEqual("PUBLIC", columns[0].Origin!.SchemaName);
Assert.AreEqual("TESTDDLDML", columns[0].Origin!.TableName);
Assert.IsTrue(columns[0].Nullable);
- Assert.AreEqual(SqlColumnType.String, columns[0].Type);
+ Assert.AreEqual(ColumnType.String, columns[0].Type);
Assert.AreEqual(int.MinValue, columns[0].Scale);
Assert.AreEqual(65536, columns[0].Precision);
diff --git
a/modules/platforms/dotnet/Apache.Ignite.Tests/Table/Serialization/ObjectSerializerHandlerTests.cs
b/modules/platforms/dotnet/Apache.Ignite.Tests/Table/Serialization/ObjectSerializerHandlerTests.cs
index ffb1a946a0..f1d60d0479 100644
---
a/modules/platforms/dotnet/Apache.Ignite.Tests/Table/Serialization/ObjectSerializerHandlerTests.cs
+++
b/modules/platforms/dotnet/Apache.Ignite.Tests/Table/Serialization/ObjectSerializerHandlerTests.cs
@@ -18,8 +18,8 @@
namespace Apache.Ignite.Tests.Table.Serialization
{
using System;
+ using Ignite.Sql;
using Internal.Buffers;
- using Internal.Proto;
using Internal.Proto.BinaryTuple;
using Internal.Proto.MsgPack;
using Internal.Table;
@@ -34,8 +34,8 @@ namespace Apache.Ignite.Tests.Table.Serialization
{
private static readonly Schema Schema = new(1, 1, new[]
{
- new Column("Key", ClientDataType.Int64, IsNullable: false,
IsColocation: true, IsKey: true, SchemaIndex: 0, Scale: 0, Precision: 0),
- new Column("Val", ClientDataType.String, IsNullable: false,
IsColocation: false, IsKey: false, SchemaIndex: 1, Scale: 0, Precision: 0)
+ new Column("Key", ColumnType.Int64, IsNullable: false,
IsColocation: true, IsKey: true, SchemaIndex: 0, Scale: 0, Precision: 0),
+ new Column("Val", ColumnType.String, IsNullable: false,
IsColocation: false, IsKey: false, SchemaIndex: 1, Scale: 0, Precision: 0)
});
[Test]
diff --git a/modules/platforms/dotnet/Apache.Ignite.sln.DotSettings
b/modules/platforms/dotnet/Apache.Ignite.sln.DotSettings
index 54f20e51da..23b1f4e508 100644
--- a/modules/platforms/dotnet/Apache.Ignite.sln.DotSettings
+++ b/modules/platforms/dotnet/Apache.Ignite.sln.DotSettings
@@ -16,6 +16,7 @@
-->
<wpf:ResourceDictionary xml:space="preserve"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="clr-namespace:System;assembly=mscorlib"
xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml"
xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
+ <s:String
x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SwitchExpressionHandlesSomeKnownEnumValuesWithExceptionInDefault/@EntryIndexedValue">ERROR</s:String>
<s:Int64
x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LIMIT/@EntryValue">140</s:Int64>
<s:Boolean
x:Key="/Default/CodeStyle/CSharpUsing/AddImportsToDeepestScope/@EntryValue">True</s:Boolean>
<s:String
x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IL/@EntryIndexedValue">IL</s:String>
diff --git
a/modules/platforms/dotnet/Apache.Ignite/Internal/Linq/ResultSelector.cs
b/modules/platforms/dotnet/Apache.Ignite/Internal/Linq/ResultSelector.cs
index 59e9c80a48..bafa7fa49b 100644
--- a/modules/platforms/dotnet/Apache.Ignite/Internal/Linq/ResultSelector.cs
+++ b/modules/platforms/dotnet/Apache.Ignite/Internal/Linq/ResultSelector.cs
@@ -87,7 +87,7 @@ internal static class ResultSelector
static k => EmitMemberInitReader<T>(k.Target, k.Columns,
k.Options));
}
- if (columns.Count == 1 && (typeof(T).ToSqlColumnType() is not null ||
typeof(T).IsEnum))
+ if (columns.Count == 1 && (typeof(T).ToColumnType() is not null ||
typeof(T).IsEnum))
{
var singleColumnCacheKey = new
ResultSelectorCacheKey<Type>(typeof(T), columns, options);
@@ -354,7 +354,7 @@ internal static class ResultSelector
il.Emit(OpCodes.Ldarg_1); // Reader.
il.Emit(OpCodes.Ldc_I4, index); // Index.
- if (col.Type == SqlColumnType.Decimal)
+ if (col.Type == ColumnType.Decimal)
{
il.Emit(OpCodes.Ldc_I4, col.Scale);
}
@@ -388,7 +388,7 @@ internal static class ResultSelector
il.Emit(OpCodes.Ldarg_1); // Reader.
il.Emit(OpCodes.Ldc_I4, colIndex); // Index.
- if (col.Type == SqlColumnType.Decimal)
+ if (col.Type == ColumnType.Decimal)
{
il.Emit(OpCodes.Ldc_I4, col.Scale);
}
diff --git
a/modules/platforms/dotnet/Apache.Ignite/Internal/Proto/BinaryTuple/BinaryTupleBuilder.cs
b/modules/platforms/dotnet/Apache.Ignite/Internal/Proto/BinaryTuple/BinaryTupleBuilder.cs
index caee7cd4f9..85535194af 100644
---
a/modules/platforms/dotnet/Apache.Ignite/Internal/Proto/BinaryTuple/BinaryTupleBuilder.cs
+++
b/modules/platforms/dotnet/Apache.Ignite/Internal/Proto/BinaryTuple/BinaryTupleBuilder.cs
@@ -24,6 +24,7 @@ namespace Apache.Ignite.Internal.Proto.BinaryTuple
using System.Numerics;
using System.Runtime.InteropServices;
using Buffers;
+ using Ignite.Sql;
using NodaTime;
using Table;
@@ -877,7 +878,7 @@ namespace Apache.Ignite.Internal.Proto.BinaryTuple
/// <param name="colType">Column type.</param>
/// <param name="scale">Decimal scale.</param>
/// <param name="precision">Precision.</param>
- public void AppendObject(object? value, ClientDataType colType, int
scale = 0, int precision = TemporalTypes.MaxTimePrecision)
+ public void AppendObject(object? value, ColumnType colType, int scale
= 0, int precision = TemporalTypes.MaxTimePrecision)
{
if (value == null)
{
@@ -887,67 +888,67 @@ namespace Apache.Ignite.Internal.Proto.BinaryTuple
switch (colType)
{
- case ClientDataType.Int8:
+ case ColumnType.Int8:
AppendByte((sbyte)value);
break;
- case ClientDataType.Int16:
+ case ColumnType.Int16:
AppendShort((short)value);
break;
- case ClientDataType.Int32:
+ case ColumnType.Int32:
AppendInt((int)value);
break;
- case ClientDataType.Int64:
+ case ColumnType.Int64:
AppendLong((long)value);
break;
- case ClientDataType.Float:
+ case ColumnType.Float:
AppendFloat((float)value);
break;
- case ClientDataType.Double:
+ case ColumnType.Double:
AppendDouble((double)value);
break;
- case ClientDataType.Uuid:
+ case ColumnType.Uuid:
AppendGuid((Guid)value);
break;
- case ClientDataType.String:
+ case ColumnType.String:
AppendString((string)value);
break;
- case ClientDataType.Bytes:
+ case ColumnType.ByteArray:
AppendBytes((byte[])value);
break;
- case ClientDataType.BitMask:
+ case ColumnType.Bitmask:
AppendBitmask((BitArray)value);
break;
- case ClientDataType.Decimal:
+ case ColumnType.Decimal:
AppendDecimal((decimal)value, scale);
break;
- case ClientDataType.Number:
+ case ColumnType.Number:
AppendNumber((BigInteger)value);
break;
- case ClientDataType.Date:
+ case ColumnType.Date:
AppendDate((LocalDate)value);
break;
- case ClientDataType.Time:
+ case ColumnType.Time:
AppendTime((LocalTime)value, precision);
break;
- case ClientDataType.DateTime:
+ case ColumnType.Datetime:
AppendDateTime((LocalDateTime)value, precision);
break;
- case ClientDataType.Timestamp:
+ case ColumnType.Timestamp:
AppendTimestamp((Instant)value, precision);
break;
@@ -976,83 +977,83 @@ namespace Apache.Ignite.Internal.Proto.BinaryTuple
break;
case int i32:
- AppendTypeAndScale(ClientDataType.Int32);
+ AppendTypeAndScale(ColumnType.Int32);
AppendInt(i32);
break;
case long i64:
- AppendTypeAndScale(ClientDataType.Int64);
+ AppendTypeAndScale(ColumnType.Int64);
AppendLong(i64);
break;
case string str:
- AppendTypeAndScale(ClientDataType.String);
+ AppendTypeAndScale(ColumnType.String);
AppendString(str);
break;
case Guid uuid:
- AppendTypeAndScale(ClientDataType.Uuid);
+ AppendTypeAndScale(ColumnType.Uuid);
AppendGuid(uuid);
break;
case sbyte i8:
- AppendTypeAndScale(ClientDataType.Int8);
+ AppendTypeAndScale(ColumnType.Int8);
AppendByte(i8);
break;
case short i16:
- AppendTypeAndScale(ClientDataType.Int16);
+ AppendTypeAndScale(ColumnType.Int16);
AppendShort(i16);
break;
case float f32:
- AppendTypeAndScale(ClientDataType.Float);
+ AppendTypeAndScale(ColumnType.Float);
AppendFloat(f32);
break;
case double f64:
- AppendTypeAndScale(ClientDataType.Double);
+ AppendTypeAndScale(ColumnType.Double);
AppendDouble(f64);
break;
case byte[] bytes:
- AppendTypeAndScale(ClientDataType.Bytes);
+ AppendTypeAndScale(ColumnType.ByteArray);
AppendBytes(bytes);
break;
case decimal dec:
var scale = GetDecimalScale(dec);
- AppendTypeAndScale(ClientDataType.Decimal, scale);
+ AppendTypeAndScale(ColumnType.Decimal, scale);
AppendDecimal(dec, scale);
break;
case BigInteger bigInt:
- AppendTypeAndScale(ClientDataType.Number);
+ AppendTypeAndScale(ColumnType.Number);
AppendNumber(bigInt);
break;
case LocalDate localDate:
- AppendTypeAndScale(ClientDataType.Date);
+ AppendTypeAndScale(ColumnType.Date);
AppendDate(localDate);
break;
case LocalTime localTime:
- AppendTypeAndScale(ClientDataType.Time);
+ AppendTypeAndScale(ColumnType.Time);
AppendTime(localTime, timePrecision);
break;
case LocalDateTime localDateTime:
- AppendTypeAndScale(ClientDataType.DateTime);
+ AppendTypeAndScale(ColumnType.Datetime);
AppendDateTime(localDateTime, timePrecision);
break;
case Instant instant:
- AppendTypeAndScale(ClientDataType.Timestamp);
+ AppendTypeAndScale(ColumnType.Timestamp);
AppendTimestamp(instant, timestampPrecision);
break;
case BitArray bitArray:
- AppendTypeAndScale(ClientDataType.BitMask);
+ AppendTypeAndScale(ColumnType.Bitmask);
AppendBitmask(bitArray);
break;
@@ -1349,7 +1350,7 @@ namespace Apache.Ignite.Internal.Proto.BinaryTuple
buf[1..].CopyTo(GetSpan(3));
}
- private void AppendTypeAndScale(ClientDataType type, int scale = 0)
+ private void AppendTypeAndScale(ColumnType type, int scale = 0)
{
AppendInt((int)type);
AppendInt(scale);
diff --git
a/modules/platforms/dotnet/Apache.Ignite/Internal/Proto/BinaryTuple/BinaryTupleReader.cs
b/modules/platforms/dotnet/Apache.Ignite/Internal/Proto/BinaryTuple/BinaryTupleReader.cs
index fdb1ac0d69..017fa77e02 100644
---
a/modules/platforms/dotnet/Apache.Ignite/Internal/Proto/BinaryTuple/BinaryTupleReader.cs
+++
b/modules/platforms/dotnet/Apache.Ignite/Internal/Proto/BinaryTuple/BinaryTupleReader.cs
@@ -22,6 +22,7 @@ namespace Apache.Ignite.Internal.Proto.BinaryTuple
using System.Collections;
using System.Diagnostics;
using System.Numerics;
+ using Ignite.Sql;
using NodaTime;
/// <summary>
@@ -477,7 +478,7 @@ namespace Apache.Ignite.Internal.Proto.BinaryTuple
/// <param name="columnType">Column type.</param>
/// <param name="scale">Column decimal scale.</param>
/// <returns>Value.</returns>
- public object? GetObject(int index, ClientDataType columnType, int
scale = 0)
+ public object? GetObject(int index, ColumnType columnType, int scale =
0)
{
if (IsNull(index))
{
@@ -486,22 +487,25 @@ namespace Apache.Ignite.Internal.Proto.BinaryTuple
return columnType switch
{
- ClientDataType.Int8 => GetByte(index),
- ClientDataType.Int16 => GetShort(index),
- ClientDataType.Int32 => GetInt(index),
- ClientDataType.Int64 => GetLong(index),
- ClientDataType.Float => GetFloat(index),
- ClientDataType.Double => GetDouble(index),
- ClientDataType.Uuid => GetGuid(index),
- ClientDataType.String => GetString(index),
- ClientDataType.Decimal => GetDecimal(index, scale),
- ClientDataType.Bytes => GetBytes(index),
- ClientDataType.BitMask => GetBitmask(index),
- ClientDataType.Date => GetDate(index),
- ClientDataType.Time => GetTime(index),
- ClientDataType.DateTime => GetDateTime(index),
- ClientDataType.Timestamp => GetTimestamp(index),
- ClientDataType.Number => GetNumber(index),
+ ColumnType.Int8 => GetByte(index),
+ ColumnType.Int16 => GetShort(index),
+ ColumnType.Int32 => GetInt(index),
+ ColumnType.Int64 => GetLong(index),
+ ColumnType.Float => GetFloat(index),
+ ColumnType.Double => GetDouble(index),
+ ColumnType.Uuid => GetGuid(index),
+ ColumnType.String => GetString(index),
+ ColumnType.Decimal => GetDecimal(index, scale),
+ ColumnType.ByteArray => GetBytes(index),
+ ColumnType.Bitmask => GetBitmask(index),
+ ColumnType.Date => GetDate(index),
+ ColumnType.Time => GetTime(index),
+ ColumnType.Datetime => GetDateTime(index),
+ ColumnType.Timestamp => GetTimestamp(index),
+ ColumnType.Number => GetNumber(index),
+ ColumnType.Boolean => GetByteAsBool(index),
+ ColumnType.Period => GetPeriod(index),
+ ColumnType.Duration => GetDuration(index),
_ => throw new
IgniteClientException(ErrorGroups.Client.Protocol, "Unsupported type: " +
columnType)
};
}
@@ -518,7 +522,7 @@ namespace Apache.Ignite.Internal.Proto.BinaryTuple
return null;
}
- var type = (ClientDataType)GetInt(index);
+ var type = (ColumnType)GetInt(index);
var scale = GetInt(index + 1);
return GetObject(index + 2, type, scale);
diff --git
a/modules/platforms/dotnet/Apache.Ignite/Internal/Proto/ClientDataType.cs
b/modules/platforms/dotnet/Apache.Ignite/Internal/Proto/ClientDataType.cs
deleted file mode 100644
index b21edddae7..0000000000
--- a/modules/platforms/dotnet/Apache.Ignite/Internal/Proto/ClientDataType.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Internal.Proto
-{
- using System.Diagnostics.CodeAnalysis;
-
- /// <summary>
- /// Client data types.
- /// </summary>
- [SuppressMessage("Microsoft.Naming",
"CA1720:IdentifiersShouldNotContainTypeNames", Justification = "Internal
types.")]
- internal enum ClientDataType
- {
- /// <summary> None. </summary>
- None = 0,
-
- /// <summary> Byte. </summary>
- Int8 = 1,
-
- /// <summary> Short. </summary>
- Int16 = 2,
-
- /// <summary> Int. </summary>
- Int32 = 3,
-
- /// <summary> Long. </summary>
- Int64 = 4,
-
- /// <summary> Float. </summary>
- Float = 5,
-
- /// <summary> Double. </summary>
- Double = 6,
-
- /// <summary> Decimal. </summary>
- Decimal = 7,
-
- /// <summary> UUID / Guid. </summary>
- Uuid = 8,
-
- /// <summary> String. </summary>
- String = 9,
-
- /// <summary> Byte array. </summary>
- Bytes = 10,
-
- /// <summary> BitMask. </summary>
- BitMask = 11,
-
- /// <summary> Local date. </summary>
- Date = 12,
-
- /// <summary> Local time. </summary>
- Time = 13,
-
- /// <summary> Local date and time. </summary>
- DateTime = 14,
-
- /// <summary> Timestamp (instant). </summary>
- Timestamp = 15,
-
- /// <summary> Number (BigInt). </summary>
- Number = 16,
- }
-}
diff --git
a/modules/platforms/dotnet/Apache.Ignite/Internal/Proto/ClientDataTypeExtensions.cs
b/modules/platforms/dotnet/Apache.Ignite/Internal/Proto/ClientDataTypeExtensions.cs
deleted file mode 100644
index 5c6a73673e..0000000000
---
a/modules/platforms/dotnet/Apache.Ignite/Internal/Proto/ClientDataTypeExtensions.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Internal.Proto
-{
- using System;
- using System.Collections;
- using System.Numerics;
- using NodaTime;
-
- /// <summary>
- /// Extension methods for <see cref="ClientDataType"/>.
- /// </summary>
- internal static class ClientDataTypeExtensions
- {
- /// <summary>
- /// Converts client data type to <see cref="Type"/>.
- /// </summary>
- /// <param name="clientDataType">Client data type.</param>
- /// <returns>Corresponding CLR type.</returns>
- public static Type ToType(this ClientDataType clientDataType) =>
clientDataType switch
- {
- ClientDataType.Int8 => typeof(sbyte),
- ClientDataType.Int16 => typeof(short),
- ClientDataType.Int32 => typeof(int),
- ClientDataType.Int64 => typeof(long),
- ClientDataType.Float => typeof(float),
- ClientDataType.Double => typeof(double),
- ClientDataType.Decimal => typeof(decimal),
- ClientDataType.Uuid => typeof(Guid),
- ClientDataType.String => typeof(string),
- ClientDataType.Bytes => typeof(byte[]),
- ClientDataType.BitMask => typeof(BitArray),
- ClientDataType.Date => typeof(LocalDate),
- ClientDataType.Time => typeof(LocalTime),
- ClientDataType.DateTime => typeof(LocalDateTime),
- ClientDataType.Timestamp => typeof(Instant),
- ClientDataType.Number => typeof(BigInteger),
- _ => throw new ArgumentOutOfRangeException(nameof(clientDataType),
clientDataType, null)
- };
- }
-}
diff --git
a/modules/platforms/dotnet/Apache.Ignite/Internal/Proto/ClientOpExtensions.cs
b/modules/platforms/dotnet/Apache.Ignite/Internal/Proto/ClientOpExtensions.cs
index 3233c0f958..9f8c5b3616 100644
---
a/modules/platforms/dotnet/Apache.Ignite/Internal/Proto/ClientOpExtensions.cs
+++
b/modules/platforms/dotnet/Apache.Ignite/Internal/Proto/ClientOpExtensions.cs
@@ -65,7 +65,8 @@ namespace Apache.Ignite.Internal.Proto
ClientOp.PartitionAssignmentGet => null,
// Do not return null from default arm intentionally so we
don't forget to update this when new ClientOp values are added.
- _ => throw new ArgumentOutOfRangeException(nameof(op), op,
message: null)
+ // ReSharper disable once PatternIsRedundant
+ ClientOp.None or _ => throw new
ArgumentOutOfRangeException(nameof(op), op, message: null)
};
}
}
diff --git
a/modules/platforms/dotnet/Apache.Ignite/Internal/Proto/MsgPack/MsgPackReader.cs
b/modules/platforms/dotnet/Apache.Ignite/Internal/Proto/MsgPack/MsgPackReader.cs
index 928454166d..d4dabf717b 100644
---
a/modules/platforms/dotnet/Apache.Ignite/Internal/Proto/MsgPack/MsgPackReader.cs
+++
b/modules/platforms/dotnet/Apache.Ignite/Internal/Proto/MsgPack/MsgPackReader.cs
@@ -21,6 +21,7 @@ using System;
using System.Buffers.Binary;
using System.IO;
using BinaryTuple;
+using Ignite.Sql;
/// <summary>
/// MsgPack reader.
@@ -376,7 +377,7 @@ internal ref struct MsgPackReader
}
/// <summary>
- /// Reads <see cref="ClientDataType"/> and value.
+ /// Reads <see cref="ColumnType"/> and value.
/// </summary>
/// <returns>Value.</returns>
public object? ReadObjectFromBinaryTuple()
diff --git
a/modules/platforms/dotnet/Apache.Ignite/Internal/Sql/ColumnMetadata.cs
b/modules/platforms/dotnet/Apache.Ignite/Internal/Sql/ColumnMetadata.cs
index 0abb31a611..15261e16fb 100644
--- a/modules/platforms/dotnet/Apache.Ignite/Internal/Sql/ColumnMetadata.cs
+++ b/modules/platforms/dotnet/Apache.Ignite/Internal/Sql/ColumnMetadata.cs
@@ -19,6 +19,6 @@ namespace Apache.Ignite.Internal.Sql
{
using Ignite.Sql;
- internal sealed record ColumnMetadata(string Name, SqlColumnType Type, int
Precision, int Scale, bool Nullable, IColumnOrigin? Origin)
+ internal sealed record ColumnMetadata(string Name, ColumnType Type, int
Precision, int Scale, bool Nullable, IColumnOrigin? Origin)
: IColumnMetadata;
}
diff --git
a/modules/platforms/dotnet/Apache.Ignite/Internal/Sql/ColumnTypeExtensions.cs
b/modules/platforms/dotnet/Apache.Ignite/Internal/Sql/ColumnTypeExtensions.cs
new file mode 100644
index 0000000000..470d120783
--- /dev/null
+++
b/modules/platforms/dotnet/Apache.Ignite/Internal/Sql/ColumnTypeExtensions.cs
@@ -0,0 +1,145 @@
+/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Internal.Sql;
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Numerics;
+using Ignite.Sql;
+using NodaTime;
+
+/// <summary>
+/// Extension methods for <see cref="ColumnType"/>.
+/// </summary>
+internal static class ColumnTypeExtensions
+{
+ private static readonly IReadOnlyDictionary<Type, ColumnType> ClrToSql =
+ Enum.GetValues<ColumnType>().ToDictionary(x => x.ToClrType(), x => x);
+
+ private static readonly IReadOnlyDictionary<Type, string> ClrToSqlName =
+ Enum.GetValues<ColumnType>()
+ .Where(x => x != ColumnType.Period && x != ColumnType.Duration)
+ .ToDictionary(x => x.ToClrType(), x => x.ToSqlTypeName());
+
+ /// <summary>
+ /// Gets corresponding .NET type.
+ /// </summary>
+ /// <param name="columnType">SQL column type.</param>
+ /// <returns>CLR type.</returns>
+ public static Type ToClrType(this ColumnType columnType) => columnType
switch
+ {
+ ColumnType.Boolean => typeof(bool),
+ ColumnType.Int8 => typeof(sbyte),
+ ColumnType.Int16 => typeof(short),
+ ColumnType.Int32 => typeof(int),
+ ColumnType.Int64 => typeof(long),
+ ColumnType.Float => typeof(float),
+ ColumnType.Double => typeof(double),
+ ColumnType.Decimal => typeof(decimal),
+ ColumnType.Date => typeof(LocalDate),
+ ColumnType.Time => typeof(LocalTime),
+ ColumnType.Datetime => typeof(LocalDateTime),
+ ColumnType.Timestamp => typeof(Instant),
+ ColumnType.Uuid => typeof(Guid),
+ ColumnType.Bitmask => typeof(BitArray),
+ ColumnType.String => typeof(string),
+ ColumnType.ByteArray => typeof(byte[]),
+ ColumnType.Period => typeof(Period),
+ ColumnType.Duration => typeof(Duration),
+ ColumnType.Number => typeof(BigInteger),
+ _ => throw new InvalidOperationException($"Invalid
{nameof(ColumnType)}: {columnType}")
+ };
+
+ /// <summary>
+ /// Gets corresponding .NET type.
+ /// </summary>
+ /// <param name="columnType">SQL column type.</param>
+ /// <param name="nullable">Whether the SQL column is nullable.</param>
+ /// <returns>CLR type.</returns>
+ public static Type ToClrType(this ColumnType columnType, bool nullable)
+ {
+ var clrType = columnType.ToClrType();
+
+ return nullable && clrType.IsValueType ?
typeof(Nullable<>).MakeGenericType(clrType) : clrType;
+ }
+
+ /// <summary>
+ /// Gets corresponding SQL type name.
+ /// </summary>
+ /// <param name="columnType">SQL column type.</param>
+ /// <returns>SQL type name.</returns>
+ public static string ToSqlTypeName(this ColumnType columnType) =>
columnType switch
+ {
+ ColumnType.Boolean => "boolean",
+ ColumnType.Int8 => "tinyint",
+ ColumnType.Int16 => "smallint",
+ ColumnType.Int32 => "int",
+ ColumnType.Int64 => "bigint",
+ ColumnType.Float => "real",
+ ColumnType.Double => "double",
+ ColumnType.Decimal => "decimal",
+ ColumnType.Date => "date",
+ ColumnType.Time => "time",
+ ColumnType.Datetime => "timestamp",
+ ColumnType.Timestamp => "timestamp_tz",
+ ColumnType.Uuid => "uuid",
+ ColumnType.Bitmask => "bitmap",
+ ColumnType.String => "varchar",
+ ColumnType.ByteArray => "varbinary",
+ ColumnType.Number => "numeric",
+ ColumnType.Period => "interval",
+ ColumnType.Duration => "duration",
+ _ => throw new InvalidOperationException($"Unsupported
{nameof(ColumnType)}: {columnType}")
+ };
+
+ /// <summary>
+ /// Gets corresponding SQL type name.
+ /// </summary>
+ /// <param name="type">CLR type.</param>
+ /// <returns>SQL type name.</returns>
+ public static string ToSqlTypeName(this Type type) =>
+ ClrToSqlName.TryGetValue(Nullable.GetUnderlyingType(type) ?? type, out
var sqlTypeName)
+ ? sqlTypeName
+ : throw new InvalidOperationException($"Type is not supported in
SQL: {type}");
+
+ /// <summary>
+ /// Gets corresponding <see cref="ColumnType"/>.
+ /// </summary>
+ /// <param name="type">Type.</param>
+ /// <returns>SQL column type, or null.</returns>
+ public static ColumnType? ToColumnType(this Type type) =>
+ ClrToSql.TryGetValue(Nullable.GetUnderlyingType(type) ?? type, out var
sqlType) ? sqlType : null;
+
+ /// <summary>
+ /// Gets a value indicating whether specified column type is an integer of
any size (int8 to int64).
+ /// </summary>
+ /// <param name="columnType">SQL column type.</param>
+ /// <returns>Whether the type is integer.</returns>
+ public static bool IsAnyInt(this ColumnType columnType) =>
+ columnType is ColumnType.Int8 or ColumnType.Int16 or ColumnType.Int32
or ColumnType.Int64;
+
+ /// <summary>
+ /// Gets a value indicating whether specified column type is a floating
point of any size (float32 to float64).
+ /// </summary>
+ /// <param name="columnType">SQL column type.</param>
+ /// <returns>Whether the type is floating point.</returns>
+ public static bool IsAnyFloat(this ColumnType columnType) =>
+ columnType is ColumnType.Float or ColumnType.Double;
+}
diff --git a/modules/platforms/dotnet/Apache.Ignite/Internal/Sql/ResultSet.cs
b/modules/platforms/dotnet/Apache.Ignite/Internal/Sql/ResultSet.cs
index 5d33a64731..dd08381ea1 100644
--- a/modules/platforms/dotnet/Apache.Ignite/Internal/Sql/ResultSet.cs
+++ b/modules/platforms/dotnet/Apache.Ignite/Internal/Sql/ResultSet.cs
@@ -292,7 +292,7 @@ namespace Apache.Ignite.Internal.Sql
var name = reader.ReadString();
var nullable = reader.ReadBoolean();
- var type = (SqlColumnType)reader.ReadInt32();
+ var type = (ColumnType)reader.ReadInt32();
var scale = reader.ReadInt32();
var precision = reader.ReadInt32();
diff --git a/modules/platforms/dotnet/Apache.Ignite/Internal/Sql/Sql.cs
b/modules/platforms/dotnet/Apache.Ignite/Internal/Sql/Sql.cs
index c977285951..0b940d2280 100644
--- a/modules/platforms/dotnet/Apache.Ignite/Internal/Sql/Sql.cs
+++ b/modules/platforms/dotnet/Apache.Ignite/Internal/Sql/Sql.cs
@@ -93,25 +93,25 @@ namespace Apache.Ignite.Internal.Sql
return col.Type switch
{
- SqlColumnType.Boolean => reader.GetByteAsBool(idx),
- SqlColumnType.Int8 => reader.GetByte(idx),
- SqlColumnType.Int16 => reader.GetShort(idx),
- SqlColumnType.Int32 => reader.GetInt(idx),
- SqlColumnType.Int64 => reader.GetLong(idx),
- SqlColumnType.Float => reader.GetFloat(idx),
- SqlColumnType.Double => reader.GetDouble(idx),
- SqlColumnType.Decimal => reader.GetDecimal(idx, col.Scale),
- SqlColumnType.Date => reader.GetDate(idx),
- SqlColumnType.Time => reader.GetTime(idx),
- SqlColumnType.Datetime => reader.GetDateTime(idx),
- SqlColumnType.Timestamp => reader.GetTimestamp(idx),
- SqlColumnType.Uuid => reader.GetGuid(idx),
- SqlColumnType.Bitmask => reader.GetBitmask(idx),
- SqlColumnType.String => reader.GetString(idx),
- SqlColumnType.ByteArray => reader.GetBytes(idx),
- SqlColumnType.Period => reader.GetPeriod(idx),
- SqlColumnType.Duration => reader.GetDuration(idx),
- SqlColumnType.Number => reader.GetNumber(idx),
+ ColumnType.Boolean => reader.GetByteAsBool(idx),
+ ColumnType.Int8 => reader.GetByte(idx),
+ ColumnType.Int16 => reader.GetShort(idx),
+ ColumnType.Int32 => reader.GetInt(idx),
+ ColumnType.Int64 => reader.GetLong(idx),
+ ColumnType.Float => reader.GetFloat(idx),
+ ColumnType.Double => reader.GetDouble(idx),
+ ColumnType.Decimal => reader.GetDecimal(idx, col.Scale),
+ ColumnType.Date => reader.GetDate(idx),
+ ColumnType.Time => reader.GetTime(idx),
+ ColumnType.Datetime => reader.GetDateTime(idx),
+ ColumnType.Timestamp => reader.GetTimestamp(idx),
+ ColumnType.Uuid => reader.GetGuid(idx),
+ ColumnType.Bitmask => reader.GetBitmask(idx),
+ ColumnType.String => reader.GetString(idx),
+ ColumnType.ByteArray => reader.GetBytes(idx),
+ ColumnType.Period => reader.GetPeriod(idx),
+ ColumnType.Duration => reader.GetDuration(idx),
+ ColumnType.Number => reader.GetNumber(idx),
_ => throw new ArgumentOutOfRangeException(nameof(col.Type),
col.Type, "Unknown SQL column type.")
};
}
diff --git
a/modules/platforms/dotnet/Apache.Ignite/Internal/Sql/SqlColumnTypeExtensions.cs
b/modules/platforms/dotnet/Apache.Ignite/Internal/Sql/SqlColumnTypeExtensions.cs
deleted file mode 100644
index 9b331d05c5..0000000000
---
a/modules/platforms/dotnet/Apache.Ignite/Internal/Sql/SqlColumnTypeExtensions.cs
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Internal.Sql;
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using System.Numerics;
-using Ignite.Sql;
-using NodaTime;
-
-/// <summary>
-/// Extension methods for <see cref="SqlColumnType"/>.
-/// </summary>
-internal static class SqlColumnTypeExtensions
-{
- private static readonly IReadOnlyDictionary<Type, SqlColumnType> ClrToSql =
- Enum.GetValues<SqlColumnType>().ToDictionary(x => x.ToClrType(), x =>
x);
-
- private static readonly IReadOnlyDictionary<Type, string> ClrToSqlName =
- Enum.GetValues<SqlColumnType>()
- .Where(x => x != SqlColumnType.Period && x !=
SqlColumnType.Duration)
- .ToDictionary(x => x.ToClrType(), x => x.ToSqlTypeName());
-
- /// <summary>
- /// Gets corresponding .NET type.
- /// </summary>
- /// <param name="sqlColumnType">SQL column type.</param>
- /// <returns>CLR type.</returns>
- public static Type ToClrType(this SqlColumnType sqlColumnType) =>
sqlColumnType switch
- {
- SqlColumnType.Boolean => typeof(bool),
- SqlColumnType.Int8 => typeof(sbyte),
- SqlColumnType.Int16 => typeof(short),
- SqlColumnType.Int32 => typeof(int),
- SqlColumnType.Int64 => typeof(long),
- SqlColumnType.Float => typeof(float),
- SqlColumnType.Double => typeof(double),
- SqlColumnType.Decimal => typeof(decimal),
- SqlColumnType.Date => typeof(LocalDate),
- SqlColumnType.Time => typeof(LocalTime),
- SqlColumnType.Datetime => typeof(LocalDateTime),
- SqlColumnType.Timestamp => typeof(Instant),
- SqlColumnType.Uuid => typeof(Guid),
- SqlColumnType.Bitmask => typeof(BitArray),
- SqlColumnType.String => typeof(string),
- SqlColumnType.ByteArray => typeof(byte[]),
- SqlColumnType.Period => typeof(Period),
- SqlColumnType.Duration => typeof(Duration),
- SqlColumnType.Number => typeof(BigInteger),
- _ => throw new InvalidOperationException($"Invalid
{nameof(SqlColumnType)}: {sqlColumnType}")
- };
-
- /// <summary>
- /// Gets corresponding .NET type.
- /// </summary>
- /// <param name="sqlColumnType">SQL column type.</param>
- /// <param name="nullable">Whether the SQL column is nullable.</param>
- /// <returns>CLR type.</returns>
- public static Type ToClrType(this SqlColumnType sqlColumnType, bool
nullable)
- {
- var clrType = sqlColumnType.ToClrType();
-
- return nullable && clrType.IsValueType ?
typeof(Nullable<>).MakeGenericType(clrType) : clrType;
- }
-
- /// <summary>
- /// Gets corresponding SQL type name.
- /// </summary>
- /// <param name="sqlColumnType">SQL column type.</param>
- /// <returns>SQL type name.</returns>
- public static string ToSqlTypeName(this SqlColumnType sqlColumnType) =>
sqlColumnType switch
- {
- SqlColumnType.Boolean => "boolean",
- SqlColumnType.Int8 => "tinyint",
- SqlColumnType.Int16 => "smallint",
- SqlColumnType.Int32 => "int",
- SqlColumnType.Int64 => "bigint",
- SqlColumnType.Float => "real",
- SqlColumnType.Double => "double",
- SqlColumnType.Decimal => "decimal",
- SqlColumnType.Date => "date",
- SqlColumnType.Time => "time",
- SqlColumnType.Datetime => "timestamp",
- SqlColumnType.Timestamp => "timestamp_tz",
- SqlColumnType.Uuid => "uuid",
- SqlColumnType.Bitmask => "bitmap",
- SqlColumnType.String => "varchar",
- SqlColumnType.ByteArray => "varbinary",
- SqlColumnType.Number => "numeric",
- _ => throw new InvalidOperationException($"Unsupported
{nameof(SqlColumnType)}: {sqlColumnType}")
- };
-
- /// <summary>
- /// Gets corresponding SQL type name.
- /// </summary>
- /// <param name="type">CLR type.</param>
- /// <returns>SQL type name.</returns>
- public static string ToSqlTypeName(this Type type) =>
- ClrToSqlName.TryGetValue(Nullable.GetUnderlyingType(type) ?? type, out
var sqlTypeName)
- ? sqlTypeName
- : throw new InvalidOperationException($"Type is not supported in
SQL: {type}");
-
- /// <summary>
- /// Gets corresponding <see cref="SqlColumnType"/>.
- /// </summary>
- /// <param name="type">Type.</param>
- /// <returns>SQL column type, or null.</returns>
- public static SqlColumnType? ToSqlColumnType(this Type type) =>
- ClrToSql.TryGetValue(Nullable.GetUnderlyingType(type) ?? type, out var
sqlType) ? sqlType : null;
-
- /// <summary>
- /// Gets a value indicating whether specified column type is an integer of
any size (int8 to int64).
- /// </summary>
- /// <param name="sqlColumnType">SQL column type.</param>
- /// <returns>Whether the type is integer.</returns>
- public static bool IsAnyInt(this SqlColumnType sqlColumnType) =>
- sqlColumnType is SqlColumnType.Int8 or SqlColumnType.Int16 or
SqlColumnType.Int32 or SqlColumnType.Int64;
-
- /// <summary>
- /// Gets a value indicating whether specified column type is a floating
point of any size (float32 to float64).
- /// </summary>
- /// <param name="sqlColumnType">SQL column type.</param>
- /// <returns>Whether the type is floating point.</returns>
- public static bool IsAnyFloat(this SqlColumnType sqlColumnType) =>
- sqlColumnType is SqlColumnType.Float or SqlColumnType.Double;
-}
diff --git a/modules/platforms/dotnet/Apache.Ignite/Internal/Table/Column.cs
b/modules/platforms/dotnet/Apache.Ignite/Internal/Table/Column.cs
index 0db3ab6972..a4686e699f 100644
--- a/modules/platforms/dotnet/Apache.Ignite/Internal/Table/Column.cs
+++ b/modules/platforms/dotnet/Apache.Ignite/Internal/Table/Column.cs
@@ -15,20 +15,19 @@
* limitations under the License.
*/
-namespace Apache.Ignite.Internal.Table
-{
- using Proto;
+namespace Apache.Ignite.Internal.Table;
- /// <summary>
- /// Schema column.
- /// </summary>
- internal record Column(
- string Name,
- ClientDataType Type,
- bool IsNullable,
- bool IsColocation,
- bool IsKey,
- int SchemaIndex,
- int Scale,
- int Precision);
-}
+using Ignite.Sql;
+
+/// <summary>
+/// Schema column.
+/// </summary>
+internal record Column(
+ string Name,
+ ColumnType Type,
+ bool IsNullable,
+ bool IsColocation,
+ bool IsKey,
+ int SchemaIndex,
+ int Scale,
+ int Precision);
diff --git
a/modules/platforms/dotnet/Apache.Ignite/Internal/Table/Serialization/ObjectSerializerHandler.cs
b/modules/platforms/dotnet/Apache.Ignite/Internal/Table/Serialization/ObjectSerializerHandler.cs
index 040b58bddb..c9fd1db517 100644
---
a/modules/platforms/dotnet/Apache.Ignite/Internal/Table/Serialization/ObjectSerializerHandler.cs
+++
b/modules/platforms/dotnet/Apache.Ignite/Internal/Table/Serialization/ObjectSerializerHandler.cs
@@ -25,9 +25,10 @@ namespace Apache.Ignite.Internal.Table.Serialization
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
- using Proto;
+ using Ignite.Sql;
using Proto.BinaryTuple;
using Proto.MsgPack;
+ using Sql;
/// <summary>
/// Object serializer handler.
@@ -102,11 +103,11 @@ namespace Apache.Ignite.Internal.Table.Serialization
il.Emit(OpCodes.Ldarg_0); // writer
il.Emit(OpCodes.Ldarg_2); // value
- if (col.Type == ClientDataType.Decimal)
+ if (col.Type == ColumnType.Decimal)
{
il.Emit(OpCodes.Ldc_I4, col.Scale);
}
- else if (col.Type is ClientDataType.Time or
ClientDataType.DateTime or ClientDataType.Timestamp)
+ else if (col.Type is ColumnType.Time or ColumnType.Datetime or
ColumnType.Timestamp)
{
il.Emit(OpCodes.Ldc_I4, col.Precision);
}
@@ -145,11 +146,11 @@ namespace Apache.Ignite.Internal.Table.Serialization
il.Emit(OpCodes.Ldarg_2); // record
il.Emit(OpCodes.Ldfld, fieldInfo);
- if (col.Type == ClientDataType.Decimal)
+ if (col.Type == ColumnType.Decimal)
{
il.Emit(OpCodes.Ldc_I4, col.Scale);
}
- else if (col.Type is ClientDataType.Time or
ClientDataType.DateTime or ClientDataType.Timestamp)
+ else if (col.Type is ColumnType.Time or
ColumnType.Datetime or ColumnType.Timestamp)
{
il.Emit(OpCodes.Ldc_I4, col.Precision);
}
@@ -225,11 +226,11 @@ namespace Apache.Ignite.Internal.Table.Serialization
il.Emit(OpCodes.Ldfld, fieldInfo);
}
- if (col.Type == ClientDataType.Decimal)
+ if (col.Type == ColumnType.Decimal)
{
il.Emit(OpCodes.Ldc_I4, col.Scale);
}
- else if (col.Type is ClientDataType.Time or
ClientDataType.DateTime or ClientDataType.Timestamp)
+ else if (col.Type is ColumnType.Time or
ColumnType.Datetime or ColumnType.Timestamp)
{
il.Emit(OpCodes.Ldc_I4, col.Precision);
}
@@ -272,7 +273,7 @@ namespace Apache.Ignite.Internal.Table.Serialization
il.Emit(OpCodes.Ldarg_0); // reader
il.Emit(OpCodes.Ldc_I4_0); // index
- if (schema.Columns[0] is { Type: ClientDataType.Decimal } col)
+ if (schema.Columns[0] is { Type: ColumnType.Decimal } col)
{
il.Emit(OpCodes.Ldc_I4, col.Scale);
}
@@ -383,7 +384,7 @@ namespace Apache.Ignite.Internal.Table.Serialization
il.Emit(OpCodes.Ldarg_0); // reader
il.Emit(OpCodes.Ldc_I4, elemIdx); // index
- if (col.Type == ClientDataType.Decimal)
+ if (col.Type == ColumnType.Decimal)
{
il.Emit(OpCodes.Ldc_I4, col.Scale);
}
@@ -394,7 +395,7 @@ namespace Apache.Ignite.Internal.Table.Serialization
private static void ValidateFieldType(FieldInfo fieldInfo, Column
column)
{
- var columnType = column.Type.ToType();
+ var columnType = column.Type.ToClrType();
var fieldType = Nullable.GetUnderlyingType(fieldInfo.FieldType) ??
fieldInfo.FieldType;
fieldType = fieldType.UnwrapEnum();
@@ -410,7 +411,7 @@ namespace Apache.Ignite.Internal.Table.Serialization
private static void ValidateSingleFieldMappingType(Type type, Column
column)
{
- var columnType = column.Type.ToType();
+ var columnType = column.Type.ToClrType();
if (type != columnType)
{
diff --git a/modules/platforms/dotnet/Apache.Ignite/Internal/Table/Table.cs
b/modules/platforms/dotnet/Apache.Ignite/Internal/Table/Table.cs
index ef50b56c8b..2db816d830 100644
--- a/modules/platforms/dotnet/Apache.Ignite/Internal/Table/Table.cs
+++ b/modules/platforms/dotnet/Apache.Ignite/Internal/Table/Table.cs
@@ -24,6 +24,7 @@ namespace Apache.Ignite.Internal.Table
using System.Threading.Tasks;
using Buffers;
using Common;
+ using Ignite.Sql;
using Ignite.Table;
using Ignite.Transactions;
using Log;
@@ -338,7 +339,7 @@ namespace Apache.Ignite.Internal.Table
r.Skip(propertyCount - expectedCount);
- var column = new Column(name, (ClientDataType)type,
isNullable, isColocation, isKey, i, scale, precision);
+ var column = new Column(name, (ColumnType)type, isNullable,
isColocation, isKey, i, scale, precision);
columns[i] = column;
diff --git
a/modules/platforms/dotnet/Apache.Ignite/Internal/Table/TemporalTypes.cs
b/modules/platforms/dotnet/Apache.Ignite/Internal/Table/TemporalTypes.cs
index fb9b63ce51..db89c2362f 100644
--- a/modules/platforms/dotnet/Apache.Ignite/Internal/Table/TemporalTypes.cs
+++ b/modules/platforms/dotnet/Apache.Ignite/Internal/Table/TemporalTypes.cs
@@ -18,7 +18,7 @@
namespace Apache.Ignite.Internal.Table;
using System;
-using Proto;
+using Ignite.Sql;
/// <summary>
/// Temporal type utils.
@@ -26,7 +26,7 @@ using Proto;
internal static class TemporalTypes
{
/// <summary>
- /// Max <see cref="ClientDataType.Time"/> type precision.
+ /// Max <see cref="ColumnType.Time"/> type precision.
/// </summary>
public const int MaxTimePrecision = 9;
diff --git a/modules/platforms/dotnet/Apache.Ignite/Sql/SqlColumnType.cs
b/modules/platforms/dotnet/Apache.Ignite/Sql/ColumnType.cs
similarity index 98%
rename from modules/platforms/dotnet/Apache.Ignite/Sql/SqlColumnType.cs
rename to modules/platforms/dotnet/Apache.Ignite/Sql/ColumnType.cs
index 9cee0317da..595ca021ba 100644
--- a/modules/platforms/dotnet/Apache.Ignite/Sql/SqlColumnType.cs
+++ b/modules/platforms/dotnet/Apache.Ignite/Sql/ColumnType.cs
@@ -26,7 +26,7 @@ namespace Apache.Ignite.Sql
"Microsoft.Naming",
"CA1720:IdentifiersShouldNotContainTypeNames",
Justification = "Ignite-specific SQL column type names are required.")]
- public enum SqlColumnType
+ public enum ColumnType
{
/** Boolean. */
Boolean = 0,
diff --git a/modules/platforms/dotnet/Apache.Ignite/Sql/IColumnMetadata.cs
b/modules/platforms/dotnet/Apache.Ignite/Sql/IColumnMetadata.cs
index 32d4bf0a81..773a6e779b 100644
--- a/modules/platforms/dotnet/Apache.Ignite/Sql/IColumnMetadata.cs
+++ b/modules/platforms/dotnet/Apache.Ignite/Sql/IColumnMetadata.cs
@@ -30,7 +30,7 @@ namespace Apache.Ignite.Sql
/// <summary>
/// Gets the column type.
/// </summary>
- SqlColumnType Type { get; }
+ ColumnType Type { get; }
/// <summary>
/// Gets the column precision, or -1 when not applicable to the
current column type.
diff --git a/modules/platforms/dotnet/Apache.Ignite/Sql/IgniteDbDataReader.cs
b/modules/platforms/dotnet/Apache.Ignite/Sql/IgniteDbDataReader.cs
index 5b9d7a921e..96bd8c8c4e 100644
--- a/modules/platforms/dotnet/Apache.Ignite/Sql/IgniteDbDataReader.cs
+++ b/modules/platforms/dotnet/Apache.Ignite/Sql/IgniteDbDataReader.cs
@@ -194,11 +194,12 @@ public sealed class IgniteDbDataReader : DbDataReader,
IDbColumnSchemaGenerator
{
var column = Metadata.Columns[ordinal];
+ // ReSharper disable once
SwitchExpressionHandlesSomeKnownEnumValuesWithExceptionInDefault
return column.Type switch
{
- SqlColumnType.Date =>
GetReader().GetDate(ordinal).ToDateTimeUnspecified(),
- SqlColumnType.Datetime =>
GetReader().GetDateTime(ordinal).ToDateTimeUnspecified(),
- SqlColumnType.Timestamp =>
GetReader().GetTimestamp(ordinal).ToDateTimeUtc(),
+ ColumnType.Date =>
GetReader().GetDate(ordinal).ToDateTimeUnspecified(),
+ ColumnType.Datetime =>
GetReader().GetDateTime(ordinal).ToDateTimeUnspecified(),
+ ColumnType.Timestamp =>
GetReader().GetTimestamp(ordinal).ToDateTimeUtc(),
_ => throw GetInvalidColumnTypeException(typeof(DateTime), column)
};
}
@@ -475,7 +476,7 @@ public sealed class IgniteDbDataReader : DbDataReader,
IDbColumnSchemaGenerator
private static void ValidateColumnType(Type type, IColumnMetadata column)
{
- if (column.Type != type.ToSqlColumnType())
+ if (column.Type != type.ToColumnType())
{
throw GetInvalidColumnTypeException(type, column);
}
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/PlatformTestNodeRunner.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/PlatformTestNodeRunner.java
index 6f89795e9d..e3b5dd9e05 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/PlatformTestNodeRunner.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/PlatformTestNodeRunner.java
@@ -38,7 +38,7 @@ import org.apache.ignite.compute.ComputeJob;
import org.apache.ignite.compute.JobExecutionContext;
import org.apache.ignite.internal.app.IgniteImpl;
import org.apache.ignite.internal.binarytuple.BinaryTupleReader;
-import org.apache.ignite.internal.client.proto.ClientDataType;
+import org.apache.ignite.internal.client.proto.ColumnTypeConverter;
import
org.apache.ignite.internal.configuration.BasicAuthenticationProviderChange;
import org.apache.ignite.internal.configuration.SecurityConfiguration;
import org.apache.ignite.internal.schema.Column;
@@ -447,84 +447,84 @@ public class PlatformTestNodeRunner {
var reader = new BinaryTupleReader(columnCount * 3, buf);
for (int i = 0; i < columnCount; i++) {
- var type = reader.intValue(i * 3);
+ var type =
ColumnTypeConverter.fromOrdinalOrThrow(reader.intValue(i * 3));
var scale = reader.intValue(i * 3 + 1);
var valIdx = i * 3 + 2;
String colName = "col" + i;
switch (type) {
- case ClientDataType.INT8:
+ case INT8:
columns[i] = new Column(i, colName, NativeTypes.INT8,
false);
tuple.set(colName, reader.byteValue(valIdx));
break;
- case ClientDataType.INT16:
+ case INT16:
columns[i] = new Column(i, colName, NativeTypes.INT16,
false);
tuple.set(colName, reader.shortValue(valIdx));
break;
- case ClientDataType.INT32:
+ case INT32:
columns[i] = new Column(i, colName, NativeTypes.INT32,
false);
tuple.set(colName, reader.intValue(valIdx));
break;
- case ClientDataType.INT64:
+ case INT64:
columns[i] = new Column(i, colName, NativeTypes.INT64,
false);
tuple.set(colName, reader.longValue(valIdx));
break;
- case ClientDataType.FLOAT:
+ case FLOAT:
columns[i] = new Column(i, colName, NativeTypes.FLOAT,
false);
tuple.set(colName, reader.floatValue(valIdx));
break;
- case ClientDataType.DOUBLE:
+ case DOUBLE:
columns[i] = new Column(i, colName,
NativeTypes.DOUBLE, false);
tuple.set(colName, reader.doubleValue(valIdx));
break;
- case ClientDataType.DECIMAL:
+ case DECIMAL:
columns[i] = new Column(i, colName,
NativeTypes.decimalOf(100, scale), false);
tuple.set(colName, reader.decimalValue(valIdx, scale));
break;
- case ClientDataType.STRING:
+ case STRING:
columns[i] = new Column(i, colName,
NativeTypes.STRING, false);
tuple.set(colName, reader.stringValue(valIdx));
break;
- case ClientDataType.UUID:
+ case UUID:
columns[i] = new Column(i, colName, NativeTypes.UUID,
false);
tuple.set(colName, reader.uuidValue(valIdx));
break;
- case ClientDataType.NUMBER:
+ case NUMBER:
columns[i] = new Column(i, colName,
NativeTypes.numberOf(255), false);
tuple.set(colName, reader.numberValue(valIdx));
break;
- case ClientDataType.BITMASK:
+ case BITMASK:
columns[i] = new Column(i, colName,
NativeTypes.bitmaskOf(32), false);
tuple.set(colName, reader.bitmaskValue(valIdx));
break;
- case ClientDataType.DATE:
+ case DATE:
columns[i] = new Column(i, colName, NativeTypes.DATE,
false);
tuple.set(colName, reader.dateValue(valIdx));
break;
- case ClientDataType.TIME:
+ case TIME:
columns[i] = new Column(i, colName,
NativeTypes.time(timePrecision), false);
tuple.set(colName, reader.timeValue(valIdx));
break;
- case ClientDataType.DATETIME:
+ case DATETIME:
columns[i] = new Column(i, colName,
NativeTypes.datetime(timePrecision), false);
tuple.set(colName, reader.dateTimeValue(valIdx));
break;
- case ClientDataType.TIMESTAMP:
+ case TIMESTAMP:
columns[i] = new Column(i, colName,
NativeTypes.timestamp(timestampPrecision), false);
tuple.set(colName, reader.timestampValue(valIdx));
break;
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItThinClientColocationTest.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItThinClientColocationTest.java
index 3e79d11373..5fad6aec13 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItThinClientColocationTest.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItThinClientColocationTest.java
@@ -71,7 +71,7 @@ public class ItThinClientColocationTest {
private static ClientSchema clientSchema(NativeType type, String
columnName) {
var clientColumn = new ClientColumn(
columnName,
- ClientTableCommon.getClientDataType(type.spec()),
+ ClientTableCommon.getColumnType(type.spec()),
false,
true,
true,