17 #ifndef KUDU_CLIENT_SCAN_BATCH_H 18 #define KUDU_CLIENT_SCAN_BATCH_H 28 #ifdef KUDU_HEADERS_NO_STUBS 29 #include "kudu/gutil/macros.h" 30 #include "kudu/gutil/port.h" 32 #include "kudu/client/stubs.h" 35 #include "kudu/util/int128.h" 36 #include "kudu/util/kudu_export.h" 37 #include "kudu/util/slice.h" 116 KuduScanBatch::RowPtr Row(
int idx)
const;
119 const_iterator begin()
const;
121 const_iterator end()
const;
142 Slice direct_data()
const;
147 Slice indirect_data()
const;
151 class KUDU_NO_EXPORT Data;
153 friend class tools::ReplicaDumper;
163 RowPtr() : schema_(NULL), row_data_(NULL) {}
175 bool IsNull(
const Slice& col_name)
const;
180 bool IsNull(
int col_idx)
const;
188 Status IsDeleted(
bool* val)
const WARN_UNUSED_RESULT KUDU_NO_EXPORT;
203 Status GetBool(
const Slice& col_name,
bool* val)
const WARN_UNUSED_RESULT;
205 Status GetInt8(
const Slice& col_name, int8_t* val)
const WARN_UNUSED_RESULT;
206 Status GetInt16(
const Slice& col_name, int16_t* val)
const WARN_UNUSED_RESULT;
207 Status GetInt32(
const Slice& col_name, int32_t* val)
const WARN_UNUSED_RESULT;
208 Status GetInt64(
const Slice& col_name, int64_t* val)
const WARN_UNUSED_RESULT;
209 Status GetUnixTimeMicros(
const Slice& col_name, int64_t* micros_since_utc_epoch)
210 const WARN_UNUSED_RESULT;
211 Status GetDate(
const Slice& col_name, int32_t* days_since_unix_epoch)
const WARN_UNUSED_RESULT;
213 Status GetFloat(
const Slice& col_name,
float* val)
const WARN_UNUSED_RESULT;
214 Status GetDouble(
const Slice& col_name,
double* val)
const WARN_UNUSED_RESULT;
216 #if KUDU_INT128_SUPPORTED 217 Status GetUnscaledDecimal(
const Slice& col_name, int128_t* val)
const WARN_UNUSED_RESULT;
239 Status GetBool(
int col_idx,
bool* val)
const WARN_UNUSED_RESULT;
241 Status GetInt8(
int col_idx, int8_t* val)
const WARN_UNUSED_RESULT;
242 Status GetInt16(
int col_idx, int16_t* val)
const WARN_UNUSED_RESULT;
243 Status GetInt32(
int col_idx, int32_t* val)
const WARN_UNUSED_RESULT;
244 Status GetInt64(
int col_idx, int64_t* val)
const WARN_UNUSED_RESULT;
245 Status GetUnixTimeMicros(
int col_idx, int64_t* micros_since_utc_epoch)
const WARN_UNUSED_RESULT;
246 Status GetDate(
int col_idx, int32_t* days_since_unix_epoch)
const WARN_UNUSED_RESULT;
248 Status GetFloat(
int col_idx,
float* val)
const WARN_UNUSED_RESULT;
249 Status GetDouble(
int col_idx,
double* val)
const WARN_UNUSED_RESULT;
251 #if KUDU_INT128_SUPPORTED 252 Status GetUnscaledDecimal(
int col_idx, int128_t* val)
const WARN_UNUSED_RESULT;
273 Status GetString(
const Slice& col_name,
Slice* val)
const WARN_UNUSED_RESULT;
274 Status GetBinary(
const Slice& col_name,
Slice* val)
const WARN_UNUSED_RESULT;
275 Status GetVarchar(
const Slice& col_name,
Slice* val)
const WARN_UNUSED_RESULT;
299 Status GetString(
int col_idx,
Slice* val)
const WARN_UNUSED_RESULT;
300 Status GetBinary(
int col_idx,
Slice* val)
const WARN_UNUSED_RESULT;
301 Status GetVarchar(
int col_idx,
Slice* val)
const WARN_UNUSED_RESULT;
310 const void* cell(
int col_idx)
const;
313 std::string ToString()
const;
317 friend class tools::TableScanner;
318 template<
typename KeyTypeWrapper>
friend struct SliceKeysTestSetup;
319 template<
typename KeyTypeWrapper>
friend struct IntKeysTestSetup;
322 RowPtr(
const Schema* schema,
323 const uint8_t* row_data)
325 row_data_(row_data) {
329 Status Get(
const Slice& col_name,
typename T::cpp_type* val)
const;
332 Status Get(
int col_idx,
typename T::cpp_type* val)
const;
334 const Schema* schema_;
335 const uint8_t* row_data_;
338 class KUDU_EXPORT KuduScanBatch::const_iterator
339 :
public std::iterator<std::forward_iterator_tag, KuduScanBatch::RowPtr> {
345 return batch_->Row(idx_);
355 return batch_->Row(idx_);
370 const_iterator tmp(batch_, idx_);
382 return (idx_ == other.idx_) && (batch_ == other.batch_);
393 return !(*
this == other);
397 friend class KuduScanBatch;
398 const_iterator(
const KuduScanBatch* b,
int idx)
403 const KuduScanBatch*
const batch_;
408 inline KuduScanBatch::const_iterator KuduScanBatch::begin()
const {
409 return const_iterator(
this, 0);
412 inline KuduScanBatch::const_iterator KuduScanBatch::end()
const {
413 return const_iterator(
this, NumRows());
A representation of a table's schema.
Definition: schema.h:594
A representation of an operation's outcome.
Definition: status.h:165
Definition: callbacks.h:28
RowPtr value_type
A handy typedef for the RowPtr.
Definition: scan_batch.h:98
RowPtr()
Definition: scan_batch.h:163
KuduScanBatch::RowPtr operator*() const
Definition: scan_batch.h:344
A wrapper around externally allocated data.
Definition: slice.h:51
This class is a representation of a single scan.
Definition: client.h:2012
KuduScanBatch::RowPtr operator->() const
Definition: scan_batch.h:354
bool operator==(const const_iterator &other) const
Definition: scan_batch.h:381
const_iterator operator++(int)
Definition: scan_batch.h:369
bool operator!=(const const_iterator &other) const
Definition: scan_batch.h:392
const_iterator & operator++()
Definition: scan_batch.h:361
A batch of zero or more rows returned by a scan operation.
Definition: scan_batch.h:84
const RowPtr * operator->() const
Definition: scan_batch.h:169