You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2019/03/05 10:54:01 UTC

[GitHub] [calcite] julianhyde commented on a change in pull request #1080: [CALCITE-2887] Improve performance of RexLiteral#toJavaString

julianhyde commented on a change in pull request #1080: [CALCITE-2887] Improve performance of RexLiteral#toJavaString
URL: https://github.com/apache/calcite/pull/1080#discussion_r262445493
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/rex/RexLiteral.java
 ##########
 @@ -551,12 +552,16 @@ private static int width(TimeUnit timeUnit) {
    * Prints the value this literal as a Java string constant.
    */
   public void printAsJava(PrintWriter pw) {
-    printAsJava(value, pw, typeName, true, RexDigestIncludeType.NO_TYPE);
+    try {
+      appendAsJava(value, pw, typeName, true, RexDigestIncludeType.NO_TYPE);
+    } catch (IOException e) {
+      throw new IllegalStateException("IOException should not be raised with PrintWriter", e);
 
 Review comment:
   I like that way of thinking. We could state in the method javadoc that we don't allow an `Appendable` that might actually do I/O. (The goal is only to write to in-memory buffers.) And therefore if there is an `IOException` it is a coding error.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services