kfaraz commented on code in PR #14475:
URL: https://github.com/apache/druid/pull/14475#discussion_r1241687211
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/util/IntervalUtils.java:
##########
@@ -61,4 +64,23 @@ public static List<Interval> difference(final List<Interval>
list1, final List<I
return retVal;
}
+
+ /**
+ * This method checks if the provided interval is aligned by the granularity
or is an instance of {@link Intervals#ETERNITY}
+ * ALL granularity isn't aligned to any interval, however this method is
defines that ALL granularity matches
+ * an interval with boundary ({@code DateTimes.MIN}, {@code DateTimes.MAX})
+ * This is used to check if the granularity allocation made by the overlord
is the same as the one requested in the
+ * SQL query
+ */
+ public static boolean isEternityOrDoesIntervalAlignWithGranularity(
Review Comment:
Nit: you need not mention the part about eternity as an eternity interval
does satisfy the definition of alignment with `AllGranularity`.
So this method can just be called `isAligned` or something to reflect the
underlying usage of `granularity.isAligned`.
##########
docs/multi-stage-query/reference.md:
##########
@@ -424,6 +424,7 @@ The following table describes error codes you may encounter
in the `multiStageQu
| <a name="error_ColumnNameRestricted">`ColumnNameRestricted`</a> | The query
uses a restricted column name. | `columnName`: The restricted column name. |
| <a name="error_ColumnTypeNotSupported">`ColumnTypeNotSupported`</a> | The
column type is not supported. This can be because:<br /> <br /><ul><li>Support
for writing or reading from a particular column type is not
supported.</li><li>The query attempted to use a column type that is not
supported by the frame format. This occurs with ARRAY types, which are not yet
implemented for frames.</li></ul> | `columnName`: The column name with an
unsupported type.<br /> <br />`columnType`: The unknown column type. |
| <a
name="error_InsertCannotAllocateSegment">`InsertCannotAllocateSegment`</a> |
The controller task could not allocate a new segment ID due to conflict with
existing segments or pending segments. Common reasons for such conflicts:<br />
<br /><ul><li>Attempting to mix different granularities in the same intervals
of the same datasource.</li><li>Prior ingestions that used non-extendable shard
specs.</li></ul>| `dataSource`<br /> <br />`interval`: The interval for the
attempted new segment allocation. |
+| <a
name="error_InsertCannotAllocateSegment">`InsertAllocatedIncorrectSegment`</a>
| The controller task could not allocate a new segment ID of the specified
granularity due to conflict with existing segments or pending segments. <br />
<br /> This happens when a coarser segment is already overlapping the interval
for which the allocation was requested. Either use a REPLACE to overwrite over
the existing overlapping segment or re-run INSERT with the pre-existing segment
granularity in order to append to the interval| `dataSource`<br /> <br
/>`requestedInterval`: The interval for the attempted new segment allocation.
<br /><br />`allocatedInterval` The interval allocated for the requested
segment |
Review Comment:
Nit: This fault says that the _requested_ segment could not be allocated,
but something else could be.
In that sense, it doesn't seem too different from the
`InsertCannotAllocateSegment`.
Do you think just a different error message in the same fault type would
work?
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/util/IntervalUtils.java:
##########
@@ -61,4 +64,23 @@ public static List<Interval> difference(final List<Interval>
list1, final List<I
return retVal;
}
+
+ /**
+ * This method checks if the provided interval is aligned by the granularity
or is an instance of {@link Intervals#ETERNITY}
+ * ALL granularity isn't aligned to any interval, however this method is
defines that ALL granularity matches
+ * an interval with boundary ({@code DateTimes.MIN}, {@code DateTimes.MAX})
+ * This is used to check if the granularity allocation made by the overlord
is the same as the one requested in the
+ * SQL query
+ */
+ public static boolean isEternityOrDoesIntervalAlignWithGranularity(
+ final Interval interval,
+ final Granularity granularity
+ )
+ {
+ // AllGranularity needs special handling since AllGranularity#bucketStart
always returns false
Review Comment:
I suppose we could fix `AllGranularity.isAligned()` to return true when the
interval is eternity.
--
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]