> On Nov. 27, 2019, 5:22 p.m., Ashutosh Mestry wrote: > > addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/CreateDatabase.java > > Lines 63 (patched) > > <https://reviews.apache.org/r/71831/diff/1/?file=2179542#file2179542line63> > > > > Comment: Is _getMetastoreHandler_ guaranteed to be present? > > > > I am not entirely sure if this line can be: > > > > _db = context.getMetastoreHandler() != null ? > > context.getMetastoreHandler().get_database(db.getName()) : null; > > _
getHiveMetastoreEntities() method gets called from 2 places, 1. AlterDatabase.getNotificationMessages() and 2. CreateDatabase.getNotificationMessages() In both the cases only when context.isMetastoreHook() == true. Therefore we don't need to check context.isMetastoreHook() in method getHiveMetastoreEntities() - Mandar ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/71831/#review218827 ----------------------------------------------------------- On Nov. 27, 2019, 11:08 a.m., Mandar Ambawane wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/71831/ > ----------------------------------------------------------- > > (Updated Nov. 27, 2019, 11:08 a.m.) > > > Review request for atlas, Ashutosh Mestry, Madhan Neethiraj, Nixon Rodrigues, > and Sarath Subramanian. > > > Bugs: ATLAS-3539 > https://issues.apache.org/jira/browse/ATLAS-3539 > > > Repository: atlas > > > Description > ------- > > Issue:- Difference in information sent to ATLAS_HOOK while database creation > from Beeline and Spark. > > Observation:- > When we fetch database entity by MetastoreEvent object, we don't get > ownerType attribute. > But when we fetch database entity by MetastoreHandler object, we get > ownerType attribute for the database. > > Fix:- > At the time of Table creation from the Spark-Client, our code fetches > Database object by using MetastoreHandler, there we can get ownerType in > Database. > Therefore here I have used MetastoreHandler object to fetch Database object. > > Also handled the description attribute null and empty case. > > > Diffs > ----- > > > addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/BaseHiveEvent.java > 851582c > > addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/CreateDatabase.java > 7bea779 > > > Diff: https://reviews.apache.org/r/71831/diff/1/ > > > Testing > ------- > > Manual testing done as follwos > 1. Database created from beeling client. > 2. Cheked for the json sent to ATLAS-HOOK, here attribute ownerType was > present. > 3. Database create from Spark client. > 4. Checked for the json sent to ATLAS-HOOK, here attribute ownerType was > present. > > PreCommit build is successful. > https://builds.apache.org/job/PreCommit-ATLAS-Build-Test/1565/console > > > Thanks, > > Mandar Ambawane > >