From 405064c0f9831adc5c5e02b4fcd86b7a55b559c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Bary=C5=82a?= Date: Fri, 25 Oct 2024 10:52:39 +0200 Subject: [PATCH] Deserialize: don't use i64 for Counter column We have a dedicated type for that and such deserialization decreases type safety. --- scylla-cql/src/types/deserialize/row_tests.rs | 2 +- scylla-cql/src/types/deserialize/value.rs | 2 +- scylla-cql/src/types/deserialize/value_tests.rs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scylla-cql/src/types/deserialize/row_tests.rs b/scylla-cql/src/types/deserialize/row_tests.rs index 8c01ea590..96a819e57 100644 --- a/scylla-cql/src/types/deserialize/row_tests.rs +++ b/scylla-cql/src/types/deserialize/row_tests.rs @@ -320,7 +320,7 @@ fn test_tuple_errors() { assert_matches!( &err.kind, super::super::value::BuiltinTypeCheckErrorKind::MismatchedType { - expected: &[ColumnType::BigInt, ColumnType::Counter] + expected: &[ColumnType::BigInt] } ); } diff --git a/scylla-cql/src/types/deserialize/value.rs b/scylla-cql/src/types/deserialize/value.rs index 9664788c1..053eb2447 100644 --- a/scylla-cql/src/types/deserialize/value.rs +++ b/scylla-cql/src/types/deserialize/value.rs @@ -207,7 +207,7 @@ impl_emptiable_strict_type!( impl_fixed_numeric_type!(i8, TinyInt); impl_fixed_numeric_type!(i16, SmallInt); impl_fixed_numeric_type!(i32, Int); -impl_fixed_numeric_type!(i64, [BigInt | Counter]); +impl_fixed_numeric_type!(i64, BigInt); impl_fixed_numeric_type!(f32, Float); impl_fixed_numeric_type!(f64, Double); diff --git a/scylla-cql/src/types/deserialize/value_tests.rs b/scylla-cql/src/types/deserialize/value_tests.rs index bcb581fee..01bb7623a 100644 --- a/scylla-cql/src/types/deserialize/value_tests.rs +++ b/scylla-cql/src/types/deserialize/value_tests.rs @@ -1284,7 +1284,7 @@ fn test_set_or_list_errors() { assert_matches!( err.kind, BuiltinTypeCheckErrorKind::MismatchedType { - expected: &[ColumnType::BigInt, ColumnType::Counter] + expected: &[ColumnType::BigInt] } ); } @@ -1363,7 +1363,7 @@ fn test_map_errors() { assert_matches!( err.kind, BuiltinTypeCheckErrorKind::MismatchedType { - expected: &[ColumnType::BigInt, ColumnType::Counter] + expected: &[ColumnType::BigInt] } ); } @@ -1527,7 +1527,7 @@ fn test_tuple_errors() { assert_matches!( err.kind, BuiltinTypeCheckErrorKind::MismatchedType { - expected: &[ColumnType::BigInt, ColumnType::Counter] + expected: &[ColumnType::BigInt] } ); }