justinborromeo commented on a change in pull request #7133: 6088 - Time 
Ordering On Scans
URL: https://github.com/apache/incubator-druid/pull/7133#discussion_r266570319
 
 

 ##########
 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
 
 Review comment:
   I'm fine with that.  However, OrderByColumnSpec.Direction defaults to null 
if the provided String value is neither ascending nor descending.   Is it good 
UX to have invalid input defaulting to null/NONE?

----------------------------------------------------------------
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]

Reply via email to