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_r263622464
##########
File path: processing/src/main/java/org/apache/druid/query/scan/ScanQuery.java
##########
@@ -36,26 +39,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:
+ return RESULT_FORMAT_LIST;
Review comment:
I think it's better to throw an exception for the default case indicating
invalid input
----------------------------------------------------------------
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]