-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwriter_rainbow.cpp
More file actions
77 lines (69 loc) · 2.12 KB
/
writer_rainbow.cpp
File metadata and controls
77 lines (69 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//
// Stryke
//
// https://github.com/edmBernard/Stryke
//
// Created by Erwan BERNARD on 22/12/2018.
//
// Copyright (c) 2018 Erwan BERNARD. All rights reserved.
// Distributed under the Apache License, Version 2.0. (See accompanying
// file LICENSE or copy at http://www.apache.org/licenses/LICENSE-2.0)
//
#include "date/date.h"
#include "stryke/core.hpp"
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
int main(int argc, char const *argv[]) {
if (argc != 2) {
std::cout << "Usage: stryke_writer_rainbow <filename>\n"
<< "Write a file with 11 column with different type : <filename>.\n"
<< "The writen file will have the follwing column :\n"
<< " - Column 1 for Long\n"
<< " - Column 2 for Short\n"
<< " - Column 3 for Int\n"
<< " - Column 4 for String\n"
<< " - Column 5 for Double\n"
<< " - Column 6 for Float\n"
<< " - Column 7 for Boolean\n"
<< " - Column 8 for Date\n"
<< " - Column 9 for DateNumber\n"
<< " - Column 10 for Timestamp\n"
<< " - Column 11 for TimestampNumber\n";
return 1;
}
try {
stryke::WriterOptions options;
stryke::OrcWriterImpl<
stryke::Long,
stryke::Short,
stryke::Int,
stryke::String,
stryke::Double,
stryke::Float,
stryke::Boolean,
stryke::Date,
stryke::DateNumber,
stryke::Timestamp,
stryke::TimestampNumber> writer(
{"Long",
"Short",
"Int",
"String",
"Double",
"Float",
"Boolean",
"Date",
"DateNumber",
"Timestamp",
"TimestampNumber"}, argv[1], options);
for (int i = 0; i < 10; ++i) {
writer.write(i*10, i*100, i*1000, std::to_string(i*10000), i/10., i/100., i%3==0, "2018-12-18", i, "2018-12-18 12:26:20.123456789", i);
}
} catch (std::exception &ex) {
std::cerr << "Caught exception: " << ex.what() << "\n";
return 1;
}
return 0;
}