jon-wei commented on a change in pull request #7133: 6088 - Time Ordering On
Scans
URL: https://github.com/apache/incubator-druid/pull/7133#discussion_r266172262
##########
File path: processing/src/main/java/org/apache/druid/query/scan/ScanQuery.java
##########
@@ -36,26 +40,88 @@
public class ScanQuery extends BaseQuery<ScanResultValue>
{
- public static final String RESULT_FORMAT_LIST = "list";
- public static final String RESULT_FORMAT_COMPACTED_LIST = "compactedList";
- public static final String RESULT_FORMAT_VALUE_VECTOR = "valueVector";
+ public enum ResultFormat
+ {
+ RESULT_FORMAT_LIST,
+ RESULT_FORMAT_COMPACTED_LIST,
+ RESULT_FORMAT_VALUE_VECTOR;
+
+ @JsonValue
+ @Override
+ public String toString()
+ {
+ switch (this) {
+ case RESULT_FORMAT_LIST:
+ return "list";
+ case RESULT_FORMAT_COMPACTED_LIST:
+ return "compactedList";
+ case RESULT_FORMAT_VALUE_VECTOR:
+ return "valueVector";
+ default:
+ return "";
+ }
+ }
+
+ @JsonCreator
+ public static ResultFormat fromString(String name)
+ {
+ switch (name) {
+ case "compactedList":
+ return RESULT_FORMAT_COMPACTED_LIST;
+ case "valueVector":
+ return RESULT_FORMAT_VALUE_VECTOR;
+ case "list":
+ return RESULT_FORMAT_LIST;
+ default:
+ throw new UOE("Scan query result format [%s] is not supported.",
name);
+ }
+ }
+ }
+
+ public enum TimeOrder
+ {
+ ASCENDING,
+ DESCENDING,
+ NONE;
+
+ @JsonValue
+ @Override
+ public String toString()
+ {
+ return StringUtils.toLowerCase(this.name());
+ }
+
+ @JsonCreator
+ public static TimeOrder fromString(String name)
+ {
+ return valueOf(StringUtils.toUpperCase(name));
+ }
+ }
+
+ /**
+ * This context flag corresponds to whether the query is running on the
"outermost" process (i.e. the process
+ * the query is sent to).
+ */
+ public static final String CTX_KEY_OUTERMOST = "scanOutermost";
private final VirtualColumns virtualColumns;
- private final String resultFormat;
+ private final ResultFormat resultFormat;
private final int batchSize;
private final long limit;
private final DimFilter dimFilter;
private final List<String> columns;
private final Boolean legacy;
+ private final TimeOrder timeOrder;
@JsonCreator
public ScanQuery(
@JsonProperty("dataSource") DataSource dataSource,
@JsonProperty("intervals") QuerySegmentSpec querySegmentSpec,
@JsonProperty("virtualColumns") VirtualColumns virtualColumns,
- @JsonProperty("resultFormat") String resultFormat,
+ @JsonProperty("resultFormat") ResultFormat resultFormat,
@JsonProperty("batchSize") int batchSize,
@JsonProperty("limit") long limit,
+ @JsonProperty("timeOrder") TimeOrder timeOrder,
Review comment:
Let's call this `order`, if we support non-time based ordering in the future
we can reuse the property name
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]