@Test public void testExecute() throws Exception { createTable("execute_test"); insertData("execute_test"); final String query = "SELECT * FROM execute_test"; QueryContext context = createQueryContext(query); LensResultSet resultSet = driver.execute(context); assertNotNull(resultSet); if (resultSet instanceof InMemoryResultSet) { InMemoryResultSet rs = (InMemoryResultSet) resultSet; LensResultSetMetadata rsMeta = rs.getMetadata(); assertEquals(rsMeta.getColumns().size(), 1); ColumnDescriptor col1 = rsMeta.getColumns().get(0); assertEquals(col1.getTypeName().toLowerCase(), "int"); assertEquals(col1.getName(), "ID"); while (rs.hasNext()) { ResultRow row = rs.next(); List<Object> rowObjects = row.getValues(); } if (rs instanceof JDBCResultSet) { ((JDBCResultSet) rs).close(); } } }
@Override public LensResultSet execute(QueryContext context) throws LensException { checkConfigured(); String rewrittenQuery = rewriteQuery(context); log.info("{} Execute {}", getFullyQualifiedName(), context.getQueryHandle()); QueryResult result = executeInternal(context, rewrittenQuery); return result.getLensResultSet(true); }
JDBCDriver extends AbstractLensDriver { @Override public LensResultSet execute(QueryContext context) throws LensException { checkConfigured(); String rewrittenQuery = rewriteQuery(context); log.info("{} Execute {}", getFullyQualifiedName(), context.getQueryHandle()); QueryResult result = executeInternal(context, rewrittenQuery); return result.getLensResultSet(true); } }
JDBCDriver extends AbstractLensDriver { @Override public LensResultSet execute(QueryContext context) throws LensException { checkConfigured(); String rewrittenQuery = rewriteQuery(context); log.info("{} Execute {}", getFullyQualifiedName(), context.getQueryHandle()); QueryResult result = executeInternal(context, rewrittenQuery); return result.getLensResultSet(true); }  }
JDBCDriver extends AbstractLensDriver { @Override public LensResultSet execute(QueryContext context) throws LensException { checkConfigured(); String rewrittenQuery = rewriteQuery(context); log.info("{} Execute {}", getFullyQualifiedName(), context.getQueryHandle()); QueryResult result = executeInternal(context, rewrittenQuery); return result.getLensResultSet(true); }  @Override void configure(Configuration conf, String driverType, String driverName); void init(); QueryCost calculateQueryCost(AbstractQueryContext qctx); @Override QueryCost estimate(AbstractQueryContext qctx); @Override DriverQueryPlan explain(AbstractQueryContext explainCtx); void validate(AbstractQueryContext pContext); @Override void prepare(PreparedQueryContext pContext); @Override DriverQueryPlan explainAndPrepare(PreparedQueryContext pContext); @Override void closePreparedQuery(QueryPrepareHandle handle); @Override LensResultSet execute(QueryContext context); @Override void executeAsync(QueryContext context); @Override void updateStatus(QueryContext context); @Override void closeResultSet(QueryHandle handle); @Override boolean cancelQuery(QueryHandle handle); @Override void closeQuery(QueryHandle handle); @Override void close(); @Override void registerDriverEventListener(LensEventListener<DriverEvent> driverEventListener); @Override void readExternal(ObjectInput arg0); @Override void writeExternal(ObjectOutput arg0); @Override StatusUpdateMethod getStatusUpdateMethod(); }
JDBCDriver extends AbstractLensDriver { @Override public LensResultSet execute(QueryContext context) throws LensException { checkConfigured(); String rewrittenQuery = rewriteQuery(context); log.info("{} Execute {}", getFullyQualifiedName(), context.getQueryHandle()); QueryResult result = executeInternal(context, rewrittenQuery); return result.getLensResultSet(true); }  @Override void configure(Configuration conf, String driverType, String driverName); void init(); QueryCost calculateQueryCost(AbstractQueryContext qctx); @Override QueryCost estimate(AbstractQueryContext qctx); @Override DriverQueryPlan explain(AbstractQueryContext explainCtx); void validate(AbstractQueryContext pContext); @Override void prepare(PreparedQueryContext pContext); @Override DriverQueryPlan explainAndPrepare(PreparedQueryContext pContext); @Override void closePreparedQuery(QueryPrepareHandle handle); @Override LensResultSet execute(QueryContext context); @Override void executeAsync(QueryContext context); @Override void updateStatus(QueryContext context); @Override void closeResultSet(QueryHandle handle); @Override boolean cancelQuery(QueryHandle handle); @Override void closeQuery(QueryHandle handle); @Override void close(); @Override void registerDriverEventListener(LensEventListener<DriverEvent> driverEventListener); @Override void readExternal(ObjectInput arg0); @Override void writeExternal(ObjectOutput arg0); @Override StatusUpdateMethod getStatusUpdateMethod(); static final AtomicInteger THID; }