danny0405 commented on a change in pull request #1408: [CALCITE-3288] linq4j: 
support Set literals
URL: https://github.com/apache/calcite/pull/1408#discussion_r317426301
 
 

 ##########
 File path: 
linq4j/src/main/java/org/apache/calcite/linq4j/tree/ConstantExpression.java
 ##########
 @@ -245,6 +249,31 @@ private static ExpressionWriter map(ExpressionWriter 
writer, Map map,
     return writer.append(end);
   }
 
+  private static ExpressionWriter writeSet(ExpressionWriter writer, Set set) {
+    writer.append("com.google.common.collect.ImmutableSet.");
+    if (set.isEmpty()) {
+      return writer.append("of()");
+    }
+    if (set.size() < 5) {
+      return set(writer, set, "of(", ",", ")");
+    }
+    return set(writer, set, "builder().add(", ")\n.add(", ").build()");
+  }
+
+  private static ExpressionWriter set(ExpressionWriter writer, Set set,
+                                      String begin, String entrySep, String 
end) {
 
 Review comment:
   Fix the indent.

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

Reply via email to