hudi-agent commented on code in PR #20043:
URL: https://github.com/apache/hudi/pull/20043#discussion_r4127350643
##########
hudi-trino/src/test/java/io/trino/plugin/hudi/TestingHudiPlugin.java:
##########
@@ -14,30 +14,35 @@
package io.trino.plugin.hudi;
import com.google.common.collect.ImmutableList;
+import io.trino.spi.Plugin;
import io.trino.spi.connector.ConnectorFactory;
import java.nio.file.Path;
-import java.util.List;
+import java.util.Optional;
-import static com.google.common.base.Verify.verify;
import static java.util.Objects.requireNonNull;
public class TestingHudiPlugin
- extends HudiPlugin
+ implements Plugin
{
- private final Path localFileSystemRootPath;
+ private final Optional<Path> localFileSystemRootPath;
+
+ public TestingHudiPlugin()
+ {
+ this.localFileSystemRootPath = Optional.empty();
+ }
public TestingHudiPlugin(Path localFileSystemRootPath)
{
- this.localFileSystemRootPath = requireNonNull(localFileSystemRootPath,
"localFileSystemRootPath is null");
+ this.localFileSystemRootPath =
Optional.of(requireNonNull(localFileSystemRootPath, "localFileSystemRootPath is
null"));
}
@Override
public Iterable<ConnectorFactory> getConnectorFactories()
{
- List<ConnectorFactory> connectorFactories =
ImmutableList.copyOf(super.getConnectorFactories());
- verify(connectorFactories.size() == 1, "Unexpected connector
factories: %s", connectorFactories);
-
- return ImmutableList.of(new
TestingHudiConnectorFactory(localFileSystemRootPath));
+ if (localFileSystemRootPath.isPresent()) {
+ return ImmutableList.of(new
TestingHudiConnectorFactory(localFileSystemRootPath.get()));
+ }
Review Comment:
🤖 Deleting `TestHudiPlugin` also drops the only test that calls
`factory.create(...)` with just the minimal config (`hive.metastore.uri` +
`bootstrap.quiet`). It might be worth keeping that test and pointing it at `new
HudiConnectorFactory()` (or `new TestingHudiPlugin()`). That way a bad Guice
binding or a required config would still show up as a quick unit-test failure.
<sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag
quality.</i></sub>
--
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]