This is an automated email from the ASF dual-hosted git repository.
sunithabeeram pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 83cc88d Expose a method to determine if a QueryExceptionErrorCode
represents a client-side error (#4532)
83cc88d is described below
commit 83cc88d76298edafbd0ca72a7d2fbde8e13dabf0
Author: Sunitha Beeram <[email protected]>
AuthorDate: Mon Aug 19 21:21:25 2019 -0700
Expose a method to determine if a QueryExceptionErrorCode represents a
client-side error (#4532)
* Expose a method to determine if a QueryExceptionErrorCode represents a
client-side error
* Address review comments
---
.../apache/pinot/broker/api/RequestStatistics.java | 9 +++++++-
.../pinot/common/exception/QueryException.java | 24 ++++++++++++++++++++++
2 files changed, 32 insertions(+), 1 deletion(-)
diff --git
a/pinot-broker/src/main/java/org/apache/pinot/broker/api/RequestStatistics.java
b/pinot-broker/src/main/java/org/apache/pinot/broker/api/RequestStatistics.java
index 5607cb0..cb82312 100644
---
a/pinot-broker/src/main/java/org/apache/pinot/broker/api/RequestStatistics.java
+++
b/pinot-broker/src/main/java/org/apache/pinot/broker/api/RequestStatistics.java
@@ -28,9 +28,12 @@ import org.apache.pinot.common.response.BrokerResponse;
* post-processing at a finer level than metrics.
*/
public class RequestStatistics {
+
+ private static final String DEFAULT_TABLE_NAME = "NotYetParsed";
+
private int _errorCode = 0;
private String _pql;
- private String _tableName = "NotYetParsed";
+ private String _tableName = DEFAULT_TABLE_NAME;
private long _processingTimeMillis = -1;
private long _totalDocs;
@@ -189,4 +192,8 @@ public class RequestStatistics {
public int getNumExceptions() {
return _numExceptions;
}
+
+ public boolean hasValidTableName() {
+ return ! DEFAULT_TABLE_NAME.equals(_tableName);
+ }
}
diff --git
a/pinot-common/src/main/java/org/apache/pinot/common/exception/QueryException.java
b/pinot-common/src/main/java/org/apache/pinot/common/exception/QueryException.java
index 6c45897..6f83c8d 100644
---
a/pinot-common/src/main/java/org/apache/pinot/common/exception/QueryException.java
+++
b/pinot-common/src/main/java/org/apache/pinot/common/exception/QueryException.java
@@ -61,6 +61,7 @@ public class QueryException {
public static final int COMBINE_GROUP_BY_EXCEPTION_ERROR_CODE = 600;
public static final int QUERY_VALIDATION_ERROR_CODE = 700;
public static final int UNKNOWN_ERROR_CODE = 1000;
+ // NOTE: update isClientError() method appropriately when new codes are added
public static final ProcessingException JSON_PARSING_ERROR = new
ProcessingException(JSON_PARSING_ERROR_CODE);
public static final ProcessingException JSON_COMPILATION_ERROR = new
ProcessingException(JSON_COMPILATION_ERROR_CODE);
@@ -147,4 +148,27 @@ public class QueryException {
copiedProcessingException.setMessage(errorType + ":\n" + errorMessage);
return copiedProcessingException;
}
+
+ /**
+ * Determines if a query-exception-error-code represents an error on the
client side.
+ * @param errorCode the error code from processing the query
+ * @return whether the code indicates client error or not
+ */
+ public static boolean isClientError(int errorCode) {
+ switch (errorCode) {
+ // NOTE: QueryException.BROKER_RESOURCE_MISSING_ERROR can be triggered
either due to
+ // client error (incorrect table name) or due to issues with EV updates.
For cases where
+ // access to tables is controlled via ACLs, for an incorrect table name
we expect ACCESS_DENIED_ERROR to be
+ // thrown. Hence, we currently don't treat BROKER_RESOURCE_MISSING_ERROR
as client error.
+ case QueryException.ACCESS_DENIED_ERROR_CODE:
+ case QueryException.JSON_COMPILATION_ERROR_CODE:
+ case QueryException.JSON_PARSING_ERROR_CODE:
+ case QueryException.QUERY_VALIDATION_ERROR_CODE:
+ case QueryException.PQL_PARSING_ERROR_CODE:
+ case QueryException.TOO_MANY_REQUESTS_ERROR_CODE:
+ return true;
+ default:
+ return false;
+ }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]