diff --git a/crates/proof-of-sql-parser/src/intermediate_ast_tests.rs b/crates/proof-of-sql-parser/src/intermediate_ast_tests.rs index 483056a29..182ee9124 100644 --- a/crates/proof-of-sql-parser/src/intermediate_ast_tests.rs +++ b/crates/proof-of-sql-parser/src/intermediate_ast_tests.rs @@ -495,14 +495,14 @@ fn we_can_parse_a_query_with_three_logical_not_and_or_filter_expressions() { #[test] fn we_can_parse_a_query_with_the_minimum_i128_value_as_the_equal_filter_literal() { - let ast = ("select a from sxt_tab where b = ".to_owned() + &std::i128::MIN.to_string()) + let ast = ("select a from sxt_tab where b = ".to_owned() + &i128::MIN.to_string()) .parse::() .unwrap(); let expected_ast = select( query( cols_res(&["a"]), tab(None, "sxt_tab"), - equal(col("b"), lit(std::i128::MIN)), + equal(col("b"), lit(i128::MIN)), vec![], ), vec![], @@ -517,7 +517,7 @@ fn we_can_parse_a_query_with_the_minimum_i128_value_as_the_equal_filter_literal( query( cols_res(&["a"]), tab(None, "sxt_tab"), - equal(col("b"), lit(std::i128::MIN)), + equal(col("b"), lit(i128::MIN)), vec![], ), vec![], @@ -530,7 +530,7 @@ fn we_can_parse_a_query_with_the_minimum_i128_value_as_the_equal_filter_literal( fn we_cannot_parse_a_query_with_the_literals_overflowing() { // note: see the minus sign in front of the literal, causing the overflow assert!( - ("select a from sxt_tab where b = -".to_owned() + &std::i128::MIN.to_string()) + ("select a from sxt_tab where b = -".to_owned() + &i128::MIN.to_string()) .parse::() .is_err() ); @@ -538,14 +538,14 @@ fn we_cannot_parse_a_query_with_the_literals_overflowing() { #[test] fn we_can_parse_a_query_with_the_maximum_i128_value_as_the_equal_filter_literal() { - let ast = ("select a from sxt_tab where b = ".to_owned() + &std::i128::MAX.to_string()) + let ast = ("select a from sxt_tab where b = ".to_owned() + &i128::MAX.to_string()) .parse::() .unwrap(); let expected_ast = select( query( cols_res(&["a"]), tab(None, "sxt_tab"), - equal(col("b"), lit(std::i128::MAX)), + equal(col("b"), lit(i128::MAX)), vec![], ), vec![], diff --git a/crates/proof-of-sql/src/base/commitment/table_commitment.rs b/crates/proof-of-sql/src/base/commitment/table_commitment.rs index 837a172fd..a15b529d3 100644 --- a/crates/proof-of-sql/src/base/commitment/table_commitment.rs +++ b/crates/proof-of-sql/src/base/commitment/table_commitment.rs @@ -452,7 +452,7 @@ fn num_rows_of_columns<'a>( Ok(num_rows) } -#[cfg(all(test, feature = "arrow, blitzar"))] +#[cfg(all(test, feature = "arrow", feature = "blitzar"))] mod tests { use super::*; use crate::{ diff --git a/crates/proof-of-sql/src/base/database/mod.rs b/crates/proof-of-sql/src/base/database/mod.rs index d84c53be1..e99c287f6 100644 --- a/crates/proof-of-sql/src/base/database/mod.rs +++ b/crates/proof-of-sql/src/base/database/mod.rs @@ -31,9 +31,9 @@ mod record_batch_utility; #[cfg(feature = "arrow")] pub use record_batch_utility::ToArrow; -#[cfg(all(test, feature = "arrow, test"))] +#[cfg(all(test, feature = "arrow", feature = "test"))] mod test_accessor_utility; -#[cfg(all(test, feature = "arrow, test"))] +#[cfg(all(test, feature = "arrow", feature = "test"))] pub use test_accessor_utility::{make_random_test_accessor_data, RandomTestAccessorDescriptor}; mod owned_column; diff --git a/crates/proof-of-sql/src/base/database/test_accessor_utility.rs b/crates/proof-of-sql/src/base/database/test_accessor_utility.rs index efc76b122..6e1ddceac 100644 --- a/crates/proof-of-sql/src/base/database/test_accessor_utility.rs +++ b/crates/proof-of-sql/src/base/database/test_accessor_utility.rs @@ -5,7 +5,7 @@ use arrow::{ StringArray, TimestampMicrosecondArray, TimestampMillisecondArray, TimestampNanosecondArray, TimestampSecondArray, }, - datatypes::{i256, DataType, Field, Schema}, + datatypes::{i256, DataType, Field, Schema, TimeUnit}, record_batch::RecordBatch, }; use proof_of_sql_parser::posql_time::PoSQLTimeUnit; @@ -121,7 +121,15 @@ pub fn make_random_test_accessor_data( ColumnType::TimestampTZ(tu, tz) => { column_fields.push(Field::new( *col_name, - DataType::Timestamp((*tu).into(), Some(Arc::from(tz.to_string()))), + DataType::Timestamp( + match tu { + PoSQLTimeUnit::Second => TimeUnit::Second, + PoSQLTimeUnit::Millisecond => TimeUnit::Millisecond, + PoSQLTimeUnit::Microsecond => TimeUnit::Microsecond, + PoSQLTimeUnit::Nanosecond => TimeUnit::Nanosecond, + }, + Some(Arc::from(tz.to_string())), + ), false, )); // Create the correct timestamp array based on the time unit diff --git a/crates/proof-of-sql/src/base/encode/varint_trait_test.rs b/crates/proof-of-sql/src/base/encode/varint_trait_test.rs index c9bfc26b1..9e8e556f8 100644 --- a/crates/proof-of-sql/src/base/encode/varint_trait_test.rs +++ b/crates/proof-of-sql/src/base/encode/varint_trait_test.rs @@ -54,7 +54,7 @@ fn test_decode_max_u64() { let max_vec_encoded = vec![0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01]; assert_eq!( u64::decode_var(max_vec_encoded.as_slice()).unwrap().0, - u64::max_value() + u64::MAX ); } @@ -68,11 +68,11 @@ fn test_encode_i64() { 4294967295_u64.encode_var_vec() ); assert_eq!( - i64::max_value().encode_var_vec(), + i64::MAX.encode_var_vec(), &[0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01] ); assert_eq!( - i64::min_value().encode_var_vec(), + i64::MIN.encode_var_vec(), &[0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01] ); } @@ -82,7 +82,7 @@ fn test_decode_min_i64() { let min_vec_encoded = vec![0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01]; assert_eq!( i64::decode_var(min_vec_encoded.as_slice()).unwrap().0, - i64::min_value() + i64::MIN ); } @@ -91,7 +91,7 @@ fn test_decode_max_i64() { let max_vec_encoded = vec![0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01]; assert_eq!( i64::decode_var(max_vec_encoded.as_slice()).unwrap().0, - i64::max_value() + i64::MAX ); } diff --git a/crates/proof-of-sql/src/proof_primitive/dory/offset_to_bytes.rs b/crates/proof-of-sql/src/proof_primitive/dory/offset_to_bytes.rs index 4a8f19230..4bf0ad6b1 100644 --- a/crates/proof-of-sql/src/proof_primitive/dory/offset_to_bytes.rs +++ b/crates/proof-of-sql/src/proof_primitive/dory/offset_to_bytes.rs @@ -1,21 +1,16 @@ use zerocopy::AsBytes; pub trait OffsetToBytes { - const IS_SIGNED: bool; fn offset_to_bytes(&self) -> Vec; } impl OffsetToBytes for u8 { - const IS_SIGNED: bool = false; - fn offset_to_bytes(&self) -> Vec { vec![*self] } } impl OffsetToBytes for i16 { - const IS_SIGNED: bool = true; - fn offset_to_bytes(&self) -> Vec { let shifted = self.wrapping_sub(i16::MIN); shifted.to_le_bytes().to_vec() @@ -23,8 +18,6 @@ impl OffsetToBytes for i16 { } impl OffsetToBytes for i32 { - const IS_SIGNED: bool = true; - fn offset_to_bytes(&self) -> Vec { let shifted = self.wrapping_sub(i32::MIN); shifted.to_le_bytes().to_vec() @@ -32,8 +25,6 @@ impl OffsetToBytes for i32 { } impl OffsetToBytes for i64 { - const IS_SIGNED: bool = true; - fn offset_to_bytes(&self) -> Vec { let shifted = self.wrapping_sub(i64::MIN); shifted.to_le_bytes().to_vec() @@ -41,8 +32,6 @@ impl OffsetToBytes for i64 { } impl OffsetToBytes for i128 { - const IS_SIGNED: bool = true; - fn offset_to_bytes(&self) -> Vec { let shifted = self.wrapping_sub(i128::MIN); shifted.to_le_bytes().to_vec() @@ -50,16 +39,12 @@ impl OffsetToBytes for i128 { } impl OffsetToBytes for bool { - const IS_SIGNED: bool = false; - fn offset_to_bytes(&self) -> Vec { vec![*self as u8] } } impl OffsetToBytes for u64 { - const IS_SIGNED: bool = false; - fn offset_to_bytes(&self) -> Vec { let bytes = self.to_le_bytes(); bytes.to_vec() @@ -67,8 +52,6 @@ impl OffsetToBytes for u64 { } impl OffsetToBytes for [u64; 4] { - const IS_SIGNED: bool = false; - fn offset_to_bytes(&self) -> Vec { let slice = self.as_bytes(); slice.to_vec() diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 51985806f..4d2dee853 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.78.0" +channel = "1.80.0"