private synchronized void setQueryOutputInfo(QueryExecution.QueryOutputInfo outputInfo) { // if first callback, set column names if (columns == null) { List<String> columnNames = outputInfo.getColumnNames(); List<Type> columnTypes = outputInfo.getColumnTypes(); checkArgument(columnNames.size() == columnTypes.size(), "Column names and types size mismatch"); ImmutableList.Builder<Column> list = ImmutableList.builder(); for (int i = 0; i < columnNames.size(); i++) { list.add(new Column(columnNames.get(i), columnTypes.get(i))); } columns = list.build(); types = outputInfo.getColumnTypes(); } for (URI outputLocation : outputInfo.getBufferLocations()) { exchangeClient.addLocation(outputLocation); } if (outputInfo.isNoMoreBufferLocations()) { exchangeClient.noMoreLocations(); } }
private void assertQueryResult(String type, Object data, Object expected) { List<List<Object>> rows = newArrayList(fixData( ImmutableList.of(new Column("test", parseTypeSignature(type))), ImmutableList.of(ImmutableList.of(data)))); assertEquals(rows.size(), 1); assertEquals(rows.get(0).size(), 1); assertEquals(rows.get(0).get(0), expected); } }
private List<String> createResults() { List<Column> columns = ImmutableList.of(new Column("_col0", BigintType.BIGINT)); return ImmutableList.<String>builder() .add(newQueryResults(null, 1, null, null, "QUEUED")) .add(newQueryResults(1, 2, columns, null, "RUNNING")) .add(newQueryResults(1, 3, columns, null, "RUNNING")) .add(newQueryResults(0, 4, columns, ImmutableList.of(ImmutableList.of(253161)), "RUNNING")) .add(newQueryResults(null, null, columns, null, "FINISHED")) .build(); }
private String createResults() { QueryResults queryResults = new QueryResults( "20160128_214710_00012_rk68b", server.url("/query.html?20160128_214710_00012_rk68b").uri(), null, null, ImmutableList.of(new Column("_col0", BigintType.BIGINT)), ImmutableList.of(ImmutableList.of(123)), StatementStats.builder().setState("FINISHED").build(), //new StatementStats("FINISHED", false, true, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, null), null, ImmutableList.of(), null, null); return QUERY_RESULTS_CODEC.toJson(queryResults); }
columns = ImmutableList.of(new Column("result", BooleanType.BOOLEAN)); data = ImmutableSet.of(ImmutableList.of(true));
private static List<Column> createColumnsList(QueryInfo queryInfo) { requireNonNull(queryInfo, "queryInfo is null"); StageInfo outputStage = queryInfo.getOutputStage(); requireNonNull(outputStage, "outputStage is null"); List<String> names = queryInfo.getFieldNames(); List<Type> types = outputStage.getTypes(); checkArgument(names.size() == types.size(), "names and types size mismatch"); ImmutableList.Builder<Column> list = ImmutableList.builder(); for (int i = 0; i < names.size(); i++) { String name = names.get(i); TypeSignature typeSignature = types.get(i).getTypeSignature(); String type = typeSignature.toString(); list.add(new Column(name, type, new ClientTypeSignature(typeSignature))); } return list.build(); }
private void assertQueryResult(String type, Object data, Object expected) { List<List<Object>> rows = newArrayList(fixData( ImmutableList.of(new Column("test", parseTypeSignature(type))), ImmutableList.of(ImmutableList.of(data)))); assertEquals(rows.size(), 1); assertEquals(rows.get(0).size(), 1); assertEquals(rows.get(0).get(0), expected); } }
private List<String> createResults() { List<Column> columns = ImmutableList.of(new Column("_col0", BigintType.BIGINT)); return ImmutableList.<String>builder() .add(newQueryResults(null, 1, null, null, "QUEUED")) .add(newQueryResults(1, 2, columns, null, "RUNNING")) .add(newQueryResults(1, 3, columns, null, "RUNNING")) .add(newQueryResults(0, 4, columns, ImmutableList.of(ImmutableList.of(253161)), "RUNNING")) .add(newQueryResults(null, null, columns, null, "FINISHED")) .build(); }
columns = ImmutableList.of(new Column("result", "boolean", new ClientTypeSignature(StandardTypes.BOOLEAN, ImmutableList.of()))); data = ImmutableSet.<List<Object>>of(ImmutableList.<Object>of(true));