0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
LoadDataSourceFactory.cc
Go to the documentation of this file.
1 
22 #include "Common/Compat.h"
23 #include "HqlInterpreter.h"
24 #include "LoadDataSourceFactory.h"
26 #include "LoadDataSourceFileDfs.h"
27 #include "LoadDataSourceStdin.h"
28 
29 using namespace Hypertable;
30 using namespace std;
31 
37  const string &input_fname, const int src,
38  const string &header_fname, const int header_src,
39  const std::vector<String> &key_columns, const string &timestamp_column,
40  char field_separator, int row_uniquify_chars, int load_flags) {
41 
42  LoadDataSource *lds;
43 
44  switch (src) {
45  case LOCAL_FILE:
46  lds = new LoadDataSourceFileLocal(input_fname, header_fname,
47  row_uniquify_chars, load_flags);
48  break;
49  case DFS_FILE:
50  lds = new LoadDataSourceFileDfs(dfs_client, input_fname, header_fname,
51  row_uniquify_chars, load_flags );
52  break;
53  case STDIN:
54  lds = new LoadDataSourceStdin(header_fname, row_uniquify_chars, load_flags);
55  break;
56  default:
57  HT_THROW(Error::HQL_PARSE_ERROR, "LOAD DATA - bad filename");
58  }
59 
60  lds->init(key_columns, timestamp_column, field_separator);
61  return lds;
62 }
63 
STL namespace.
virtual void init(const std::vector< String > &key_columns, const std::string &timestamp_column, char field_separator)
std::shared_ptr< Client > ClientPtr
Smart pointer to Client.
Definition: Client.h:233
Compatibility Macros for C/C++.
Hypertable definitions
#define HT_THROW(_code_, _msg_)
Definition: Error.h:478
static LoadDataSource * create(FsBroker::Lib::ClientPtr &dfs_client, const std::string &fname, const int src, const std::string &header_fname, const int header_src, const std::vector< String > &key_columns, const std::string &timestamp_column, char field_separator, int row_uniquify_chars, int load_flags)