apache / apache/gravitino

[Improvement] register only the required catalogs, not all of them for spark-connector

Open
#2,460 3 comments 0 reactions 0 assignees View on GitHub
improvement
Dominant language
Java
Stars
3.2k
Forks
935
Avg merge
1d 15h
Merged PRs (30d)
315

Description

### What would you like to be improved?

All catalogs are registered during the initialization even if a spark sql does not use them.

The action may result in:
1. The list operation slows down if there are many catalogs.
2. Registering too many catalogs to memory increases memory pressure

```
com.datastrato.gravitino.spark.connector.plugin.GravitinoDriverPlugin#init

public Map init(SparkContext sc, PluginContext pluginContext) {
...
Set catalogs = catalogManager.listCatalogs();
registerGravitinoCatalogs(conf, catalogs);
registerSqlExtensions();
return Collections.emptyMap();
}
```

### How should we improve?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start at com.datastrato.gravitino.spark.connector.plugin.GravitinoDriverPlugin#init and inspect how catalogManager.listCatalogs() feeds registerGravitinoCatalogs. Determine how the connector can identify catalogs required by Spark SQL, then verify that initialization registers only those catalogs and avoids the listed performance and memory costs.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spark
Domain
backend, data-engineering
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.