imply-cheddar commented on code in PR #15735:
URL: https://github.com/apache/druid/pull/15735#discussion_r1470688270


##########
sql/src/main/java/org/apache/druid/sql/calcite/planner/QueryHandler.java:
##########
@@ -220,6 +222,9 @@ public PlannerResult plan()
         return planForDruid();
       }
     }
+    catch (CannotBuildQueryException e) {
+      throw buildSQLPlanningError(e);
+    }

Review Comment:
   Doesn't this exception get thrown directly where we would actually believe 
that the error message that it carries is good?  Perhaps build a DruidException 
and throw that?



##########
processing/src/main/java/org/apache/druid/data/input/Rows.java:
##########
@@ -77,6 +79,8 @@ public static List<String> objectToStrings(final Object 
inputValue)
     } else if (inputValue instanceof byte[]) {
       // convert byte[] to base64 encoded string
       return Collections.singletonList(StringUtils.encodeBase64String((byte[]) 
inputValue));
+    } else if (inputValue instanceof ByteBuffer) {
+      return Collections.singletonList(StringUtils.fromUtf8(((ByteBuffer) 
inputValue).array()));

Review Comment:
   For these types of "serde" methods, I consider `byte[]` and `ByteBuffer` to 
be fundamentally equivalent.  But the code here is treating them as 
semantically different things (`byte[]` becomes base64, while `ByteBuffer` 
becomes utf8).  Can we make them consistently the same?



##########
processing/src/test/java/org/apache/druid/query/rowsandcols/semantic/SemanticCreatorUsageTest.java:
##########
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.query.rowsandcols.semantic;
+
+import org.apache.druid.java.util.common.StringUtils;
+import org.apache.druid.query.rowsandcols.SemanticCreator;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import org.reflections.Reflections;
+import org.reflections.scanners.MethodAnnotationsScanner;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Set;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+@RunWith(Parameterized.class)
+public class SemanticCreatorUsageTest

Review Comment:
   Please add some class level javadoc that helps explain what it means when a 
test from here fails.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to