@@ -58,7 +58,9 @@ CiderBatch::CiderBatch(ArrowSchema* schema,
5858
5959CiderBatch::~CiderBatch () {
6060 releaseArrowEntries ();
61+ #ifdef CIDER_BATCH_CIDER_IMPL
6162 destroy (); // TODO: Remove
63+ #endif
6264}
6365
6466CiderBatch::CiderBatch (const CiderBatch& rh) {
@@ -95,8 +97,9 @@ CiderBatch::CiderBatch(CiderBatch&& rh) noexcept {
9597 rh.arrow_schema_ = nullptr ;
9698 rh.ownership_ = false ;
9799 rh.reallocate_ = false ;
98-
100+ # ifdef CIDER_BATCH_CIDER_IMPL
99101 moveFrom (&rh); // TODO: Remove
102+ #endif
100103}
101104
102105CiderBatch& CiderBatch::operator =(CiderBatch&& rh) noexcept {
@@ -115,8 +118,9 @@ CiderBatch& CiderBatch::operator=(CiderBatch&& rh) noexcept {
115118 rh.ownership_ = false ;
116119 rh.reallocate_ = false ;
117120
121+ #ifdef CIDER_BATCH_CIDER_IMPL
118122 moveFrom (&rh); // TODO: Remove
119-
123+ # endif
120124 return *this ;
121125}
122126
@@ -283,13 +287,8 @@ void CiderBatch::convertToArrowRepresentation() {
283287 arrow_array_->children [i] = new ArrowArray ();
284288 arrow_array_->children [i]->length = row_num ();
285289 arrow_array_->children [i]->n_children = 0 ;
286- arrow_array_->children [i]->buffers = (const void **)std::malloc (sizeof (void *) * 2 );
287- // FIXME: fill actual null
288290 void * null_buf = std::malloc (row_num () / 8 + 1 );
289291 std::memset (null_buf, 0xFF , row_num () / 8 + 1 );
290- arrow_array_->children [i]->buffers [0 ] = null_buf;
291- arrow_array_->children [i]->buffers [1 ] = table_ptr_[i];
292- arrow_array_->children [i]->n_buffers = 2 ;
293292 arrow_array_->children [i]->private_data = nullptr ;
294293 arrow_array_->children [i]->dictionary = nullptr ;
295294 arrow_array_->children [i]->release = CiderBatchUtils::ciderEmptyArrowArrayReleaser;
@@ -300,6 +299,29 @@ void CiderBatch::convertToArrowRepresentation() {
300299 arrow_schema_->children [i]->n_children = 0 ;
301300 arrow_schema_->children [i]->children = nullptr ;
302301 arrow_schema_->children [i]->release = CiderBatchUtils::ciderEmptyArrowSchemaReleaser;
302+
303+ // (Kunshang)To be removed. temp code to pass ut.
304+ // CiderStringTest::CiderStringTestArrow
305+ if (schema_->getColumnTypeById (i).has_varchar ()) {
306+ arrow_array_->children [i]->n_buffers = 3 ;
307+ arrow_array_->children [i]->buffers = (const void **)std::malloc (sizeof (void *) * 3 );
308+ arrow_array_->children [i]->buffers [0 ] = null_buf;
309+
310+ arrow_schema_->children [i]->format = " " ;
311+ // 10 string row 0-9
312+ int32_t * offset_buf = new int [11 ]{0 , 10 , 20 , 30 , 40 , 50 , 60 , 70 , 80 , 90 , 100 };
313+ char * data_buf (
314+ " 000000000011111111112222222222333333333344444444445555555555666666666677777777"
315+ " 7788888888889999999999" );
316+ arrow_array_->children [i]->buffers [1 ] = offset_buf;
317+ arrow_array_->children [i]->buffers [2 ] = data_buf;
318+ } else {
319+ arrow_array_->children [i]->buffers = (const void **)std::malloc (sizeof (void *) * 2 );
320+ // FIXME: fill actual null
321+ arrow_array_->children [i]->buffers [0 ] = null_buf;
322+ arrow_array_->children [i]->buffers [1 ] = table_ptr_[i];
323+ arrow_array_->children [i]->n_buffers = 2 ;
324+ }
303325 }
304326}
305327
0 commit comments