28 using namespace impala;
32 int main(
int argc,
char **argv) {
34 string min_std_str(
"a");
35 string max_std_str(
"zzzzzz");
37 StringValue min_str(const_cast<char*>(min_std_str.c_str()), min_std_str.size());
38 StringValue max_str(const_cast<char*>(max_std_str.c_str()), max_std_str.size());
40 vector<DataProvider::ColDesc> cols;
41 cols.push_back(DataProvider::ColDesc::Create<bool>(
false,
true));
42 cols.push_back(DataProvider::ColDesc::Create<bool>(
44 cols.push_back(DataProvider::ColDesc::Create<int8_t>(0, 8));
46 cols.push_back(DataProvider::ColDesc::Create<int16_t>(8, 16));
47 cols.push_back(DataProvider::ColDesc::Create<int32_t>(16, 32));
48 cols.push_back(DataProvider::ColDesc::Create<int64_t>(32, 64));
49 cols.push_back(DataProvider::ColDesc::Create<float>(-1, 1));
51 cols.push_back(DataProvider::ColDesc::Create<double>(200, 300));
52 cols.push_back(DataProvider::ColDesc::Create<StringValue>(min_str, max_str));
60 provider.
Reset(20, 2, cols);
64 cout <<
"Row size: " << provider.
row_size() << endl;
66 while ( (data = provider.
NextBatch(&rows)) != NULL) {
67 provider.
Print(&cout, reinterpret_cast<char*>(data), rows);
72 cout << endl <<
"Done." << endl;
void Reset(int num_rows, int batch_size, const std::vector< ColDesc > &columns)
void * NextBatch(int *rows_returned)
See data-provider-test.cc on how to use this.
ObjectPool * obj_pool()
Returns a local object pool.
int main(int argc, char **argv)
This class is thread-safe.
void PrettyPrint(std::ostream *s, const std::string &prefix="") const
int row_size() const
The size of a row (tuple size)
void Print(std::ostream *, char *data, int num_rows) const
Print the row data in csv format.