/** * Constructor for exception block. */ public IntermediateResultsBlock(@Nonnull ProcessingException processingException, @Nonnull Exception e) { _processingExceptions = new ArrayList<>(); _processingExceptions.add(QueryException.getException(processingException, e)); }
@GET @Path("pql") public String get(@QueryParam("pql") String pqlQuery, @QueryParam("trace") String traceEnabled, @Context HttpHeaders httpHeaders) { try { LOGGER.debug("Trace: {}, Running query: {}", traceEnabled, pqlQuery); return getQueryResponse(pqlQuery, traceEnabled, httpHeaders); } catch (Exception e) { LOGGER.error("Caught exception while processing get request", e); return QueryException.getException(QueryException.INTERNAL_ERROR, e).toString(); } }
@POST @Path("pql") public String post(String requestJsonStr, @Context HttpHeaders httpHeaders) { try { JsonNode requestJson = JsonUtils.stringToJsonNode(requestJsonStr); String pqlQuery = requestJson.get("pql").asText(); String traceEnabled = "false"; if (requestJson.has("trace")) { traceEnabled = requestJson.get("trace").toString(); } LOGGER.debug("Trace: {}, Running query: {}", traceEnabled, pqlQuery); return getQueryResponse(pqlQuery, traceEnabled, httpHeaders); } catch (Exception e) { LOGGER.error("Caught exception while processing post request", e); return QueryException.getException(QueryException.INTERNAL_ERROR, e).toString(); } }
LOGGER.error("Caught exception while merging two blocks (step 2).", e); mergedBlock .addToProcessingExceptions(QueryException.getException(QueryException.MERGE_RESPONSE_ERROR, e));
serverInstance, e); _brokerMetrics.addMeteredTableValue(tableNameWithType, BrokerMeter.DATA_TABLE_DESERIALIZATION_EXCEPTIONS, 1); processingExceptions.add(QueryException.getException(QueryException.DATA_TABLE_DESERIALIZATION_ERROR, e));
LOGGER.error("Caught exception while fetching responses for table: {}", tableNameWithType, e); _brokerMetrics.addMeteredTableValue(tableNameWithType, BrokerMeter.RESPONSE_FETCH_EXCEPTIONS, 1); processingExceptions.add(QueryException.getException(QueryException.BROKER_GATHER_ERROR, e)); return null;
@Override public void runJob() { IntermediateResultsBlock mergedBlock = null; try { for (Operator operator : operatorGroup) { IntermediateResultsBlock blockToMerge = (IntermediateResultsBlock) operator.nextBlock(); if (mergedBlock == null) { mergedBlock = blockToMerge; } else { try { CombineService.mergeTwoBlocks(_brokerRequest, mergedBlock, blockToMerge); } catch (Exception e) { LOGGER.error("Caught exception while merging two blocks (step 1).", e); mergedBlock .addToProcessingExceptions(QueryException.getException(QueryException.MERGE_RESPONSE_ERROR, e)); } } } } catch (Exception e) { LOGGER.error("Caught exception while executing query.", e); mergedBlock = new IntermediateResultsBlock(e); } assert mergedBlock != null; blockingQueue.offer(mergedBlock); } });
LOGGER.error("Exception processing CombineGroupBy for index {}, operator {}", index, _operators.get(index).getClass().getName(), e); mergedProcessingExceptions.add(QueryException.getException(QueryException.QUERY_EXECUTION_ERROR, e));
} catch (InterruptedException e) { LOGGER.error("Caught InterruptedException.", e); mergedBlock = new IntermediateResultsBlock(QueryException.getException(QueryException.FUTURE_CALL_ERROR, e)); } catch (ExecutionException e) { LOGGER.error("Caught ExecutionException.", e); mergedBlock = new IntermediateResultsBlock(QueryException.getException(QueryException.MERGE_RESPONSE_ERROR, e)); } catch (TimeoutException e) { LOGGER.error("Caught TimeoutException", e); mergedBlockFuture.cancel(true); mergedBlock = new IntermediateResultsBlock(QueryException.getException(QueryException.EXECUTION_TIMEOUT_ERROR, e));
} catch (Exception e) { LOGGER.info("Caught exception while compiling PQL query: {}, {}", pqlQuery, e.getMessage()); return QueryException.getException(QueryException.PQL_PARSING_ERROR, e).toString();
dataTable.addException(QueryException.getException(QueryException.INTERNAL_ERROR, e));
queryTimeoutMs); DataTable dataTable = new DataTableImplV2(); dataTable.addException(QueryException.getException(QueryException.QUERY_SCHEDULING_TIMEOUT_ERROR, errorMessage)); LOGGER.error("{} while processing requestId: {}", errorMessage, requestId); return dataTable; dataTable.addException(QueryException.getException(QueryException.QUERY_EXECUTION_ERROR, e)); } finally { for (SegmentDataManager segmentDataManager : segmentDataManagers) {
@Test public void testException() throws IOException { Exception exception = new UnsupportedOperationException("Caught exception."); ProcessingException processingException = QueryException.getException(QueryException.QUERY_EXECUTION_ERROR, exception); String expected = processingException.getMessage(); DataTable dataTable = new DataTableImplV2(); dataTable.addException(processingException); DataTable newDataTable = DataTableFactory.getDataTable(dataTable.toBytes()); Assert.assertNull(newDataTable.getDataSchema()); Assert.assertEquals(newDataTable.getNumberOfRows(), 0); String actual = newDataTable.getMetadata() .get(DataTable.EXCEPTION_METADATA_KEY + QueryException.QUERY_EXECUTION_ERROR.getErrorCode()); Assert.assertEquals(actual, expected); }
LOGGER.info(errorMessage); mergedBlock.addToProcessingExceptions( QueryException.getException(QueryException.MERGE_RESPONSE_ERROR, errorMessage));
_brokerMetrics.addMeteredGlobalValue(BrokerMeter.REQUEST_COMPILATION_EXCEPTIONS, 1); requestStatistics.setErrorCode(QueryException.PQL_PARSING_ERROR_CODE); return new BrokerResponseNative(QueryException.getException(QueryException.PQL_PARSING_ERROR, e)); requestStatistics.setErrorCode(QueryException.TOO_MANY_REQUESTS_ERROR_CODE); _brokerMetrics.addMeteredTableValue(rawTableName, BrokerMeter.QUERY_QUOTA_EXCEEDED, 1); return new BrokerResponseNative(QueryException.getException(QueryException.QUOTA_EXCEEDED_ERROR, errorMessage)); requestStatistics.setErrorCode(QueryException.QUERY_VALIDATION_ERROR_CODE); _brokerMetrics.addMeteredTableValue(rawTableName, BrokerMeter.QUERY_VALIDATION_EXCEPTIONS, 1); return new BrokerResponseNative(QueryException.getException(QueryException.QUERY_VALIDATION_ERROR, e));