sanjeet006py commented on code in PR #2041:
URL: https://github.com/apache/phoenix/pull/2041#discussion_r1887120637
##########
phoenix-core-client/src/main/java/org/apache/phoenix/schema/PMetaDataImpl.java:
##########
@@ -83,14 +83,27 @@ private void updateGlobalMetric(PTableRef pTableRef) {
@Override
public PTableRef getTableRef(PTableKey key) throws TableNotFoundException {
+ return getTableRef(key, false);
+ }
+
+ @Override
+ public PTableRef getTableRefNoTNFE(PTableKey key) {
+ try {
+ return getTableRef(key, true);
+ } catch (TableNotFoundException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+
+ private PTableRef getTableRef(PTableKey key, boolean skipTNFE) throws
TableNotFoundException {
if (physicalNameToLogicalTableMap.containsKey(key.getName())) {
key = physicalNameToLogicalTableMap.get(key.getName());
}
PTableRef ref = metaData.get(key);
if (!key.getName().contains(QueryConstants.SYSTEM_SCHEMA_NAME)) {
updateGlobalMetric(ref);
}
- if (ref == null) {
+ if (ref == null && ! skipTNFE) {
Review Comment:
We can create a NULL_TABLE_REF static constant and return that instead of
returning null.
--
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]