Skip to content

Conversation

@beliefer
Copy link
Collaborator

@beliefer beliefer commented Jan 22, 2020

What changes were proposed in this pull request?

The current implement of MongoManager some violations of programming.
The trait DataSourceManager define a template function listTables show below:

  /**
   * Display the tables of specified database.
   */
  override def listTables(db: String): Seq[String] = {
    throw new UnsupportedOperationException(s"List ${shortName()} table not supported!")
  }

  /**
   * Display the tables of specified database with pattern.
   */
  override def listTables(dbName: String, pattern: String): Seq[String] = {
    StringUtils.filterPattern(listTables(dbName), pattern)
  }

The design require the specific data source to implement listTables(db: String), but MongoManager overwrite the template function show below:

  override def listTables(dsName: String, dbName: String): Seq[String] = {
    val mongoDB = mongoClient.getDatabase(dbName)
    mongoDB.listCollectionNames().asScala.toSeq
  }

It will causes some bug. I think should to improve the implement to make MongoManager more consistent with the design.

How was this patch tested?

No UT.

@beliefer beliefer added bug Something isn't working improve Improvements to function labels Jan 22, 2020
@WeiWenda
Copy link
Collaborator

LGTM

@WeiWenda WeiWenda merged commit 529c1bb into Qihoo360:master Feb 13, 2020
@beliefer
Copy link
Collaborator Author

beliefer commented Feb 20, 2020

@WeiWenda Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working improve Improvements to function

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants