org.apache.lens.server.api.query.QueryContext.setLensSessionIdentifier()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中org.apache.lens.server.api.query.QueryContext.setLensSessionIdentifier方法的一些代码示例,展示了QueryContext.setLensSessionIdentifier的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QueryContext.setLensSessionIdentifier方法的具体详情如下:
包路径:org.apache.lens.server.api.query.QueryContext
类名称:QueryContext
方法名:setLensSessionIdentifier

QueryContext.setLensSessionIdentifier介绍

暂无

代码示例

代码示例来源:origin: org.apache.lens/lens-server-api

/**
 * Utility create method to create context with single driver.
 *
 * @param query The user query
 * @param user The submitted query
 * @param qconf The query lens conf
 * @param conf Query configuration object - merged with session
 * @param driver The driver
 * @param lensSessionPublicId The session id
 *
 * @return QueryContext object
 */
public static QueryContext createContextWithSingleDriver(String query, String user, LensConf qconf,
 Configuration conf, LensDriver driver, String lensSessionPublicId, boolean mergeDriverConf) {
 QueryContext ctx = new QueryContext(query, user, qconf, conf, Lists.newArrayList(driver), driver, mergeDriverConf);
 ctx.setLensSessionIdentifier(lensSessionPublicId);
 return ctx;
}

代码示例来源:origin: apache/lens

/**
 * Utility create method to create context with single driver.
 *
 * @param query The user query
 * @param user The submitted query
 * @param qconf The query lens conf
 * @param conf Query configuration object - merged with session
 * @param driver The driver
 * @param lensSessionPublicId The session id
 *
 * @return QueryContext object
 */
public static QueryContext createContextWithSingleDriver(String query, String user, LensConf qconf,
 Configuration conf, LensDriver driver, String lensSessionPublicId, boolean mergeDriverConf) {
 QueryContext ctx = new QueryContext(query, user, qconf, conf, Lists.newArrayList(driver), driver, mergeDriverConf);
 ctx.setLensSessionIdentifier(lensSessionPublicId);
 return ctx;
}

代码示例来源:origin: apache/lens

/**
 * Execute async internal.
 *
 * @param sessionHandle the session handle
 * @param ctx           the ctx
 * @return the query handle
 * @throws LensException the lens exception
 */
private QueryHandle executeAsyncInternal(LensSessionHandle sessionHandle, QueryContext ctx) throws LensException {
 ctx.setLensSessionIdentifier(sessionHandle.getPublicId().toString());
 rewriteAndSelect(ctx);
 return submitQuery(ctx);
}

代码示例来源:origin: apache/lens

protected QueryContext createContext(final String query, Configuration conf, LensDriver driver) throws LensException {
 QueryContext context = new QueryContext(query, "testuser", new LensConf(), conf, Arrays.asList(driver));
 // session id has to be set before calling setDriverQueriesAndPlans
 context.setLensSessionIdentifier(sessionid);
 return context;
}

代码示例来源:origin: apache/lens

protected QueryContext createContext(PreparedQueryContext query, Configuration conf) {
 QueryContext context = new QueryContext(query, "testuser", new LensConf(), conf);
 context.setLensSessionIdentifier(sessionid);
 return context;
}

代码示例来源:origin: apache/lens

protected QueryContext createContext(final String query, Configuration conf) throws LensException {
 QueryContext context = new QueryContext(query, "testuser", new LensConf(), conf, drivers);
 // session id has to be set before calling setDriverQueriesAndPlans
 context.setLensSessionIdentifier(sessionid);
 return context;
}

代码示例来源:origin: apache/lens

@Override
public QueryHandleWithResultSet execute(LensSessionHandle sessionHandle, String query, long timeoutMillis,
 LensConf conf, String queryName) throws LensException {
 try {
  log.info("Blocking execute session:{} query: {} timeout: {}", sessionHandle, query, timeoutMillis);
  acquire(sessionHandle);
  Configuration qconf = getLensConf(sessionHandle, conf);
  accept(query, qconf, SubmitOp.EXECUTE);
  QueryContext ctx = createContext(query, getSession(sessionHandle).getLoggedInUser(), conf, qconf, timeoutMillis);
  ctx.setQueryName(queryName);
  ctx.setLensSessionIdentifier(sessionHandle.getPublicId().toString());
  rewriteAndSelect(ctx);
  return executeTimeoutInternal(sessionHandle, ctx, timeoutMillis, qconf);
 } finally {
  release(sessionHandle);
 }
}

代码示例来源:origin: apache/lens

@Test
public void testPriorityOnMockQuery() throws Exception {
 String query = "select mock, fail from " + TEST_TABLE;
 QueryContext ctx = queryService.createContext(query, null, new LensConf(), new Configuration(), 5000L);
 ctx.setLensSessionIdentifier(lensSessionId.getPublicId().toString());
 queryService.acquire(lensSessionId);
 try {
  queryService.rewriteAndSelect(ctx);
 } finally {
  queryService.release(lensSessionId);
 }
 assertNotNull(ctx.getSelectedDriver());
 assertEquals(ctx.getPriority(), Priority.NORMAL);
}

代码示例来源:origin: apache/lens

@Override
public QueryHandle executePrepareAsync(LensSessionHandle sessionHandle, QueryPrepareHandle prepareHandle,
 LensConf conf, String queryName) throws LensException {
 try {
  log.info("ExecutePrepareAsync: session:{} prepareHandle:{}", sessionHandle, prepareHandle.getPrepareHandleId());
  acquire(sessionHandle);
  PreparedQueryContext pctx = getPreparedQueryContext(sessionHandle, prepareHandle);
  Configuration qconf = getLensConf(sessionHandle, conf);
  accept(pctx.getUserQuery(), qconf, SubmitOp.EXECUTE);
  QueryContext ctx = createContext(pctx, getSession(sessionHandle).getLoggedInUser(), conf, qconf, 0);
  if (StringUtils.isNotBlank(queryName)) {
   // Override previously set query name
   ctx.setQueryName(queryName);
  } else {
   ctx.setQueryName(pctx.getQueryName());
  }
  ctx.setLensSessionIdentifier(sessionHandle.getPublicId().toString());
  return submitQuery(ctx);
 } finally {
  release(sessionHandle);
 }
}

相关文章

微信公众号

最新文章

更多