@@ -198,14 +198,13 @@ mod tests {
198198 use arrow_array:: ffi:: FFI_ArrowSchema ;
199199 use arrow_schema:: DataType ;
200200 use futures:: executor:: block_on;
201- use vortex_array:: Canonical ;
201+ use vortex_array:: Array ;
202202 use vortex_array:: IntoArray ;
203203 use vortex_array:: arrays:: PrimitiveArray ;
204204 use vortex_array:: validity:: Validity ;
205205 use vortex_buffer:: Buffer ;
206206 use vortex_cuda:: CudaSession ;
207207 use vortex_cuda:: arrow:: CudaDeviceArrayExecute ;
208- use vortex_cuda:: executor:: CudaArrayExt ;
209208 use vortex_session:: VortexSession ;
210209
211210 use super :: * ;
@@ -225,23 +224,24 @@ mod tests {
225224 }
226225
227226 #[ test]
228- fn test_primitive_array_to_cudf_tableview ( ) -> Result < ( ) > {
227+ fn test_primitive_array_to_cudf_columnview ( ) -> Result < ( ) > {
229228 // Create a PrimitiveArray with 100 i64 values
230229 let data: Vec < i64 > = ( 0 ..100 ) . collect ( ) ;
231230 let expected_len = data. len ( ) ;
232231 let primitive_array =
233232 PrimitiveArray :: new ( Buffer :: from ( data) , Validity :: NonNullable ) . into_array ( ) ;
234233
235234 // Create CUDA execution context
236- let mut cuda_ctx = match CudaSession :: create_execution_ctx ( & VortexSession :: empty ( ) ) . unwrap ( ) ;
235+ let mut cuda_ctx = CudaSession :: create_execution_ctx ( & VortexSession :: empty ( ) ) . unwrap ( ) ;
237236
238- // Export as ArrowDeviceArray using CudaDeviceArrayExecute
239- let device_array = block_on ( Canonical :: execute (
240- & primitive_array,
241- primitive_array. clone ( ) ,
242- & mut cuda_ctx,
243- ) )
244- . unwrap ( ) ;
237+ // Get canonical form and export as ArrowDeviceArray
238+ let canonical = primitive_array. to_canonical ( ) . map_err ( |e| CudfError {
239+ message : e. to_string ( ) ,
240+ } ) ?;
241+ let device_array = block_on ( canonical. execute ( primitive_array. clone ( ) , & mut cuda_ctx) )
242+ . map_err ( |e| CudfError {
243+ message : e. to_string ( ) ,
244+ } ) ?;
245245
246246 // Synchronize the CUDA stream to ensure the data is ready
247247 cuda_ctx. synchronize_stream ( ) . map_err ( |e| CudfError {
@@ -257,28 +257,28 @@ mod tests {
257257 // Create cudf context
258258 let cudf_ctx = CudfContext :: new ( ) ?;
259259
260- // Import into cudf tableview
261- let tableview = unsafe {
262- cudf_ctx. tableview_from_device (
260+ // Import into cudf columnview
261+ let columnview = unsafe {
262+ cudf_ctx. columnview_from_device (
263263 ( & raw mut ffi_schema) . cast :: < ArrowSchema > ( ) ,
264264 ( & raw const device_array) . cast :: < ArrowDeviceArray > ( ) ,
265265 ) ?
266266 } ;
267267
268268 // Verify row count
269- let num_rows = tableview . num_rows ( ) ?;
270- assert_eq ! ( num_rows , expected_len as i64 , "Row count mismatch" ) ;
269+ let size = columnview . size ( ) ?;
270+ assert_eq ! ( size , expected_len as i64 , "Size mismatch" ) ;
271271 println ! (
272- "Successfully imported PrimitiveArray into cudf tableview with {} rows" ,
273- num_rows
272+ "Successfully imported PrimitiveArray into cudf columnview with {} rows" ,
273+ size
274274 ) ;
275275
276- // Verify column count (should be 1 for a primitive array )
277- let num_columns = tableview . num_columns ( ) ?;
278- assert_eq ! ( num_columns , 1 , "Column count mismatch" ) ;
279- println ! ( "Tableview has {} column(s) " , num_columns ) ;
276+ // Verify valid count (should be same as length since NonNullable )
277+ let valid_count = columnview . count_valid ( ) ?;
278+ assert_eq ! ( valid_count , expected_len as i64 , "Valid count mismatch" ) ;
279+ println ! ( "Columnview has {} valid values " , valid_count ) ;
280280
281- // Tableview and cudf_ctx will be deallocated automatically via Drop
281+ // Columnview and cudf_ctx will be deallocated automatically via Drop
282282
283283 Ok ( ( ) )
284284 }
0 commit comments