Fredy Wijaya has posted comments on this change. ( http://gerrit.cloudera.org:8080/11928 )
Change subject: IMPALA-7839: Remove code duplication for getting a unique catalog object name ...................................................................... Patch Set 3: (2 comments) http://gerrit.cloudera.org:8080/#/c/11928/2/fe/src/main/java/org/apache/impala/catalog/CatalogObjectImpl.java File fe/src/main/java/org/apache/impala/catalog/CatalogObjectImpl.java: http://gerrit.cloudera.org:8080/#/c/11928/2/fe/src/main/java/org/apache/impala/catalog/CatalogObjectImpl.java@45 PS2, Line 45: return Catalog.toCatalogObjectKey(toTCatalogObject()); > Doesn't something like the following work? Just an example for DataSource b The problem is with Table: https://github.com/apache/impala/blob/master/fe/src/main/java/org/apache/impala/catalog/Table.java#L273-L289. Basically we need the Db object which is not available. Calling catalogObject.getDb() will be null when catalogObject.getType() is TABLE or VIEW. Furthermore, the Table::fromThrift() seems to do a lot more stuff, which can be somewhat expensive if the goal is to just get a unique name. IMHO the unnecessary translation from TCatalogObject to CatalogObject in order to get unique name isn't very efficient especially since toCatalogObjectKey is called a lot of times whereas getUniqueName() is only called in one place and only for Table catalog object: https://github.com/apache/impala/blob/master/fe/src/main/java/org/apache/impala/catalog/CatalogServiceCatalog.java#L781-L794. Unfortunately since getUniqueName() is a method required by Catalog interface, all Catalog implementations need to implement it, but they're not actually used other than by Table catalog object. http://gerrit.cloudera.org:8080/#/c/11928/2/fe/src/main/java/org/apache/impala/catalog/CatalogObjectImpl.java@58 PS2, Line 58: */ > Ya, the compile time enforcement is missing unless we separate it out. How Done -- To view, visit http://gerrit.cloudera.org:8080/11928 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I8218e57210c06fe6f2578a792d518e4b0287f15f Gerrit-Change-Number: 11928 Gerrit-PatchSet: 3 Gerrit-Owner: Fredy Wijaya <[email protected]> Gerrit-Reviewer: Bharath Vissapragada <[email protected]> Gerrit-Reviewer: Csaba Ringhofer <[email protected]> Gerrit-Reviewer: Fredy Wijaya <[email protected]> Gerrit-Reviewer: Impala Public Jenkins <[email protected]> Gerrit-Comment-Date: Wed, 21 Nov 2018 18:56:02 +0000 Gerrit-HasComments: Yes
