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



##########
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:
       Changed it to a List since ordering matters.

##########
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:
       It is being used to support the deprecated functionality.  The method 
can be simplified to `return new ReflectiveRelMetadataProvider(handler, 
handlerClass);`, once the deprecated code is removed.




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