1)the 'databaseExists' call in 'CommonUnifiedCatalog#createDatabase' and 'CommonUnifiedCatalog#dropDatabase' can be suppressed by the subsequent logic, so we delete redundant 'databaseExists' in those functions.
2) the 'databaseExists' in 'CommonUnifiedCatalog#listTables' can not be removed directly, because the 'HudiHadoopCatalog#listTables' and 'MixedCatalog#listTables' methods called in 'FormatCatalog#listTables' do not explicitly throw NoSuchDatabaseException. We add exception handling for NoSuchDatabaseException in these functions to eliminate the redundancy of 'databaseExists' in 'CommonUnifiedCatalog#listTables'.
How was this patch tested?
[ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
[ ] Add screenshots for manual tests if appropriate
[x] Run test locally before making a pull request
Documentation
Does this pull request introduce a new feature? (yes / no)
If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
Why are the changes needed?
Close #3330
Brief change log
1)the 'databaseExists' call in 'CommonUnifiedCatalog#createDatabase' and 'CommonUnifiedCatalog#dropDatabase' can be suppressed by the subsequent logic, so we delete redundant 'databaseExists' in those functions. 2) the 'databaseExists' in 'CommonUnifiedCatalog#listTables' can not be removed directly, because the 'HudiHadoopCatalog#listTables' and 'MixedCatalog#listTables' methods called in 'FormatCatalog#listTables' do not explicitly throw NoSuchDatabaseException. We add exception handling for NoSuchDatabaseException in these functions to eliminate the redundancy of 'databaseExists' in 'CommonUnifiedCatalog#listTables'.
How was this patch tested?
[ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
[ ] Add screenshots for manual tests if appropriate
[x] Run test locally before making a pull request
Documentation