jcamachor commented on a change in pull request #2570:
URL: https://github.com/apache/calcite/pull/2570#discussion_r726698285



##########
File path: 
core/src/main/java/org/apache/calcite/plan/volcano/VolcanoRelMetadataProvider.java
##########
@@ -123,4 +124,9 @@
       MetadataDef<M> def) {

Review comment:
       This method needs a deprecation annotation.

##########
File path: 
core/src/main/java/org/apache/calcite/rel/metadata/janino/CodeGeneratorUtil.java
##########
@@ -23,22 +23,24 @@
 /**
  * Common functions for code generation.
  */
-public class CodeGeneratorUtil {
+class CodeGeneratorUtil {
 
   private CodeGeneratorUtil() {
   }
 
   /** Returns e.g. ",\n boolean ignoreNulls". */
-  static StringBuilder paramList(StringBuilder buff, Method method) {
-    for (Ord<Class<?>> t : Ord.zip(method.getParameterTypes())) {
+  static StringBuilder paramList(StringBuilder buff, Method method, int 
startIndex) {

Review comment:
       Is the `startIndex` value always hardcoded to `2`?
   
   Can we add a comment explaining how the method works (e.g., pointing out 
that it skips `startIndex` parameters for the input `method`)?

##########
File path: 
core/src/main/java/org/apache/calcite/rel/metadata/RelMetadataProvider.java
##########
@@ -70,6 +71,9 @@
   <@Nullable M extends @Nullable Metadata> @Nullable UnboundMetadata<M> apply(
       Class<? extends RelNode> relClass, Class<? extends M> metadataClass);
 
+  @Deprecated // to be removed before 2.0
   <M extends Metadata> Multimap<Method, MetadataHandler<M>> handlers(
       MetadataDef<M> def);
+
+  ImmutableSet<MetadataHandler<?>> handlers(Class<? extends 
MetadataHandler<?>> handlerClass);

Review comment:
       It would be better if this was a `Set` rather than `ImmutableSet`.

##########
File path: 
core/src/main/java/org/apache/calcite/rel/metadata/ReflectiveRelMetadataProvider.java
##########
@@ -107,20 +114,30 @@ protected ReflectiveRelMetadataProvider(
    * that extend {@link org.apache.calcite.rel.core.Union}
    * or {@link org.apache.calcite.rel.core.Filter}.</p>
    */
+  @Deprecated // to be removed before 2.0
   public static RelMetadataProvider reflectiveSource(Method method,
       MetadataHandler target) {
-    return reflectiveSource(target, ImmutableList.of(method));
+    return reflectiveSource(target, ImmutableList.of(method), 
target.getDef().handlerClass);
   }
 
   /** Returns a reflective metadata provider that implements several
    * methods. */
+  @Deprecated // to be removed before 2.0
   public static RelMetadataProvider reflectiveSource(MetadataHandler target,
       Method... methods) {
-    return reflectiveSource(target, ImmutableList.copyOf(methods));
+    return reflectiveSource(target, ImmutableList.copyOf(methods), 
target.getDef().handlerClass);
+  }
+
+  @SuppressWarnings("deprecation")
+  public static <M extends Metadata> RelMetadataProvider reflectiveSource(
+      MetadataHandler<? extends M> handler, Class<? extends 
MetadataHandler<M>> handlerClass) {
+    //When deprecated code is removed, handler.getDef().methods will no longer 
be required
+    return reflectiveSource(handler, handler.getDef().methods, handlerClass);

Review comment:
       Why do we still need to rely on `handler.getDef().methods`?

##########
File path: 
core/src/main/java/org/apache/calcite/rel/metadata/janino/DescriptiveCacheKey.java
##########
@@ -0,0 +1,34 @@
+/*
+ * 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.calcite.rel.metadata.janino;
+
+/**
+ * An key used in caching with descriptive to string.  Note the key uses

Review comment:
       typo. `An` -> `A`

##########
File path: 
core/src/main/java/org/apache/calcite/rel/metadata/JaninoRelMetadataProvider.java
##########
@@ -66,12 +67,13 @@
    * For the cache to be effective, providers should implement identity
    * correctly. */
   @SuppressWarnings("unchecked")

Review comment:
       Is this `SuppressWarnings` annotation still needed? 




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


Reply via email to