Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Override equals and hashCode for TableIdentifier
  • Loading branch information
LuciferYang committed Jan 16, 2023
commit 7bd488b4d80c70ce51baccc50db1a5f5f22d5d44
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ case class TableIdentifier(table: String, database: Option[String], catalog: Opt

def this(table: String) = this(table, None, None)
def this(table: String, database: Option[String]) = this(table, database, None)

override def equals(obj: Any): Boolean = obj match {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently printing is org.apache.spark.sql.execution.datasources.CatalogFileIndex@hashCode

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The better solution would be to normalize the output by removing CatalogFileIndex@xxx part.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just print org.apache.spark.sql.execution.datasources.CatalogFileIndex?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can replace CatalogFileIndex@xxx to CatalogFileIndex in SQLQueryTestHelper#replaceNotIncludedMsg to recover test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ulysses-you do you mean

change to use SQLQueryTestHelper.replaceNotIncludedMsg(output) ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it had already used

case t: TableIdentifier => table == t.table && database == t.database && catalog == t.catalog
case _ => false
}

override def hashCode(): Int = unquotedString.hashCode
}

/** A fully qualified identifier for a table (i.e., database.tableName) */
Expand Down