gortiz commented on code in PR #14690:
URL: https://github.com/apache/pinot/pull/14690#discussion_r1899422240


##########
pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/ExplainIntegrationTestTrait.java:
##########
@@ -0,0 +1,75 @@
+/**
+ * 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.pinot.integration.tests;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import org.intellij.lang.annotations.Language;
+import org.testng.Assert;
+
+
+public interface ExplainIntegrationTestTrait {
+
+  JsonNode postQuery(@Language("sql") String query)
+      throws Exception;
+
+  default void explainLogical(@Language("sql") String query, String expected) {

Review Comment:
   [Trait](https://en.wikipedia.org/wiki/Trait_(computer_programming)) is a 
feature not natively supported in Java but pretty common in Scala and other 
modern languages. The idea is to be able to share logic between classes. In 
this specific case, we also want to use that reused logic as they were just 
functions in the class (in order to make it easier to read). In Scala or Kotlin 
you can do that with extension methods and objects. In Java the only way I know 
is to implement them in interfaces.
   
   Why not add these classes as part of `ClusterTest` or their family? I guess 
we can, but these classes are already pretty large and they have too many 
responsibilities. In the same way we delegate on Asserts to execute assertions 
or we could delegate on Hamcrest, I think it is useful to move our own custom 
asserts away from `ClusterTest` or any other test (at least once they need to 
be reused). But we can move them to `ClusterTest` if we think it is better



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