kevinrr888 commented on code in PR #4816: URL: https://github.com/apache/accumulo/pull/4816#discussion_r2052945882
########## core/src/main/java/org/apache/accumulo/core/client/rfile/RFileScanner.java: ########## @@ -335,6 +355,70 @@ public boolean isSamplingEnabled() { public SamplerConfiguration getSamplerConfiguration() { return RFileScanner.this.getSamplerConfiguration(); } + + /** + * This method only exists to be used as described in {@link IteratorEnvironment#getPluginEnv()} + * so the table config can be obtained. This simply returns null since a table id does not make + * sense in the context of scanning RFiles, but is needed to obtain the table configuration. + * + * @return null + */ + @Override + public TableId getTableId() { + return null; + } + + @Override + @Deprecated(since = "2.0.0") + public AccumuloConfiguration getConfig() { + return tableConf; + } + + @Override + @Deprecated(since = "2.1.0") + public ServiceEnvironment getServiceEnv() { + return serviceEnvironment.get(); + } + + @Override + public PluginEnvironment getPluginEnv() { + return serviceEnvironment.get(); + } + + private ServiceEnvironment createServiceEnv() { + return new ServiceEnvironment() { + @Override + public <T> T instantiate(TableId tableId, String className, Class<T> base) + throws ReflectiveOperationException { + return instantiate(className, base); + } + + @Override + public <T> T instantiate(String className, Class<T> base) + throws ReflectiveOperationException { + return this.getClass().getClassLoader().loadClass(className).asSubclass(base) + .getDeclaredConstructor().newInstance(); + } + + @Override + public String getTableName(TableId tableId) { + throw new UnsupportedOperationException(errorMsg); + } + + @Override + public Configuration getConfiguration(TableId tableId) { + Preconditions.checkArgument(tableId == getTableId(), Review Comment: Yes, the intention was that the only valid use of this method is: `env.getPluginEnv().getConfiguration(env.getTableId())` (as described in javadocs for `getPluginEnv()`) `env.getPluginEnv().getConfiguration(null)` would also work, and this still makes sense in the context of `RFileScanner` Just wanted to avoid accepting something like `env.getPluginEnv().getConfiguration(someRandomTableId)` -- 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: notifications-unsubscr...@accumulo.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org