Skip to content

Commit

Permalink
addendum - handle namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
virajjasani committed Nov 7, 2023
1 parent 7e4828d commit 2e0da18
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,8 @@ public class PhoenixDatabaseMetaData implements DatabaseMetaData {
public static final String SYSTEM_CHILD_LINK_TABLE = "CHILD_LINK";
public static final String SYSTEM_CHILD_LINK_NAME = SchemaUtil.getTableName(SYSTEM_CATALOG_SCHEMA, SYSTEM_CHILD_LINK_TABLE);
public static final byte[] SYSTEM_CHILD_LINK_NAME_BYTES = Bytes.toBytes(SYSTEM_CHILD_LINK_NAME);
public static final byte[] SYSTEM_CHILD_LINK_NAMESPACE_BYTES =
SchemaUtil.getPhysicalTableName(SYSTEM_CHILD_LINK_NAME_BYTES, true).getName();
public static final TableName SYSTEM_LINK_HBASE_TABLE_NAME = TableName.valueOf(SYSTEM_CHILD_LINK_NAME);

public static final String SYSTEM_TASK_TABLE = "TASK";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static org.apache.phoenix.exception.SQLExceptionCode.CANNOT_TRANSFORM_TRANSACTIONAL_TABLE;
import static org.apache.phoenix.exception.SQLExceptionCode.ERROR_WRITING_TO_SCHEMA_REGISTRY;
import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.STREAMING_TOPIC_NAME;
import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CHILD_LINK_NAMESPACE_BYTES;
import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CHILD_LINK_NAME_BYTES;
import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_TASK_TABLE;
import static org.apache.phoenix.query.QueryConstants.SYSTEM_SCHEMA_NAME;
Expand Down Expand Up @@ -1714,8 +1715,11 @@ private void verifyIfDescViewsExtendPk(PTable view,
if (connection.getQueryServices() instanceof ConnectionlessQueryServicesImpl) {
return;
}
byte[] systemChildLinkTable = SchemaUtil.isNamespaceMappingEnabled(null, config) ?
SYSTEM_CHILD_LINK_NAMESPACE_BYTES :
SYSTEM_CHILD_LINK_NAME_BYTES;
try (Table childLinkTable =
connection.getQueryServices().getTable(SYSTEM_CHILD_LINK_NAME_BYTES)) {
connection.getQueryServices().getTable(systemChildLinkTable)) {
byte[] tenantId = connection.getTenantId() == null ? null
: connection.getTenantId().getBytes();
byte[] schemaNameBytes = view.getSchemaName().getBytes();
Expand Down Expand Up @@ -1744,8 +1748,6 @@ private void verifyIfDescViewsExtendPk(PTable view,
}
}
}
} catch (org.apache.hadoop.hbase.TableNotFoundException e) {
LOGGER.error("Table not found or not accessible.", e);
} catch (IOException e) {
LOGGER.error("Error while retrieving descendent views", e);
throw new SQLException(e);
Expand Down

0 comments on commit 2e0da18

Please sign in to comment.