apache / apache/hudi

[SUPPORT] Trino queries failing when hudi.metadata_enabled is set to true.

Open
#9,758 8 comments 0 reactions 0 assignees View on GitHub
area:metadata-table priority:high
Dominant language
Java
Stars
6.2k
Forks
2.5k
Avg merge
2d 8h
Merged PRs (30d)
111

Description

**_Tips before filing an issue_**

- Have you gone through our [FAQs](https://hudi.apache.org/learn/faq/)?

- Join the mailing list to engage in conversations and get faster support at dev-subscribe@hudi.apache.org.

- If you have triaged this as a bug, then file an [issue](https://issues.apache.org/jira/projects/HUDI/issues) directly.

**Describe the problem you faced**

We have been using hudi 0.12.0 version and observed that our GCS listing and usage metrics have went high. When we brought this up in slack community, they have suggested to update to 0.13.1, we have updated our apps to 0.13.1 version and able to query the tables using hudi catalog from Trino. But when I tried setting the below property to leverage metadata to improve the query performance, we are unable to run the queries and seeing the errors.
**hudi.metadata_enabled=true;**

**To Reproduce**

Steps to reproduce the behavior:

1. Enable metadata table in hudi 0.13.1
2. Set hudi.metadata_enabled=true in hudi catalog on Trino.
3. Now run any simple query to read data from hudi table.
4. We will see the error.

**Expected behavior**

A clear and concise description of what you expected to happen.

Trino leverage the metadata and run the queries faster.

**Environment Description**

* Hudi version : 0.13.1

* Spark version : 3.2.2

* Hive version : 2.3.5

* Hadoop version : 3.2

* Storage (HDFS/S3/GCS..) : GCS

* Trino Version : 402 (hudi-trino-bundle-0.12.1.jar placed in hudi plugin)

* Running on Docker? (yes/no) : yes

**Additional context**

Add any other context about the problem here.

**Stacktrace**

```
io.trino.spi.TrinoException: Failed to generate splits for
at io.trino.plugin.hudi.HudiSplitSource.lambda$new$1(HudiSplitSource.java:98)
at io.trino.plugin.hudi.split.HudiBackgroundSplitLoader$1.onFailure(HudiBackgroundSplitLoader.java:111)
at com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:1124)
at com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:31)
at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:1270)
at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:1038)
at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:808)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.afterRanInterruptiblyFailure(TrustedListenableFutureTask.java:141)
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:88)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:82)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/util/Bytes
at org.apache.hudi.common.bootstrap.index.HFileBootstrapIndex.(HFileBootstrapIndex.java:94)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:375)
at org.apache.hudi.common.util.ReflectionUtils.getClass(ReflectionUtils.java:54)
at org.apache.hudi.common.util.ReflectionUtils.loadClass(ReflectionUtils.java:89)
at org.apache.hudi.common.bootstrap.index.BootstrapIndex.getBootstrapIndex(BootstrapIndex.java:163)
at org.apache.hudi.common.table.view.AbstractTableFileSystemView.init(AbstractTableFileSystemView.java:109)
at org.apache.hudi.common.table.view.HoodieTableFileSystemView.init(HoodieTableFileSystemView.java:108)
at org.apache.hudi.common.table.view.HoodieTableFileSystemView.(HoodieTableFileSystemView.java:102)
at org.apache.hudi.common.table.view.HoodieTableFileSystemView.(HoodieTableFileSystemView.java:93)
at org.apache.hudi.metadata.HoodieTableMetadataUtil.getFileSystemView(HoodieTableMetadataUtil.java:1030)
at org.apache.hudi.metadata.HoodieTableMetadataUtil.getPartitionFileSlices(HoodieTableMetadataUtil.java:1048)
at org.apache.hudi.metadata.HoodieTableMetadataUtil.getPartitionLatestMergedFileSlices(HoodieTableMetadataUtil.java:996)
at org.apache.hudi.metadata.HoodieBackedTableMetadata.getPartitionFileSliceToKeysMapping(HoodieBackedTableMetadata.java:378)
at org.apache.hudi.metadata.HoodieBackedTableMetadata.getRecordsByKeys(HoodieBackedTableMetadata.java:207)
at org.apache.hudi.metadata.HoodieBackedTableMetadata.getRecordByKey(HoodieBackedTableMetadata.java:142)
at org.apache.hudi.metadata.BaseTableMetadata.fetchAllFilesInPartition(BaseTableMetadata.java:323)
at org.apache.hudi.metadata.BaseTableMetadata.getAllFilesInPartition(BaseTableMetadata.java:141)
at org.apache.hudi.metadata.HoodieMetadataFileSystemView.listPartition(HoodieMetadataFileSystemView.java:65)
at org.apache.hudi.common.table.view.AbstractTableFileSystemView.lambda$ensurePartitionLoadedCorrectly$9(AbstractTableFileSystemView.java:306)
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
at org.apache.hudi.common.table.view.AbstractTableFileSystemView.ensurePartitionLoadedCorrectly(AbstractTableFileSystemView.java:297)
at org.apache.hudi.common.table.view.AbstractTableFileSystemView.getLatestBaseFiles(AbstractTableFileSystemView.java:497)
at io.trino.plugin.hudi.query.HudiReadOptimizedDirectoryLister.listStatus(HudiReadOptimizedDirectoryLister.java:104)
at io.trino.plugin.hudi.split.HudiBackgroundSplitLoader.loadSplits(HudiBackgroundSplitLoader.java:94)
at io.trino.plugin.hudi.split.HudiBackgroundSplitLoader.lambda$start$0(HudiBackgroundSplitLoader.java:74)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:131)
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:74)
... 4 more
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hbase.util.Bytes
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
at io.trino.server.PluginClassLoader.loadClass(PluginClassLoader.java:126)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 33 more
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the Trino stack trace at HudiSplitSource.java and HudiBackgroundSplitLoader.java, then follow HFileBootstrapIndex and the missing org.apache.hadoop.hbase.util.Bytes class. Compare the Hudi 0.13.1 environment with the hudi-trino-bundle-0.12.1.jar and its dependency packaging. Done means Trino can run a simple query with hudi.metadata_enabled=true without the class-loading failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, google-cloud, hadoop, java
Domain
data-engineering
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.