private void onQuery(Tuple tuple) { String id = tuple.getString(TopologyConstants.ID_POSITION); String query = tuple.getString(TopologyConstants.QUERY_POSITION); Metadata metadata = (Metadata) tuple.getValue(TopologyConstants.QUERY_METADATA_POSITION); // bufferedMetadata has an entry for each query that exists in the JoinBolt; therefore, we check bufferedMetadata // for existing queries (as opposed to individually checking the queries, preStartBuffer, and postFinishBuffer maps) if (bufferedMetadata.containsKey(id)) { updateCount(duplicatedQueriesCount, 1L); log.error("Duplicate for request {} with query {}", id, query); return; } Querier querier; try { querier = createQuerier(Querier.Mode.ALL, id, query, config); Optional<List<BulletError>> optionalErrors = querier.initialize(); if (!optionalErrors.isPresent()) { setupQuery(id, query, metadata, querier); return; } emitErrorsAsResult(id, metadata, optionalErrors.get()); } catch (RuntimeException re) { // Includes JSONParseException emitErrorsAsResult(id, metadata, ParsingError.makeError(re, query)); } log.error("Failed to initialize query for request {} with query {}", id, query); }
private void onQuery(Tuple tuple) { String id = tuple.getString(TopologyConstants.ID_POSITION); String query = tuple.getString(TopologyConstants.QUERY_POSITION); Metadata metadata = (Metadata) tuple.getValue(TopologyConstants.QUERY_METADATA_POSITION); // bufferedMetadata has an entry for each query that exists in the JoinBolt; therefore, we check bufferedMetadata // for existing queries (as opposed to individually checking the queries, preStartBuffer, and postFinishBuffer maps) if (bufferedMetadata.containsKey(id)) { updateCount(duplicatedQueriesCount, 1L); log.error("Duplicate for request {} with query {}", id, query); return; } Querier querier; try { querier = createQuerier(Querier.Mode.ALL, id, query, config); Optional<List<BulletError>> optionalErrors = querier.initialize(); if (!optionalErrors.isPresent()) { setupQuery(id, query, metadata, querier); return; } emitErrorsAsResult(id, metadata, optionalErrors.get()); } catch (RuntimeException re) { // Includes JSONParseException emitErrorsAsResult(id, metadata, ParsingError.makeError(re, query)); } log.error("Failed to initialize query for request {} with query {}", id, query); }