OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
com.mapd.logrunner.LogRunner Class Reference
+ Collaboration diagram for com.mapd.logrunner.LogRunner:

Classes

class  myThread
 

Public Member Functions

 LogRunner ()
 

Static Public Member Functions

static void main (String[] args) throws TException
 

Package Functions

void doWork (String[] args) throws TTransportException, TException
 

Static Package Attributes

static final Logger logger = LoggerFactory.getLogger(LogRunner.class)
 

Private Member Functions

Heavy.Client getClient (String hostname, int port) throws TTransportException
 
String getSession (Heavy.Client client) throws TTransportException, TDBException, TException
 
void closeSession (Heavy.Client client, String session) throws TDBException, TException
 
void theRest (Heavy.Client client, String session) throws TException
 

Private Attributes

HashMap< Integer, String > sqlquery
 
HashMap< Integer, String > originalSql
 
HashMap< Integer, String > json
 
boolean gpuMode = false
 
boolean cpuMode = false
 

Detailed Description

Definition at line 58 of file LogRunner.java.

Constructor & Destructor Documentation

com.mapd.logrunner.LogRunner.LogRunner ( )
inline

Definition at line 78 of file LogRunner.java.

References com.mapd.logrunner.LogRunner.json, com.mapd.logrunner.LogRunner.originalSql, and com.mapd.logrunner.LogRunner.sqlquery.

Referenced by com.mapd.logrunner.LogRunner.main().

78  {
79  sqlquery = new HashMap<Integer, String>();
80  originalSql = new HashMap<Integer, String>();
81  json = new HashMap<Integer, String>();
82  }
HashMap< Integer, String > sqlquery
Definition: LogRunner.java:60
HashMap< Integer, String > originalSql
Definition: LogRunner.java:61
HashMap< Integer, String > json
Definition: LogRunner.java:62

+ Here is the caller graph for this function:

Member Function Documentation

void com.mapd.logrunner.LogRunner.closeSession ( Heavy.Client  client,
String  session 
) throws TDBException, TException
inlineprivate

Definition at line 148 of file LogRunner.java.

149  {
150  // Now disconnect
151  logger.info("Trying to disconnect session " + session);
152  client.disconnect(session);
153  }
void com.mapd.logrunner.LogRunner.doWork ( String[]  args) throws TTransportException, TException
inlinepackage

Definition at line 84 of file LogRunner.java.

References run_benchmark_import.args, com.mapd.logrunner.LogRunner.getClient(), com.mapd.logrunner.LogRunner.getSession(), and Integer.

84  {
85  logger.info("In doWork here");
86 
87  int numberThreads = 3;
88  // Runnable[] worker = new Runnable[numberThreads];
89  //
90  // for (int i = 0; i < numberThreads; i++){
91  //
92  Heavy.Client client = getClient(args[0], Integer.valueOf(args[1]));
93  String session = getSession(client);
94  // worker[i] = new myThread(client, session);
95  // }
96 
97  logger.info("got session");
98  try {
99  // ExecutorService executor = Executors.newFixedThreadPool(6);
100  ExecutorService executor = new ThreadPoolExecutor(numberThreads,
101  numberThreads,
102  0L,
103  TimeUnit.MILLISECONDS,
104  new ArrayBlockingQueue<Runnable>(15),
105  new ThreadPoolExecutor.CallerRunsPolicy());
106  while (true) {
107  // BufferedReader in = new BufferedReader(new
108  // FileReader("/data/logfiles/log1"));
109  BufferedReader in = new BufferedReader(new FileReader(args[2]));
110  String str;
111  int current = 0;
112  while ((str = in.readLine()) != null) {
113  Runnable worker = new myThread(str, client, session);
114  // executor.execute(worker);
115  worker.run();
116  }
117  in.close();
118  logger.info("############loop complete");
119  }
120  // executor.shutdown();
121  } catch (IOException e) {
122  logger.error("IOException " + e.getMessage());
123  }
124  }
String getSession(Heavy.Client client)
Definition: LogRunner.java:141
Heavy.Client getClient(String hostname, int port)
Definition: LogRunner.java:126

+ Here is the call graph for this function:

Heavy.Client com.mapd.logrunner.LogRunner.getClient ( String  hostname,
int  port 
) throws TTransportException
inlineprivate

Definition at line 126 of file LogRunner.java.

Referenced by com.mapd.logrunner.LogRunner.doWork().

126  {
127  TTransport transport = null;
128 
129  // transport = new TSocket("localhost", 6274);
130  transport = new THttpClient("http://" + hostname + ":" + port);
131 
132  transport.open();
133 
134  // TProtocol protocol = new TBinaryProtocol(transport);
135  TProtocol protocol = new TJSONProtocol(transport);
136  // TProtocol protocol = new TProtocol(transport);
137 
138  return new Heavy.Client(protocol);
139  }

+ Here is the caller graph for this function:

String com.mapd.logrunner.LogRunner.getSession ( Heavy.Client  client) throws TTransportException, TDBException, TException
inlineprivate

Definition at line 141 of file LogRunner.java.

Referenced by com.mapd.logrunner.LogRunner.doWork().

142  {
143  String session = client.connect("mapd", "HyperInteractive", "mapd");
144  logger.info("Connected session is " + session);
145  return session;
146  }

+ Here is the caller graph for this function:

static void com.mapd.logrunner.LogRunner.main ( String[]  args) throws TException
inlinestatic

Definition at line 66 of file LogRunner.java.

References run_benchmark_import.args, and com.mapd.logrunner.LogRunner.LogRunner().

66  {
67  logger.info("Hello, World");
68 
69  LogRunner x = new LogRunner();
70  try {
71  x.doWork(args);
72  } catch (TTransportException ex) {
73  logger.error(ex.toString());
74  ex.printStackTrace();
75  }
76  }

+ Here is the call graph for this function:

void com.mapd.logrunner.LogRunner.theRest ( Heavy.Client  client,
String  session 
) throws TException
inlineprivate

Definition at line 155 of file LogRunner.java.

References report.rows, run_benchmark_import.tables, and run_benchmark_import.type.

155  {
156  // lets fetch databases from mapd
157  List<TDBInfo> dbs = client.get_databases(session);
158 
159  for (TDBInfo db : dbs) {
160  logger.info("db is " + db.toString());
161  }
162 
163  // lets fetch tables from mapd
164  List<String> tables = client.get_tables(session);
165 
166  for (String tab : tables) {
167  logger.info("Tables is " + tab);
168  }
169 
170  // lets get the version
171  logger.info("Version " + client.get_version());
172 
173  // get table_details
174  TTableDetails table_details = client.get_table_details(session, "flights");
175  for (TColumnType col : table_details.row_desc) {
176  logger.info("col name :" + col.col_name);
177  logger.info("\tcol encoding :" + col.col_type.encoding);
178  logger.info("\tcol is_array :" + col.col_type.is_array);
179  logger.info("\tcol nullable :" + col.col_type.nullable);
180  logger.info("\tcol type :" + col.col_type.type);
181  }
182 
183  // client.set_execution_mode(session, TExecuteMode.CPU);
184  logger.info(" -- before query -- ");
185 
186  TQueryResult sql_execute = client.sql_execute(session,
187  "Select uniquecarrier,flightnum from flights LIMIT 3;",
188  true,
189  null,
190  -1,
191  -1);
192  // client.send_sql_execute(session, "Select BRAND from ACV ;", true);
193  // logger.info(" -- before query recv -- ");
194  // TQueryResult sql_execute = client.recv_sql_execute();
195 
196  logger.info(" -- after query -- ");
197 
198  logger.info("TQueryResult execution time is " + sql_execute.getExecution_time_ms());
199  logger.info("TQueryResult is " + sql_execute.toString());
200  logger.info("TQueryResult getFieldValue is "
201  + sql_execute.getFieldValue(TQueryResult._Fields.ROW_SET));
202 
203  TRowSet row_set = sql_execute.getRow_set();
204  Object fieldValue = sql_execute.getFieldValue(TQueryResult._Fields.ROW_SET);
205 
206  logger.info("fieldValue " + fieldValue);
207 
208  logger.info("TRowSet is " + row_set.toString());
209 
210  logger.info("Get rows size " + row_set.getRowsSize());
211  logger.info("Get col size " + row_set.getRowsSize());
212 
213  List<TRow> rows = row_set.getRows();
214  int count = 1;
215  for (TRow row : rows) {
216  List<TDatum> cols = row.getCols();
217  if (cols != null) {
218  for (TDatum dat : cols) {
219  logger.info("ROW " + count + " " + dat.getFieldValue(TDatum._Fields.VAL));
220  }
221  count++;
222  }
223  }
224 
225  List<TColumn> columns = row_set.getColumns();
226 
227  logger.info("columns " + columns);
228  count = 1;
229  for (TColumn col : columns) {
230  TColumnData data = col.getData();
231  if (data != null) {
232  logger.info("COL " + count + " " + data.toString());
233  }
234  count++;
235  }
236  }
tuple rows
Definition: report.py:114

Member Data Documentation

boolean com.mapd.logrunner.LogRunner.cpuMode = false
private

Definition at line 64 of file LogRunner.java.

Referenced by com.mapd.logrunner.LogRunner.myThread.run().

boolean com.mapd.logrunner.LogRunner.gpuMode = false
private

Definition at line 63 of file LogRunner.java.

Referenced by com.mapd.logrunner.LogRunner.myThread.run().

HashMap<Integer, String> com.mapd.logrunner.LogRunner.json
private

Definition at line 62 of file LogRunner.java.

Referenced by com.mapd.logrunner.LogRunner.LogRunner().

final Logger com.mapd.logrunner.LogRunner.logger = LoggerFactory.getLogger(LogRunner.class)
staticpackage

Definition at line 59 of file LogRunner.java.

HashMap<Integer, String> com.mapd.logrunner.LogRunner.originalSql
private

Definition at line 61 of file LogRunner.java.

Referenced by com.mapd.logrunner.LogRunner.LogRunner().

HashMap<Integer, String> com.mapd.logrunner.LogRunner.sqlquery
private

Definition at line 60 of file LogRunner.java.

Referenced by com.mapd.logrunner.LogRunner.LogRunner().


The documentation for this class was generated from the following file: