@@ -172,6 +172,7 @@ cdef inline insert_non_null_ad_index(list non_null_ad_ixs,
172172cdef _array_for_column_impl(object dtype,
173173 np.ndarray[column_type, ndim= 2 ] out_array,
174174 Py_ssize_t size,
175+ np.ndarray[np.int64_t] timestamps,
175176 np.ndarray[np.int64_t] ts_ixs,
176177 np.ndarray[np.int64_t] asof_dates,
177178 np.ndarray[np.int64_t] asof_ixs,
@@ -303,9 +304,11 @@ cdef _array_for_column_impl(object dtype,
303304 asof_ix = asof_ixs[n]
304305 if asof_ix == out_of_bounds_ix:
305306 raise ValueError (
306- ' asof_date newer than timestamp: sid=%s , asof_date=%s ' % (
307+ ' asof_date newer than timestamp:'
308+ ' sid=%s , asof_date=%s , timestamp=%s ' % (
307309 sid,
308310 np.datetime64(asof_dates[n], ' ns' ),
311+ np.datetime64(timestamps[n], ' ns' ),
309312 ),
310313 )
311314
@@ -444,6 +447,7 @@ cdef _array_for_column_impl(object dtype,
444447cdef array_for_column(object dtype,
445448 tuple out_shape,
446449 Py_ssize_t size,
450+ np.ndarray[np.int64_t] timestamps,
447451 np.ndarray[np.int64_t] ts_ixs,
448452 np.ndarray[np.int64_t] asof_dates,
449453 np.ndarray[np.int64_t] asof_ixs,
@@ -464,6 +468,7 @@ cdef array_for_column(object dtype,
464468 dtype,
465469 out_array,
466470 size,
471+ timestamps,
467472 ts_ixs,
468473 asof_dates,
469474 asof_ixs,
@@ -479,6 +484,7 @@ cdef array_for_column(object dtype,
479484 dtype,
480485 out_array.view(' int64' ),
481486 size,
487+ timestamps,
482488 ts_ixs,
483489 asof_dates,
484490 asof_ixs,
@@ -494,6 +500,7 @@ cdef array_for_column(object dtype,
494500 dtype,
495501 out_array,
496502 size,
503+ timestamps,
497504 ts_ixs,
498505 asof_dates,
499506 asof_ixs,
@@ -510,6 +517,7 @@ cdef array_for_column(object dtype,
510517 dtype,
511518 out_array,
512519 size,
520+ timestamps,
513521 ts_ixs,
514522 asof_dates,
515523 asof_ixs,
@@ -525,6 +533,7 @@ cdef array_for_column(object dtype,
525533 dtype,
526534 out_array.view(' uint8' ),
527535 size,
536+ timestamps,
528537 ts_ixs,
529538 asof_dates,
530539 asof_ixs,
@@ -585,6 +594,14 @@ cdef arrays_from_rows(DatetimeIndex_t dates,
585594 column.dtype,
586595 out_shape,
587596 size,
597+ (
598+ all_rows[TS_FIELD_NAME].values.view(' int64' )
599+ if len (all_rows) else
600+ # workaround for empty data frames which often lost type
601+ # information; enforce than an empty column as an int64 type
602+ # instead of object type
603+ np.array([], dtype = ' int64' )
604+ ),
588605 ts_ixs,
589606 (
590607 all_rows[AD_FIELD_NAME].values.view(' int64' )
0 commit comments