6 #ifndef __CREATE_EXTERNAL_TABLE_H__
7 #define __CREATE_EXTERNAL_TABLE_H__
18 struct CreateExternalTableRequest
26 CreateExternalTableRequest() :
27 tableName(std::string()),
28 filepaths(std::vector<std::string>()),
29 createTableOptions(std::map<std::string, std::string>()),
30 options(std::map<std::string, std::string>())
155 CreateExternalTableRequest(
const std::string& tableName_,
const std::vector<std::string>& filepaths_,
const std::map<std::string, std::string>& createTableOptions_,
const std::map<std::string, std::string>& options_):
156 tableName( tableName_ ),
157 filepaths( filepaths_ ),
158 createTableOptions( createTableOptions_ ),
163 std::string tableName;
164 std::vector<std::string> filepaths;
165 std::map<std::string, std::string> createTableOptions;
166 std::map<std::string, std::string> options;
176 template<>
struct codec_traits<gpudb::CreateExternalTableRequest>
178 static void encode(Encoder& e,
const gpudb::CreateExternalTableRequest& v)
180 ::avro::encode(e, v.tableName);
181 ::avro::encode(e, v.filepaths);
182 ::avro::encode(e, v.createTableOptions);
183 ::avro::encode(e, v.options);
186 static void decode(Decoder& d, gpudb::CreateExternalTableRequest& v)
188 if (::avro::ResolvingDecoder *rd = dynamic_cast< ::avro::ResolvingDecoder*>(&d))
190 const std::vector<size_t> fo = rd->fieldOrder();
192 for (std::vector<size_t>::const_iterator it = fo.begin(); it != fo.end(); ++it)
197 ::avro::decode(d, v.tableName);
201 ::avro::decode(d, v.filepaths);
205 ::avro::decode(d, v.createTableOptions);
209 ::avro::decode(d, v.options);
219 ::avro::decode(d, v.tableName);
220 ::avro::decode(d, v.filepaths);
221 ::avro::decode(d, v.createTableOptions);
222 ::avro::decode(d, v.options);
237 struct CreateExternalTableResponse
245 CreateExternalTableResponse() :
246 tableName(std::string()),
247 typeId(std::string()),
248 countInserted(int64_t()),
249 countSkipped(int64_t()),
250 countUpdated(int64_t()),
251 info(std::map<std::string, std::string>())
255 std::string tableName;
257 int64_t countInserted;
258 int64_t countSkipped;
259 int64_t countUpdated;
260 std::map<std::string, std::string> info;
270 template<>
struct codec_traits<gpudb::CreateExternalTableResponse>
272 static void encode(Encoder& e,
const gpudb::CreateExternalTableResponse& v)
274 ::avro::encode(e, v.tableName);
275 ::avro::encode(e, v.typeId);
276 ::avro::encode(e, v.countInserted);
277 ::avro::encode(e, v.countSkipped);
278 ::avro::encode(e, v.countUpdated);
279 ::avro::encode(e, v.info);
282 static void decode(Decoder& d, gpudb::CreateExternalTableResponse& v)
284 if (::avro::ResolvingDecoder *rd = dynamic_cast< ::avro::ResolvingDecoder*>(&d))
286 const std::vector<size_t> fo = rd->fieldOrder();
288 for (std::vector<size_t>::const_iterator it = fo.begin(); it != fo.end(); ++it)
293 ::avro::decode(d, v.tableName);
297 ::avro::decode(d, v.typeId);
301 ::avro::decode(d, v.countInserted);
305 ::avro::decode(d, v.countSkipped);
309 ::avro::decode(d, v.countUpdated);
313 ::avro::decode(d, v.info);
323 ::avro::decode(d, v.tableName);
324 ::avro::decode(d, v.typeId);
325 ::avro::decode(d, v.countInserted);
326 ::avro::decode(d, v.countSkipped);
327 ::avro::decode(d, v.countUpdated);
328 ::avro::decode(d, v.info);