Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHOENIX-7304 - Adding utilitiy method to get view index ids for given view index table #2026

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Himanshu-g81
Copy link

Adding utilitiy method to get view index ids for given view index table
JIRA - PHOENIX-7304

throws IOException, SQLException {
Preconditions.checkArgument(MetaDataUtil.isViewIndex(tableName));
List<String> viewIndexIdsString = new ArrayList<>();
PreparedStatement preparedStatement = connection.prepareStatement(getViewIndexIdsQuery(tableName, includeTenantViewIndexes));
Copy link
Contributor

Choose a reason for hiding this comment

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

Good to have INFO log with the value of getViewIndexIdsQuery() to help debug if something goes wrong.

Comment on lines +493 to +495
final String tableName = schemaPrefix + generateUniqueName();
final String globalViewName1 = schemaPrefix + generateUniqueName();
final String globalViewName2 = schemaPrefix + generateUniqueName();
Copy link
Contributor

Choose a reason for hiding this comment

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

SchemaUtil#getTableName API is generally used. It works with null schema name.

/**
* Retrieves the list of unique view index ids from SYSTEM.CATALOG for a given view index table
* @param connection - Phoenix Connection
* @param tableName - name of the view index table for which view index ids need to be retrieved
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like this is the physical name of the view Index table and not the logical name. Can you update the API document to clarify this.

}

// Get view indexes ids only for global view indexes (excluding tenant view indexes)
List<String> list = ViewUtil.getViewIndexIds(conn.unwrap(PhoenixConnection.class), "_IDX_" + tableName, false);
Copy link
Contributor

Choose a reason for hiding this comment

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

use MetatadataUtil.getViewIndexPhysicalName instead of using hardcoded constants _IDX

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