Skip to content

Conversation

@poojanilangekar
Copy link
Contributor

Based on the discussion in the community sync, this PR modularizes federation calls to a separate factory. The specific instances of the NonRESTCatalogFactory is loaded only when a non-REST catalog is initialized and accessed. Beyond the catalog initialization, all the calls are identical for internal and federated catalogs.

Based on the discussion in #2301, this PR removes the compile-time flag used to build the HadoopFederatedCatalogFactory.

Testing:
Applied the regtest in PR #2286.

@poojanilangekar
Copy link
Contributor Author

CC: @eric-maynard @dennishuo @adutra

@eric-maynard
Copy link
Contributor

If @snazy is okay with using this approach for HMS federation, then I think it's preferable to option 1

Copy link
Member

@snazy snazy left a comment

Choose a reason for hiding this comment

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

Yea, thanks for removing the conditional build parameter. One comment though. But otherwise I'm fine with it.

Comment on lines 38 to 39
public static final String ICEBERG_REST_FACTORY_IDENTIFIER = "ICEBERG_REST";
public static final String HADOOP_FACTORY_IDENTIFIER = "HADOOP";
Copy link
Member

Choose a reason for hiding this comment

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

THose are superfluous, as those are the enum names, and can therefore be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We still need these because we can't use ConnnectionType.ICEBERG_REST.name() or ConnectionType.HADOOP.name(). The annotations needs to be constant expressions. Here's the error for your reference.

The value for annotation attribute Identifier.value must be a constant expressionJava(536871525)

Comment on lines +90 to +100
public String getFactoryIdentifier() {
switch (this) {
case ICEBERG_REST:
return ICEBERG_REST_FACTORY_IDENTIFIER;
case HADOOP:
return HADOOP_FACTORY_IDENTIFIER;
default:
throw new UnsupportedOperationException(
"No factory identifier for connection type: " + this);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

You may want to just return name().toLowerCase(Locale.ROOT) – since most CDI identifiers in Polaris (if not all) are lower-case.

Suggested change
public String getFactoryIdentifier() {
switch (this) {
case ICEBERG_REST:
return ICEBERG_REST_FACTORY_IDENTIFIER;
case HADOOP:
return HADOOP_FACTORY_IDENTIFIER;
default:
throw new UnsupportedOperationException(
"No factory identifier for connection type: " + this);
}
}
public String getFactoryIdentifier() {
return name().toLowerCase(Locale.ROOT);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can't use the name().toLowerCase() directly because of two reasons:

  1. We need the annotations to be constants. (Please see my comment above)
  2. We need to explicitly handle the NULL_TYPE/default case.

To make things consistent, I've changed the declarations to use lower case.

Copy link
Contributor

@dennishuo dennishuo left a comment

Choose a reason for hiding this comment

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

LGTM

@github-project-automation github-project-automation bot moved this from PRs In Progress to Ready to merge in Basic Kanban Board Aug 14, 2025
@dennishuo
Copy link
Contributor

Looks like other comments have also been addressed, merging now.

@dennishuo dennishuo merged commit b2b1453 into apache:main Aug 14, 2025
12 checks passed
@github-project-automation github-project-automation bot moved this from Ready to merge to Done in Basic Kanban Board Aug 14, 2025
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.

5 participants