You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ro...@apache.org on 2023/05/14 01:29:03 UTC
[pinot] branch master updated: [multistage]: better error messages. (#10763)
This is an automated email from the ASF dual-hosted git repository.
rongr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new dc3b6fd319 [multistage]: better error messages. (#10763)
dc3b6fd319 is described below
commit dc3b6fd3192b9301017e91a564241479e67727b9
Author: Abhishek Sharma <ab...@spothero.com>
AuthorDate: Sat May 13 21:28:55 2023 -0400
[multistage]: better error messages. (#10763)
* 10205: Initial changes.
* 10205: Support for Json data.
* 10205: Handling the exceptions with messages.
* 10205: As per the PR coments.
---
.../requesthandler/MultiStageBrokerRequestHandler.java | 2 +-
.../pinot/controller/api/resources/PinotQueryResource.java | 14 ++++++++++----
.../main/java/org/apache/pinot/query/type/TypeFactory.java | 3 ++-
3 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/MultiStageBrokerRequestHandler.java b/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/MultiStageBrokerRequestHandler.java
index abfa1d4d15..d4ece61fa6 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/MultiStageBrokerRequestHandler.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/MultiStageBrokerRequestHandler.java
@@ -172,7 +172,7 @@ public class MultiStageBrokerRequestHandler extends BaseBrokerRequestHandler {
LOGGER.info("Caught exception while compiling SQL request {}: {}, {}", requestId, query, e.getMessage());
_brokerMetrics.addMeteredGlobalValue(BrokerMeter.REQUEST_COMPILATION_EXCEPTIONS, 1);
requestContext.setErrorCode(QueryException.SQL_PARSING_ERROR_CODE);
- return new BrokerResponseNative(QueryException.getException(QueryException.SQL_PARSING_ERROR, e));
+ return new BrokerResponseNative(QueryException.getException(QueryException.SQL_PARSING_ERROR, e.getMessage()));
}
DispatchableSubPlan dispatchableSubPlan = queryPlanResult.getQueryPlan();
diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotQueryResource.java b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotQueryResource.java
index 8f56865873..57968fbfd8 100644
--- a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotQueryResource.java
+++ b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotQueryResource.java
@@ -52,6 +52,7 @@ import org.apache.commons.lang3.tuple.Pair;
import org.apache.helix.model.InstanceConfig;
import org.apache.pinot.common.Utils;
import org.apache.pinot.common.exception.QueryException;
+import org.apache.pinot.common.response.ProcessingException;
import org.apache.pinot.common.utils.request.RequestUtils;
import org.apache.pinot.controller.ControllerConf;
import org.apache.pinot.controller.api.access.AccessControl;
@@ -68,7 +69,6 @@ import org.apache.pinot.spi.utils.builder.TableNameBuilder;
import org.apache.pinot.sql.parsers.CalciteSqlCompiler;
import org.apache.pinot.sql.parsers.CalciteSqlParser;
import org.apache.pinot.sql.parsers.PinotSqlType;
-import org.apache.pinot.sql.parsers.SqlCompilationException;
import org.apache.pinot.sql.parsers.SqlNodeAndOptions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -108,6 +108,9 @@ public class PinotQueryResource {
}
LOGGER.debug("Trace: {}, Running query: {}", traceEnabled, sqlQuery);
return executeSqlQuery(httpHeaders, sqlQuery, traceEnabled, queryOptions, "/sql");
+ } catch (ProcessingException pe) {
+ LOGGER.error("Caught exception while processing post request {}", pe.getMessage());
+ return pe.getMessage();
} catch (Exception e) {
LOGGER.error("Caught exception while processing post request", e);
return QueryException.getException(QueryException.INTERNAL_ERROR, e).toString();
@@ -121,6 +124,9 @@ public class PinotQueryResource {
try {
LOGGER.debug("Trace: {}, Running query: {}", traceEnabled, sqlQuery);
return executeSqlQuery(httpHeaders, sqlQuery, traceEnabled, queryOptions, "/sql");
+ } catch (ProcessingException pe) {
+ LOGGER.error("Caught exception while processing get request {}", pe.getMessage());
+ return pe.getMessage();
} catch (Exception e) {
LOGGER.error("Caught exception while processing get request", e);
return QueryException.getException(QueryException.INTERNAL_ERROR, e).toString();
@@ -133,9 +139,9 @@ public class PinotQueryResource {
SqlNodeAndOptions sqlNodeAndOptions;
try {
sqlNodeAndOptions = CalciteSqlParser.compileToSqlNodeAndOptions(sqlQuery);
- } catch (SqlCompilationException ex) {
- return QueryException.getException(QueryException.SQL_PARSING_ERROR,
- new Exception("Unable to parse the SQL")).toString();
+ } catch (Exception ex) {
+ String errorMessage = String.format("Unable to parse the SQL: '%s'", sqlQuery);
+ throw QueryException.getException(QueryException.SQL_PARSING_ERROR, new Exception(errorMessage));
}
Map<String, String> options = sqlNodeAndOptions.getOptions();
if (queryOptions != null) {
diff --git a/pinot-query-planner/src/main/java/org/apache/pinot/query/type/TypeFactory.java b/pinot-query-planner/src/main/java/org/apache/pinot/query/type/TypeFactory.java
index 1877f7ec9c..21183ce7da 100644
--- a/pinot-query-planner/src/main/java/org/apache/pinot/query/type/TypeFactory.java
+++ b/pinot-query-planner/src/main/java/org/apache/pinot/query/type/TypeFactory.java
@@ -88,7 +88,8 @@ public class TypeFactory extends JavaTypeFactoryImpl {
case STRUCT:
case MAP:
default:
- throw new UnsupportedOperationException("unsupported!");
+ String message = String.format("Unsupported type: %s ", fieldSpec.getDataType().toString());
+ throw new UnsupportedOperationException(message);
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org