public void populateCache() { String schemaName = queryRunner.getSession().getSchema(); if (schemaName != null) { executor.execute(() -> { functionCache.refresh(schemaName); tableCache.refresh(schemaName); }); } }
public void populateCache() { String schemaName = queryRunner.getSession().getSchema(); if (schemaName != null) { executor.execute(() -> { functionCache.refresh(schemaName); tableCache.refresh(schemaName); }); } }
@Override public int complete(String buffer, int cursor, List<CharSequence> candidates) { if (cursor <= 0) { return cursor; } int blankPos = findLastBlank(buffer.substring(0, cursor)); String prefix = buffer.substring(blankPos + 1, cursor); String schemaName = queryRunner.getSession().getSchema(); if (schemaName != null) { List<String> functionNames = functionCache.getIfPresent(schemaName); List<String> tableNames = tableCache.getIfPresent(schemaName); SortedSet<String> sortedCandidates = new TreeSet<>(); if (functionNames != null) { sortedCandidates.addAll(filterResults(functionNames, prefix)); } if (tableNames != null) { sortedCandidates.addAll(filterResults(tableNames, prefix)); } candidates.addAll(sortedCandidates); } return blankPos + 1; }
@Override public int complete(String buffer, int cursor, List<CharSequence> candidates) { if (cursor <= 0) { return cursor; } int blankPos = findLastBlank(buffer.substring(0, cursor)); String prefix = buffer.substring(blankPos + 1, cursor); String schemaName = queryRunner.getSession().getSchema(); if (schemaName != null) { List<String> functionNames = functionCache.getIfPresent(schemaName); List<String> tableNames = tableCache.getIfPresent(schemaName); SortedSet<String> sortedCandidates = new TreeSet<>(); if (functionNames != null) { sortedCandidates.addAll(filterResults(functionNames, prefix)); } if (tableNames != null) { sortedCandidates.addAll(filterResults(tableNames, prefix)); } candidates.addAll(sortedCandidates); } return blankPos + 1; }
String schema = queryRunner.getSession().getSchema(); if (schema != null) { prompt += ":" + schema;
String schema = queryRunner.getSession().getSchema(); if (schema != null) { prompt += ":" + schema;
finalSql = preprocessQuery( Optional.ofNullable(queryRunner.getSession().getCatalog()), Optional.ofNullable(queryRunner.getSession().getSchema()), sql); session = ClientSession.builder(session) .withCatalog(query.getSetCatalog().orElse(session.getCatalog())) .withSchema(query.getSetSchema().orElse(session.getSchema())) .build(); schemaChanged.run();
finalSql = preprocessQuery( Optional.ofNullable(queryRunner.getSession().getCatalog()), Optional.ofNullable(queryRunner.getSession().getSchema()), sql); session = ClientSession.builder(session) .withCatalog(query.getSetCatalog().orElse(session.getCatalog())) .withSchema(query.getSetSchema().orElse(session.getSchema())) .build(); schemaChanged.run();
benchmarkSchemas = ImmutableList.of(new BenchmarkSchema(session.getSchema()));
private Builder(ClientSession clientSession) { requireNonNull(clientSession, "clientSession is null"); server = clientSession.getServer(); user = clientSession.getUser(); source = clientSession.getSource(); traceToken = clientSession.getTraceToken(); clientTags = clientSession.getClientTags(); clientInfo = clientSession.getClientInfo(); catalog = clientSession.getCatalog(); schema = clientSession.getSchema(); path = clientSession.getPath(); timeZone = clientSession.getTimeZone(); locale = clientSession.getLocale(); resourceEstimates = clientSession.getResourceEstimates(); properties = clientSession.getProperties(); preparedStatements = clientSession.getPreparedStatements(); roles = clientSession.getRoles(); transactionId = clientSession.getTransactionId(); clientRequestTimeout = clientSession.getClientRequestTimeout(); }