COLDMANYU opened a new pull request, #14932:
URL: https://github.com/apache/gravitino/pull/14932
### What changes were proposed in this pull request?
- `GravitinoPaimonCatalog` overrides `createGravitinoTable`. When the
catalog uses the Hive backend, the Spark properties go through the new
`PaimonPropertiesConverter#toHiveBackendTableProperties` first:
- a file format provider (`USING csv`, `json`, `orc`, `parquet`, `text`,
...) becomes `type=format-table` and `file.format=<format>`;
- `USING paimon` or no `USING` clause keeps a Paimon table;
- `location` becomes Paimon's `path`, and Spark's `external` flag is
dropped, because Paimon decides that from the path.
- Other backends keep today's behavior.
- `SparkCommonIT#testCreateDatasourceFormatPartitionTable` becomes
`protected` so the Hive backend IT can override it.
This PR is based on #14928, which adds `SparkPaimonCatalogHiveBackendIT` and
lets the connector load format tables. Only the last commit belongs to this PR.
### Why are the changes needed?
Without it, `CREATE TABLE ... USING csv` through Gravitino on the Hive
backend creates a Paimon table and ignores `LOCATION`, while the same statement
through Paimon's `SparkCatalog` creates a CSV format table at that location.
Fixes #14931
### Does this PR introduce _any_ user-facing change?
On the Hive backend, `CREATE TABLE ... USING <file format>` creates a Paimon
format table, and `LOCATION` sets its path. Before, it created a Paimon table.
Other backends are unchanged.
### How was this patch tested?
- Unit tests in `TestPaimonPropertiesConverter` for the conversion, and that
other backends keep the provider unchanged.
- In `SparkPaimonCatalogHiveBackendIT35`:
- `testCreateFormatTable`: creates a partitioned CSV table with `LOCATION`
through Gravitino, checks `type` and `file.format` through a Paimon
`SparkCatalog` on the same metastore, checks the partition directory, and reads
the data through both catalogs.
- `testCreateTableUsingPaimonIsNotAFormatTable`.
- `testCreateDatasourceFormatPartitionTable` is overridden: with the Hive
backend `USING PARQUET` creates a parquet format table, which Spark reports
without its database, so the common checks on the Spark table do not apply. The
override checks the Paimon table type and reads the data back.
- Without the change, `testCreateFormatTable` and
`testCreateDatasourceFormatPartitionTable` fail with `expected: <format-table>
but was: <null>`.
- `SparkPaimonCatalogHiveBackendIT35` 39 tests and
`SparkPaimonCatalogFilesystemBackendIT35` 36 tests pass (5 skipped each). On
the filesystem backend the common `testCreateDatasourceFormatPartitionTable`
still passes, which covers the unchanged behavior.
--
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]