Skip to content

Commit 53d1168

Browse files
committed
Vector Scalars
Signed-off-by: Nicholas Gates <[email protected]>
1 parent 1ba7c16 commit 53d1168

File tree

1 file changed

+11
-12
lines changed
  • vortex-vector/src/decimal

1 file changed

+11
-12
lines changed

vortex-vector/src/decimal/mod.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
//! ## Creating and building decimal vectors
1616
//!
1717
//! ```
18-
//! use vortex_dtype::{DecimalDType, PrecisionScale};
18+
//! use vortex_dtype::{PrecisionScale};
1919
//! use vortex_vector::decimal::{DVectorMut};
2020
//! use vortex_vector::VectorMutOps;
2121
//!
2222
//! // Create a decimal vector with precision=9, scale=2 (e.g., up to 9999999.99).
23-
//! let decimal_dtype = DecimalDType::new(9, 2);
23+
//! let ps = PrecisionScale::<i32>::new(9, 2);
2424
//! let mut vec = DVectorMut::<i32>::with_capacity(&decimal_dtype, 5);
2525
//! assert_eq!(vec.len(), 0);
2626
//! assert!(vec.capacity() >= 5);
@@ -49,14 +49,13 @@
4949
//!
5050
//! ```
5151
//! use vortex_buffer::BufferMut;
52-
//! use vortex_dtype::{DecimalDType, PrecisionScale};
52+
//! use vortex_dtype::{PrecisionScale};
5353
//! use vortex_mask::MaskMut;
5454
//! use vortex_vector::decimal::DVectorMut;
5555
//! use vortex_vector::VectorMutOps;
5656
//!
5757
//! // Create a decimal vector with nulls.
58-
//! let decimal_dtype = DecimalDType::new(5, 2); // Up to 999.99.
59-
//! let ps = PrecisionScale::<i32>::try_from(&decimal_dtype).unwrap();
58+
//! let ps = PrecisionScale::<i32>::new(5, 2); // Up to 999.99.
6059
//!
6160
//! // Create with some null values (validity mask: true = not null, false = null).
6261
//! let elements = BufferMut::from_iter([1000_i32, 0, 2500, 0]); // 10.00, null, 25.00, null.
@@ -80,17 +79,17 @@
8079
//! ## Extending and manipulating vectors
8180
//!
8281
//! ```
83-
//! use vortex_dtype::DecimalDType;
82+
//! use vortex_dtype::{PrecisionScale};
8483
//! use vortex_vector::decimal::DVectorMut;
8584
//! use vortex_vector::VectorMutOps;
8685
//!
8786
//! // Create two decimal vectors with scale=3 (3 decimal places).
88-
//! let decimal_dtype = DecimalDType::new(10, 3);
89-
//! let mut vec1 = DVectorMut::<i64>::with_capacity(&decimal_dtype, 10);
87+
//! let ps = PrecisionScale::<i64>::new(10, 3);
88+
//! let mut vec1 = DVectorMut::<i64>::with_capacity(ps, 10);
9089
//! vec1.try_push(1234567).unwrap(); // 1234.567.
9190
//! vec1.try_push(2345678).unwrap(); // 2345.678.
9291
//!
93-
//! let mut vec2 = DVectorMut::<i64>::with_capacity(&decimal_dtype, 10);
92+
//! let mut vec2 = DVectorMut::<i64>::with_capacity(ps, 10);
9493
//! vec2.try_push(3456789).unwrap(); // 3456.789.
9594
//! vec2.try_push(4567890).unwrap(); // 4567.890.
9695
//!
@@ -116,13 +115,13 @@
116115
//! ## Converting between mutable and immutable
117116
//!
118117
//! ```
119-
//! use vortex_dtype::DecimalDType;
118+
//! use vortex_dtype::{PrecisionScale};
120119
//! use vortex_vector::decimal::DVectorMut;
121120
//! use vortex_vector::{VectorMutOps, VectorOps};
122121
//!
123122
//! // Create a mutable decimal vector.
124-
//! let decimal_dtype = DecimalDType::new(18, 6); // High precision with 6 decimal places.
125-
//! let mut vec_mut = DVectorMut::<i128>::with_capacity(&decimal_dtype, 3);
123+
//! let ps = PrecisionScale::<i128>::new(18, 6); // High precision with 6 decimal places.
124+
//! let mut vec_mut = DVectorMut::<i128>::with_capacity(ps, 3);
126125
//! vec_mut.try_push(1000000).unwrap(); // 1.000000.
127126
//! vec_mut.try_push(2500000).unwrap(); // 2.500000.
128127
//! vec_mut.try_push(3333333).unwrap(); // 3.333333.

0 commit comments

Comments
 (0)