@@ -163,6 +163,80 @@ int Tablet::add_timestamp(uint32_t row_index, int64_t timestamp) {
163163 return E_OK;
164164}
165165
166+ int Tablet::set_timestamps (const int64_t * timestamps, uint32_t count) {
167+ if (err_code_ != E_OK) {
168+ return err_code_;
169+ }
170+ ASSERT (timestamps_ != NULL );
171+ if (UNLIKELY (count > static_cast <uint32_t >(max_row_num_))) {
172+ return E_OUT_OF_RANGE;
173+ }
174+ std::memcpy (timestamps_, timestamps, count * sizeof (int64_t ));
175+ cur_row_size_ = std::max (count, cur_row_size_);
176+ return E_OK;
177+ }
178+
179+ int Tablet::set_column_values (uint32_t schema_index, const void * data,
180+ const uint8_t * bitmap, uint32_t count) {
181+ if (err_code_ != E_OK) {
182+ return err_code_;
183+ }
184+ if (UNLIKELY (schema_index >= schema_vec_->size ())) {
185+ return E_OUT_OF_RANGE;
186+ }
187+ if (UNLIKELY (count > static_cast <uint32_t >(max_row_num_))) {
188+ return E_OUT_OF_RANGE;
189+ }
190+
191+ const MeasurementSchema& schema = schema_vec_->at (schema_index);
192+ size_t elem_size = 0 ;
193+ void * dst = nullptr ;
194+ switch (schema.data_type_ ) {
195+ case BOOLEAN:
196+ elem_size = sizeof (bool );
197+ dst = value_matrix_[schema_index].bool_data ;
198+ break ;
199+ case DATE:
200+ case INT32:
201+ elem_size = sizeof (int32_t );
202+ dst = value_matrix_[schema_index].int32_data ;
203+ break ;
204+ case TIMESTAMP:
205+ case INT64:
206+ elem_size = sizeof (int64_t );
207+ dst = value_matrix_[schema_index].int64_data ;
208+ break ;
209+ case FLOAT:
210+ elem_size = sizeof (float );
211+ dst = value_matrix_[schema_index].float_data ;
212+ break ;
213+ case DOUBLE:
214+ elem_size = sizeof (double );
215+ dst = value_matrix_[schema_index].double_data ;
216+ break ;
217+ default :
218+ return E_TYPE_NOT_SUPPORTED;
219+ }
220+
221+ if (bitmap == nullptr ) {
222+ // All valid: bulk copy + mark all as non-null
223+ std::memcpy (dst, data, count * elem_size);
224+ bitmaps_[schema_index].clear_all ();
225+ } else {
226+ // Bulk copy all data (null positions will have garbage but won't be
227+ // read).
228+ std::memcpy (dst, data, count * elem_size);
229+
230+ // bitmap uses TsFile convention (1=null, 0=valid), same as
231+ // internal BitMap, so copy directly.
232+ char * tsfile_bm = bitmaps_[schema_index].get_bitmap ();
233+ uint32_t bm_bytes = (count + 7 ) / 8 ;
234+ std::memcpy (tsfile_bm, bitmap, bm_bytes);
235+ }
236+ cur_row_size_ = std::max (count, cur_row_size_);
237+ return E_OK;
238+ }
239+
166240void * Tablet::get_value (int row_index, uint32_t schema_index,
167241 common::TSDataType& data_type) const {
168242 if (UNLIKELY (schema_index >= schema_vec_->size ())) {
0 commit comments