Skip to content

Add CLI support for MANAGED tables with CLI tests - #1136

Merged
tdas merged 3 commits into
unitycatalog:mainfrom
yili-db:staging_table_cli_test
Nov 12, 2025
Merged

tdas merged 3 commits into
unitycatalog:mainfrom
yili-db:staging_table_cli_test

Conversation

@yili-db

@yili-db yili-db commented Oct 27, 2025 •

Copy link
Copy Markdown
Collaborator

🥞 Stacked PR

Use this link to review incremental changes.


PR Checklist

  • A description of the changes is added to the description of this PR.

  • If there is a related issue, make sure it is linked to this PR.

  • If you've fixed a bug or added code that should be tested, add tests!

  • If you've added or modified a feature, documentation in docs is updated

    Add CLI support for MANAGED tables and comprehensive tests

    • Enhance TableCli with MANAGED table creation
    • Update DeltaKernelUtils with staging table support and writer capabilities
    • Add comprehensive test coverage for managed and staging tables

Related issue is: #1143

@yili-db
yili-db force-pushed the staging_table_cli_test branch 9 times, most recently from 39ee382 to 24f7d76 Compare October 29, 2025 23:46
@yili-db
yili-db marked this pull request as draft October 31, 2025 20:07
@yili-db
yili-db force-pushed the staging_table_cli_test branch 2 times, most recently from 5f24c7b to 35d9bfe Compare November 5, 2025 07:09
@yili-db
yili-db marked this pull request as ready for review November 5, 2025 07:22
@yili-db yili-db changed the title [Managed table 4] Add CLI support for MANAGED tables and comprehensive tests Add CLI support for MANAGED tables and comprehensive tests Nov 5, 2025
@yili-db yili-db changed the title Add CLI support for MANAGED tables and comprehensive tests Add CLI support for MANAGED tables with CLI tests Nov 5, 2025
@yili-db
yili-db force-pushed the staging_table_cli_test branch 9 times, most recently from 1ab15fc to de632df Compare November 6, 2025 00:04
@@ -0,0 +1,13 @@
package io.unitycatalog.cli.utils;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we need to abstract a common module, and put all the shared classes & utility there, then we don't need to copy everything from server to client. Also the unitycatalog-spark-connector can use the common module.

Please file a separate issue to consider this thing, thanks.

* "ftp://example.com/file" -> Throws BaseException with message: "Unsupported URI scheme: ftp"
* </pre>
*/
public static String toStandardizedURIString(String inputPath) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the same as FileOperation from the server module ? I really don't want to copy everything that we need to use in client side from the server side..... which is not fixing the tech debt, instead it's producing more tech debt.

/**
* Converts a given input path or URI into a standardized URI string. This method ensures that
* local file paths are correctly formatted as file URIs and that URIs for different storage
* providers (e.g., S3, Azure, GCS) are handled appropriately.
*
* <p>If the input is a valid URI with a recognized scheme (e.g., "file", "s3", "abfs", etc.), the
* method returns a standardized version of the URI. If the input is not a valid URI, it treats
* the input as a local file path and converts it to a "file://" URI.
*
* @param inputPath the input path or URI to be standardized.
* @return the standardized URI string.
* @throws BaseException if the input path has an unsupported URI scheme.
* <p>Examples of input and output:
* <pre>
* // Local File System Example:
* "file:/tmp/myfile" -> "file:///tmp/myfile"
*
* // AWS S3 Example:
* "s3://my-bucket/my-file" -> "s3://my-bucket/my-file"
*
* // Azure Blob Storage Example:
* "abfs://[email protected]/my-file"
* -> "abfs://[email protected]/my-file"
*
* // Google Cloud Storage Example:
* "gs://my-bucket/my-file" -> "gs://my-bucket/my-file"
*
* // Invalid Path Example (treated as a file path):
* "/local/path/to/file" -> "file:///local/path/to/file"
*
* // Unsupported Scheme Example:
* "ftp://example.com/file" -> Throws BaseException with message: "Unsupported URI scheme: ftp"
* </pre>
*/
public static String toStandardizedURIString(String inputPath) {
// Check if the path is already a URI with a valid scheme
URI uri;
try {
uri = new URI(inputPath);
} catch (URISyntaxException e) {
throw new BaseException(ErrorCode.INVALID_ARGUMENT, "Unsupported path: " + inputPath);
}
// If it's a file URI, standardize it
if (uri.getScheme() != null) {
if (uri.getScheme().equals(Constants.URI_SCHEME_FILE)) {
return adjustLocalFileURI(uri).toString();
} else if (Constants.SUPPORTED_CLOUD_SCHEMES.contains(uri.getScheme())) {
return uri.toString();
} else {
throw new BaseException(
ErrorCode.INVALID_ARGUMENT, "Unsupported URI scheme: " + uri.getScheme());
}
}
String localUri = Paths.get(inputPath).toUri().toString();
if (!inputPath.endsWith("/") && localUri.endsWith("/")) {
// A special case where the local inputPath is a directory already exist, generated localUri
// will have an extra trailing slash. Remove it to make it consistent.
localUri = localUri.substring(0, localUri.length() - 1);
}
return localUri;
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For both FileOperation.java and Constants.java, @tdas mentioned that we want the CLI to be a separate implementation that is only depending on the api models. It's not part of the server so it shouldn't depend on the server.
@tdas thinks it's OK to copy some code here in order to keep the CLI a separate package.
I am not sure how much value it brings to introduce and maintain a common package of these two files.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. CLI is an model "UC + Delta connector" implementation. Others will look at this implementaiton and implement their own connector. We shouldnt be showing that they need to depend on server and use server's internal classes for this.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thought is: it's better for us to abstract a common module, which all the client, server and connector can reuse the same common module. the common module should meet the following requirements:

  1. Abstracted enough, if not applicable, then may better to keep in the individual module.
  2. Clean dependencies, no conflicts with other. Since all the client, server, connector will depend on this common, we don't expect the common will mess the runtime dependencies.

The utilties that I can think that can be made to common are:

  1. The ApiClient construction. I had a comment before: Add an access control test to verify that user can't claim staging table created by other users. #1138 (comment)
  2. General cred props settings for all the 3 cloud vendor. I will assume that lots of places will use it. ---> for example if we want to support streaming write without catalog-based path, then we need to inject those cred props.
  3. Other utilies, such as env var parser, properties parsers, config keys parsers etc.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that we can further discuss this but it shouldn't be a blocker for this PR?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 on having a separate conversation and not blocking this PR. We should think about

  • is it only for our code deduplication, or is it for other connector developers to use. depending on that we should release the common module... or not. various different solutions are possible.
  • if we do release the common module, we need to think about API stability guarantees, whether we want to take that. Today we are providing API stability guarantees for the clients (java, python) and very loosely for the server (so that others can start the server in embedded in the jvm. do we want to expand that guarantee to this new module?

Comment on lines +114 to +118
// temporaryCredentials =
// temporaryCredentialsApi.generateTemporaryPathCredentials(
// new GenerateTemporaryPathCredential()
// .url(storageLocation)
// .operation(PathOperation.PATH_CREATE_TABLE));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why just remove this commented code ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commented code here is to show the reader how it is supposed to work. Eventually it will be uncommented when it's actually working.

.operation(TableOperation.READ_WRITE));
} else {
return Paths.get(path);
throw new CliException("Unknown table type");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Could you please also add the tableType inside the error message ?

Comment on lines +96 to 104
AwsCredentials awsTempCredentials = temporaryCredentials.getAwsTempCredentials();
if (awsTempCredentials == null) {
throw new IllegalArgumentException("AWS temporary credentials are missing");
}
conf.set("fs.s3a.access.key", awsTempCredentials.getAccessKeyId());
conf.set("fs.s3a.secret.key", awsTempCredentials.getSecretAccessKey());
conf.set("fs.s3a.session.token", awsTempCredentials.getSessionToken());
conf.set("fs.s3a.impl", "org.apache.hadoop.fs.s3a.S3AFileSystem");
conf.set("fs.s3a.path.style.access", "true");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please also file a separate issue, so that we can reuse the credential properties setting with the

I think the credentials properties setting should be same.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocking issue for this PR, but a nice to have issue.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is similar to #1136 (comment)
@tdas how do you think about this?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the links, added my comment there: #1136 (comment)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also one more general question is: Is it possible for us to provide an abstraction so that we don't need to use the if schema == s3 else if schema == gcp else everywhere, for supporting all the 3 cloud vendors. It make us some kind of hard to maintane and iterate new features.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@openinx ideally yes. This also depend on the discussion of a common package to decide where it should live. For now I don't think it should block this PR though.

.catalogName(createTableRequest.getCatalogName())
.schemaName(createTableRequest.getSchemaName())
.name(createTableRequest.getName());
StagingTableInfo stagingTableInfo = tablesApi.createStagingTable(createStagingTableRequest);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So for every normal table creation process, it requires us to create the staging table firstly ? Could you please explain more about ? Or is there any reference that I can read ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yili-db
yili-db force-pushed the staging_table_cli_test branch from d6e2b13 to 12432ea Compare November 7, 2025 00:34
FileOperations.toStandardizedURIString(
json.getString(CliParams.STORAGE_LOCATION.getServerParam()));
createTable.setStorageLocation(storageLocation);
// Currently generateTemporaryPathCredentials doesn't quite work yet. So this step has to

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does it not work. can you write down the reason?

} catch (Exception e) {
if (e instanceof TableAlreadyExistsException
|| e.getCause() instanceof TableAlreadyExistsException) {
// TODO confirm the schema of the existing table matches the schema of the new table

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to do this? are we building create semantics or create or replace semantics?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This behavior is unchanged by this PR.
A common pattern is that many tests would test the failure cases of table creation. But they often leave the delta table on disk after failing to register a table in UC. Then they retry the table creation on the same location. This would allow those tests to continue.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it. but that makes sense of external tables where it is valid to create an external table in the catalog by pointing it to an existing file system table. however, thats not the case of managed tables. for managed tables, every attempt to create a managed table will be in a new path provided by the catalog. so it should never happen that the

does that mean some logic here should change? i think we should allow this exception to be swallowed only when its an external table. if table-already-exists exception is ever hit for a managed table ... thats a cause for alarm.


private void createTableAndAssertReadTableSucceeds(String tablePath, List<ColumnInfo> columns)
@Test
public void testCreateManagedTable() throws IOException, ApiException {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should you also test that for managed, non-delta format fails?

think about code coverage a bit

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there Server tests that verify non-delta format does not work?

@yili-db yili-db Nov 7, 2025 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yili-db
yili-db force-pushed the staging_table_cli_test branch from 12432ea to bca129d Compare November 7, 2025 17:58

@tdas tdas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. just a few more comments.

Can you confirm that the cli actually manually works from the command line? like you can create managed table when server is started with experimental managed table enabled? test the behavior and the output of the CLI is as expected for the scenarios that you have unit tests for (valid and invalid cases) and see if the output is user friendly

@yili-db

yili-db commented Nov 7, 2025 •

Copy link
Copy Markdown
Collaborator Author

LGTM. just a few more comments.

Can you confirm that the cli actually manually works from the command line? like you can create managed table when server is started with experimental managed table enabled? test the behavior and the output of the CLI is as expected for the scenarios that you have unit tests for (valid and invalid cases) and see if the output is user friendly

@tdas
Yes it's expected:

~/unitycatalog$ bin/uc table create --full_name unity.default.my_managed_table --columns "id INT, name STRING" --format DELTA --table_type MANAGED
┌────────────────────┬──────────────────────────────────────────────────────────────────────────────────────────┐
│        KEY         │                                          VALUE                                           │
├────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────┤
│NAME                │my_managed_table                                                                          │
├────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────┤
│CATALOG_NAME        │unity                                                                                     │
├────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────┤
│SCHEMA_NAME         │default                                                                                   │
├────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────┤
│TABLE_TYPE          │MANAGED                                                                                   │
├────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────┤
│DATA_SOURCE_FORMAT  │DELTA                                                                                     │
├────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────┤
│COLUMNS             │{"name":"id","type_text":"int","type_json":"{\"name\":\"id\",\"type\":\"integer\",\"nullab│
│                    │le\":true,\"metadata\":{}}","type_name":"INT","type_precision":0,"type_scale":0,"type_inte│
│                    │rval_type":null,"position":0,"comment":null,"nullable":true,"partition_index":null}       │
│                    │{"name":"name","type_text":"string","type_json":"{\"name\":\"name\",\"type\":\"string\",\"│
│                    │nullable\":true,\"metadata\":{}}","type_name":"STRING","type_precision":0,"type_scale":0,"│
│                    │type_interval_type":null,"position":1,"comment":null,"nullable":true,"partition_index":nul│
│                    │l}                                                                                        │
├────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────┤
│STORAGE_LOCATION    │file:///tmp/ucroot/tables/7a030426-315a-4f3b-9eec-b51fbc73d042                            │
├────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────┤
│COMMENT             │null                                                                                      │
├────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────┤
│PROPERTIES          │{}                                                                                        │
├────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────┤
│OWNER               │null                                                                                      │
├────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────┤
│CREATED_AT          │1762543881947                                                                             │
├────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────┤
│CREATED_BY          │null                                                                                      │
├────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────┤
│UPDATED_AT          │1762543881947                                                                             │
├────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────┤
│UPDATED_BY          │null                                                                                      │
├────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────┤
│TABLE_ID            │7a030426-315a-4f3b-9eec-b51fbc73d042                                                      │
└────────────────────┴──────────────────────────────────────────────────────────────────────────────────────────┘

~/unitycatalog$  la /tmp/ucroot/tables/7a030426-315a-4f3b-9eec-b51fbc73d042/
total 0
drwxr-xr-x 4 yi.li wheel 128 Nov  7 11:31 _delta_log
drwxr-xr-x 3 yi.li wheel  96 Nov  7 11:31 .
drwxr-xr-x 3 yi.li wheel  96 Nov  7 11:31 ..
~/unitycatalog$  la /tmp/ucroot/tables/7a030426-315a-4f3b-9eec-b51fbc73d042/_delta_log/
total 8
drwxr-xr-x 4 yi.li wheel 128 Nov  7 11:31 .
drwxr-xr-x 3 yi.li wheel  96 Nov  7 11:31 ..
-rw-r--r-- 1 yi.li wheel  16 Nov  7 11:31 .00000000000000000000.json.crc
-rw-r--r-- 1 yi.li wheel 677 Nov  7 11:31 00000000000000000000.json

And if I try to create PARQUET table:

~/unitycatalog$ bin/uc table create --full_name unity.default.my_managed_table --columns "id INT, name STRING" --format PARQUET --table_type MANAGED
Error occurred while executing the command. Only delta tables are supported for managed tables: PARQUET

And if it's not enabled in server properties:

~/unitycatalog$ bin/uc table create --full_name unity.default.my_managed_table --columns "id INT, name STRING" --format DELTA --table_type MANAGED
Exception in thread "main" java.lang.RuntimeException: io.unitycatalog.client.ApiException: createStagingTable call failed with: 400 - {"error_code":"INVALID_ARGUMENT","details":[{"reason":"INVALID_ARGUMENT","metadata":{},"@type":"google.rpc.ErrorInfo"}],"stack_trace":null,"message":"MANAGED table is an experimental feature and is currently disabled. To enable it, set 'server.managed-table.enabled=true' in server.properties"}
	at io.unitycatalog.cli.UnityCatalogCli.main(UnityCatalogCli.java:176)
Caused by: io.unitycatalog.client.ApiException: createStagingTable call failed with: 400 - {"error_code":"INVALID_ARGUMENT","details":[{"reason":"INVALID_ARGUMENT","metadata":{},"@type":"google.rpc.ErrorInfo"}],"stack_trace":null,"message":"MANAGED table is an experimental feature and is currently disabled. To enable it, set 'server.managed-table.enabled=true' in server.properties"}
	at io.unitycatalog.client.api.TablesApi.getApiException(TablesApi.java:78)
	at io.unitycatalog.client.api.TablesApi.createStagingTableWithHttpInfo(TablesApi.java:118)
	at io.unitycatalog.client.api.TablesApi.createStagingTable(TablesApi.java:96)
	at io.unitycatalog.cli.TableCli.createTable(TableCli.java:133)
	at io.unitycatalog.cli.TableCli.handle(TableCli.java:49)
	at io.unitycatalog.cli.UnityCatalogCli.main(UnityCatalogCli.java:141)

@yili-db
yili-db requested a review from tdas November 7, 2025 19:36
@yili-db
yili-db force-pushed the staging_table_cli_test branch from 7bca4ca to 07bfa32 Compare November 7, 2025 19:46
@yili-db
yili-db requested a review from openinx November 7, 2025 19:57
- Enhance TableCli with MANAGED table creation
- Update DeltaKernelUtils with staging table support and writer capabilities
- Add comprehensive test coverage for managed and staging tables

This commit completes the staging table feature by adding CLI support and comprehensive test coverage for both server and CLI components.

Signed-off-by: Yi Li <[email protected]>
Signed-off-by: Yi Li <[email protected]>
@yili-db
yili-db force-pushed the staging_table_cli_test branch from 07bfa32 to e2c6f57 Compare November 10, 2025 09:08
URI tablePathUri = URI.create(tablePath);
Engine engine = getEngine(tablePathUri, awsTempCredentials);
Engine engine = getEngine(tablePathUri, temporaryCredentials);
Table table = Table.forPath(engine, substituteSchemeForS3(tablePath));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So basically, this is creating a path-based delta table right ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we currenlty don't support the managed table creation.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know the managed vs path-based delta table in the Delta Kernel's context.
This code seems to do the work of constructing a Delta table.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we need to have updated Delta Kernel that can actually construct a Delta table where catalogManaged table feature is enabled.

TransactionCommitResult commitResult = txn.commit(engine, CloseableIterable.emptyIterable());
if (commitResult.getVersion() >= 0) {
System.out.println("Table created successfully at: " + tablePath);
LOGGER.info("Table created successfully at: {}", tablePathUri);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the change, I think we need to disable the System.out.println(), and enforce it in the checkstyle.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this #1142

throw new IllegalArgumentException("Failed to create delta table", e);
String errorMsg =
String.format("Failed to create Delta table at '%s': %s", tablePath, e.getMessage());
LOGGER.error(errorMsg, e);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we will finally throw the exception as root cause to the upper layer, do we still need to log this redudant stacktrace via logger ? I will assume it's not neccessary.

* "ftp://example.com/file" -> Throws BaseException with message: "Unsupported URI scheme: ftp"
* </pre>
*/
public static String toStandardizedURIString(String inputPath) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thought is: it's better for us to abstract a common module, which all the client, server and connector can reuse the same common module. the common module should meet the following requirements:

  1. Abstracted enough, if not applicable, then may better to keep in the individual module.
  2. Clean dependencies, no conflicts with other. Since all the client, server, connector will depend on this common, we don't expect the common will mess the runtime dependencies.

The utilties that I can think that can be made to common are:

  1. The ApiClient construction. I had a comment before: Add an access control test to verify that user can't claim staging table created by other users. #1138 (comment)
  2. General cred props settings for all the 3 cloud vendor. I will assume that lots of places will use it. ---> for example if we want to support streaming write without catalog-based path, then we need to inject those cred props.
  3. Other utilies, such as env var parser, properties parsers, config keys parsers etc.

@yili-db
yili-db force-pushed the staging_table_cli_test branch from e2c6f57 to e75b357 Compare November 10, 2025 19:49
@yili-db
yili-db requested a review from openinx November 10, 2025 19:50
@yili-db
yili-db force-pushed the staging_table_cli_test branch from e75b357 to 04b52f1 Compare November 10, 2025 20:19
Comment on lines +96 to 104
AwsCredentials awsTempCredentials = temporaryCredentials.getAwsTempCredentials();
if (awsTempCredentials == null) {
throw new IllegalArgumentException("AWS temporary credentials are missing");
}
conf.set("fs.s3a.access.key", awsTempCredentials.getAccessKeyId());
conf.set("fs.s3a.secret.key", awsTempCredentials.getSecretAccessKey());
conf.set("fs.s3a.session.token", awsTempCredentials.getSessionToken());
conf.set("fs.s3a.impl", "org.apache.hadoop.fs.s3a.S3AFileSystem");
conf.set("fs.s3a.path.style.access", "true");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the links, added my comment there: #1136 (comment)

conf.set("fs.file.impl", "org.apache.hadoop.fs.LocalFileSystem");
} else {
throw new IllegalArgumentException("Unsupported URI scheme: " + tablePathUri.getScheme());
throw new IllegalArgumentException("Unsupported URI scheme: " + scheme);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will we also need to consider the gcp and azure abfs ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If so please file separate task to address them, thanks.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filed #1182

Comment on lines +96 to 104
AwsCredentials awsTempCredentials = temporaryCredentials.getAwsTempCredentials();
if (awsTempCredentials == null) {
throw new IllegalArgumentException("AWS temporary credentials are missing");
}
conf.set("fs.s3a.access.key", awsTempCredentials.getAccessKeyId());
conf.set("fs.s3a.secret.key", awsTempCredentials.getSecretAccessKey());
conf.set("fs.s3a.session.token", awsTempCredentials.getSessionToken());
conf.set("fs.s3a.impl", "org.apache.hadoop.fs.s3a.S3AFileSystem");
conf.set("fs.s3a.path.style.access", "true");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also one more general question is: Is it possible for us to provide an abstraction so that we don't need to use the if schema == s3 else if schema == gcp else everywhere, for supporting all the 3 cloud vendors. It make us some kind of hard to maintane and iterate new features.

new CliOptions(
List.of(CliParams.FULL_NAME, CliParams.COLUMNS),
List.of(
CliParams.FULL_NAME, CliParams.COLUMNS, CliParams.STORAGE_LOCATION),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me, thanks for the comment.

@@ -0,0 +1,13 @@
package io.unitycatalog.cli.utils;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are actually more and more classes need to be abstracted in the common module. As I commented here: #1136 (comment)

@@ -0,0 +1,13 @@
package io.unitycatalog.cli.utils;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And think from another hand, if there are only very few API that we need to maintain in common module, then we should be very easy to support the compability. but if there are more and more common classes that we need to maintain in the common module, while we just copy them in every modules, it will be a tough path for us to maintain.

Aslo I think we can limit those common classes to be exposed to the outside.

@yili-db
yili-db requested a review from openinx November 10, 2025 21:02
Signed-off-by: Yi Li <[email protected]>
@yili-db
yili-db force-pushed the staging_table_cli_test branch from 04b52f1 to 815a7ab Compare November 11, 2025 18:03
@yili-db yili-db closed this Nov 11, 2025
@yili-db yili-db reopened this Nov 11, 2025
@yili-db yili-db closed this Nov 11, 2025
@yili-db yili-db reopened this Nov 11, 2025

@openinx openinx left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No comment from my side, thanks @yili-db 's work. Waiting for @tdas 's checking.

@tdas tdas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. thank you!

@tdas
tdas merged commit 72ddfe7 into unitycatalog:main Nov 12, 2025
yili-db added a commit to yili-db/unitycatalog that referenced this pull request Nov 19, 2025
Use this
[link](https://github.com/unitycatalog/unitycatalog/pull/1135/files) to
review incremental changes.
-
[**staging_table_service**](unitycatalog#1135)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/1135/files)]
-
[refactor_base_table_crud_test](unitycatalog#1153)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/1153/files/90c0f2a454c595eeb19df146f38a74e404de61b9..9e82c72fb64a8f5b50a11e0558b01ebb86f906a5)]
-
[staging_table_cli_test](unitycatalog#1136)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/1136/files/9e82c72fb64a8f5b50a11e0558b01ebb86f906a5..b7cbb71bbf046d9926394052258e625b9921d303)]

---------
**PR Checklist**

- [x] A description of the changes is added to the description of this
PR.
- [x] If there is a related issue, make sure it is linked to this PR.
- [ ] If you've fixed a bug or added code that should be tested, add
tests!
- [ ] If you've added or modified a feature, documentation in `docs` is
updated

    Support managed table creation

    - Update TableService for creation of managed tables
- Update API for CreateTable to make storage_location optional for
managed tables
- Enhance TemporaryTableCredentialsService with staging table support
    - Update KeyMapper to also check staging tables
    - Update repository classes to use new helper methods

<!-- Please state what you've changed and how it might affect the users.
-->
Related issue is:
unitycatalog#1143

---------

Signed-off-by: Yi Li <[email protected]>
Co-authored-by: Tathagata Das <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants