kfaraz commented on code in PR #15168:
URL: https://github.com/apache/druid/pull/15168#discussion_r1361098037
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/util/MultiStageQueryContext.java:
##########
@@ -350,4 +359,53 @@ static IndexSpec decodeIndexSpec(@Nullable final Object
indexSpecObject, final O
throw QueryContexts.badValueException(CTX_INDEX_SPEC, "an indexSpec",
indexSpecObject);
}
}
+
+ /**
+ * This method is used to validate and get the taskLockType from the
queryContext.
+ * If the queryContext does not contain the taskLockType, then {@link
TaskLockType#EXCLUSIVE} is used for replace queries and
+ * {@link TaskLockType#SHARED} is used for insert queries.
+ * If the queryContext contains the taskLockType, then it is validated and
returned.
+ */
+ public static TaskLockType validateAndGetTaskLockType(QueryContext
queryContext, boolean isReplaceQuery)
+ {
+ final TaskLockType taskLockType = QueryContexts.getAsEnum(
+ Tasks.TASK_LOCK_TYPE,
+ queryContext.getString(Tasks.TASK_LOCK_TYPE, null),
+ TaskLockType.class
+ );
+ if (taskLockType == null) {
+ if (isReplaceQuery) {
+ return TaskLockType.EXCLUSIVE;
+ } else {
+ return TaskLockType.APPEND;
Review Comment:
Typo: I think this should be `SHARED` (as indicated in the javadoc of this
method too)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]