@@ -287,29 +287,57 @@ private Action<TRow> GenerateSetter(IRow input, int index, InternalSchemaDefinit
287287 Ch . Assert ( colType . ItemType . IsBool ) ;
288288 return CreateVBufferSetter < DvBool , bool > ( input , index , poke , peek , x => Convert . ToBoolean ( x . RawValue ) ) ;
289289 }
290+ else if ( fieldType . GetElementType ( ) == typeof ( bool ? ) )
291+ {
292+ Ch . Assert ( colType . ItemType . IsBool ) ;
293+ return CreateVBufferSetter < DvBool , bool ? > ( input , index , poke , peek , x => ( bool ? ) x ) ;
294+ }
290295 else if ( fieldType . GetElementType ( ) == typeof ( int ) )
291296 {
292297 Ch . Assert ( colType . ItemType == NumberType . I4 ) ;
293298 return CreateVBufferSetter < DvInt4 , int > ( input , index , poke , peek , x => ( int ) x ) ;
294299 }
300+ else if ( fieldType . GetElementType ( ) == typeof ( int ? ) )
301+ {
302+ Ch . Assert ( colType . ItemType == NumberType . I4 ) ;
303+ return CreateVBufferSetter < DvInt4 , int ? > ( input , index , poke , peek , x => ( int ? ) x ) ;
304+ }
295305 else if ( fieldType . GetElementType ( ) == typeof ( short ) )
296306 {
297307 Ch . Assert ( colType . ItemType == NumberType . I2 ) ;
298308 return CreateVBufferSetter < DvInt2 , short > ( input , index , poke , peek , x => ( short ) x ) ;
299309 }
310+ else if ( fieldType . GetElementType ( ) == typeof ( short ? ) )
311+ {
312+ Ch . Assert ( colType . ItemType == NumberType . I2 ) ;
313+ return CreateVBufferSetter < DvInt2 , short ? > ( input , index , poke , peek , x => ( short ? ) x ) ;
314+ }
300315 else if ( fieldType . GetElementType ( ) == typeof ( long ) )
301316 {
302317 Ch . Assert ( colType . ItemType == NumberType . I8 ) ;
303318 return CreateVBufferSetter < DvInt8 , long > ( input , index , poke , peek , x => ( long ) x ) ;
304319 }
320+ else if ( fieldType . GetElementType ( ) == typeof ( long ? ) )
321+ {
322+ Ch . Assert ( colType . ItemType == NumberType . I8 ) ;
323+ return CreateVBufferSetter < DvInt8 , long ? > ( input , index , poke , peek , x => ( long ? ) x ) ;
324+ }
305325 else if ( fieldType . GetElementType ( ) == typeof ( sbyte ) )
306326 {
307327 Ch . Assert ( colType . ItemType == NumberType . I1 ) ;
308328 return CreateVBufferSetter < DvInt1 , sbyte > ( input , index , poke , peek , x => ( sbyte ) x ) ;
309329 }
330+ else if ( fieldType . GetElementType ( ) == typeof ( sbyte ? ) )
331+ {
332+ Ch . Assert ( colType . ItemType == NumberType . I1 ) ;
333+ return CreateVBufferSetter < DvInt1 , sbyte ? > ( input , index , poke , peek , x => ( sbyte ? ) x ) ;
334+ }
310335
311336 // VBuffer<T> -> T[]
312- Ch . Assert ( fieldType . GetElementType ( ) == colType . ItemType . RawType ) ;
337+ if ( fieldType . GetElementType ( ) . IsGenericType && fieldType . GetElementType ( ) . GetGenericTypeDefinition ( ) == typeof ( Nullable < > ) )
338+ Ch . Assert ( colType . ItemType . RawType == Nullable . GetUnderlyingType ( fieldType . GetElementType ( ) ) ) ;
339+ else
340+ Ch . Assert ( colType . ItemType . RawType == fieldType . GetElementType ( ) ) ;
313341 del = CreateVBufferDirectSetter < int > ;
314342 genericType = fieldType . GetElementType ( ) ;
315343 }
@@ -353,7 +381,7 @@ private Action<TRow> GenerateSetter(IRow input, int index, InternalSchemaDefinit
353381 {
354382 Ch . Assert ( colType == NumberType . I4 ) ;
355383 Ch . Assert ( peek == null ) ;
356- return CreateActionSetter < DvInt4 , int ? > ( input , index , poke , x => x . IsNA ? ( int ? ) null : ( int ) x ) ;
384+ return CreateActionSetter < DvInt4 , int ? > ( input , index , poke , x => ( int ? ) x ) ;
357385 }
358386 else if ( fieldType == typeof ( short ) )
359387 {
@@ -365,7 +393,7 @@ private Action<TRow> GenerateSetter(IRow input, int index, InternalSchemaDefinit
365393 {
366394 Ch . Assert ( colType == NumberType . I2 ) ;
367395 Ch . Assert ( peek == null ) ;
368- return CreateActionSetter < DvInt2 , short ? > ( input , index , poke , x => x . IsNA ? ( short ? ) null : ( short ) x ) ;
396+ return CreateActionSetter < DvInt2 , short ? > ( input , index , poke , x => ( short ? ) x ) ;
369397 }
370398 else if ( fieldType == typeof ( long ) )
371399 {
@@ -377,7 +405,7 @@ private Action<TRow> GenerateSetter(IRow input, int index, InternalSchemaDefinit
377405 {
378406 Ch . Assert ( colType == NumberType . I8 ) ;
379407 Ch . Assert ( peek == null ) ;
380- return CreateActionSetter < DvInt8 , long ? > ( input , index , poke , x => x . IsNA ? ( long ? ) null : ( long ) x ) ;
408+ return CreateActionSetter < DvInt8 , long ? > ( input , index , poke , x => ( long ? ) x ) ;
381409 }
382410 else if ( fieldType == typeof ( sbyte ) )
383411 {
@@ -389,7 +417,7 @@ private Action<TRow> GenerateSetter(IRow input, int index, InternalSchemaDefinit
389417 {
390418 Ch . Assert ( colType == NumberType . I1 ) ;
391419 Ch . Assert ( peek == null ) ;
392- return CreateActionSetter < DvInt1 , sbyte ? > ( input , index , poke , x => x . IsNA ? ( sbyte ? ) null : ( sbyte ) x ) ;
420+ return CreateActionSetter < DvInt1 , sbyte ? > ( input , index , poke , x => ( sbyte ? ) x ) ;
393421 }
394422 // T -> T
395423 if ( fieldType . IsGenericType && fieldType . GetGenericTypeDefinition ( ) == typeof ( Nullable < > ) )
0 commit comments