/** Reads data source names from Druid. */ Set<String> tableNames() { final Map<String, String> requestHeaders = ImmutableMap.of("Content-Type", "application/json"); final String data = null; final String url = coordinatorUrl + "/druid/coordinator/v1/metadata/datasources"; if (CalcitePrepareImpl.DEBUG) { System.out.println("Druid: table names" + data + "; " + url); } try (InputStream in0 = post(url, data, requestHeaders, 10000, 1800000); InputStream in = traceResponse(in0)) { final ObjectMapper mapper = new ObjectMapper(); final CollectionType listType = mapper.getTypeFactory().constructCollectionType(List.class, String.class); final List<String> list = mapper.readValue(in, listType); return ImmutableSet.copyOf(list); } catch (IOException e) { throw new RuntimeException(e); } }
/** Reads data source names from Druid. */ Set<String> tableNames() { final Map<String, String> requestHeaders = ImmutableMap.of("Content-Type", "application/json"); final String data = null; final String url = coordinatorUrl + "/druid/coordinator/v1/metadata/datasources"; if (CalcitePrepareImpl.DEBUG) { System.out.println("Druid: table names" + data + "; " + url); } try (InputStream in0 = post(url, data, requestHeaders, 10000, 1800000); InputStream in = traceResponse(in0)) { final ObjectMapper mapper = new ObjectMapper(); final CollectionType listType = mapper.getTypeFactory().constructCollectionType(List.class, String.class); final List<String> list = mapper.readValue(in, listType); return ImmutableSet.copyOf(list); } catch (IOException e) { throw new RuntimeException(e); } }
/** Executes a query request. * * @param queryType Query type * @param data Data to post * @param sink Sink to which to send the parsed rows * @param fieldNames Names of fields * @param fieldTypes Types of fields (never null, but elements may be null) * @param page Page definition (in/out) */ public void request(QueryType queryType, String data, Sink sink, List<String> fieldNames, List<ColumnMetaData.Rep> fieldTypes, Page page) { final String url = this.url + "/druid/v2/?pretty"; final Map<String, String> requestHeaders = ImmutableMap.of("Content-Type", "application/json"); if (CalcitePrepareImpl.DEBUG) { System.out.println(data); } try (InputStream in0 = post(url, data, requestHeaders, 10000, 1800000); InputStream in = traceResponse(in0)) { parse(queryType, in, sink, fieldNames, fieldTypes, page); } catch (IOException e) { throw new RuntimeException("Error while processing druid request [" + data + "]", e); } }
/** Executes a query request. * * @param queryType Query type * @param data Data to post * @param sink Sink to which to send the parsed rows * @param fieldNames Names of fields * @param fieldTypes Types of fields (never null, but elements may be null) * @param page Page definition (in/out) */ public void request(QueryType queryType, String data, Sink sink, List<String> fieldNames, List<ColumnMetaData.Rep> fieldTypes, Page page) { final String url = this.url + "/druid/v2/?pretty"; final Map<String, String> requestHeaders = ImmutableMap.of("Content-Type", "application/json"); if (CalcitePrepareImpl.DEBUG) { System.out.println(data); } try (InputStream in0 = post(url, data, requestHeaders, 10000, 1800000); InputStream in = traceResponse(in0)) { parse(queryType, in, sink, fieldNames, fieldTypes, page); } catch (IOException e) { throw new RuntimeException("Error while processing druid request [" + data + "]", e); } }
InputStream in = traceResponse(in0)) { final ObjectMapper mapper = new ObjectMapper() .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
InputStream in = traceResponse(in0)) { final ObjectMapper mapper = new ObjectMapper() .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);