Skip to content

Commit

Permalink
yin's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
marmbrus committed May 7, 2015
1 parent f5de7de commit 4b5cd41
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ private[hive] class HiveMetastoreCatalog(val client: ClientInterface, hive: Hive
val cacheLoader = new CacheLoader[QualifiedTableName, LogicalPlan]() {
override def load(in: QualifiedTableName): LogicalPlan = {
logDebug(s"Creating new cached data source for $in")
val table = HiveMetastoreCatalog.this.synchronized {
client.getTable(in.database, in.name)
}
val table = client.getTable(in.database, in.name)

def schemaStringFromParts: Option[String] = {
table.properties.get("spark.sql.sources.schema.numParts").map { numParts =>
Expand Down Expand Up @@ -179,14 +177,14 @@ private[hive] class HiveMetastoreCatalog(val client: ClientInterface, hive: Hive
serdeProperties = options))
}

def hiveDefaultTableFilePath(tableName: String): String = synchronized {
def hiveDefaultTableFilePath(tableName: String): String = {
// Code based on: hiveWarehouse.getTablePath(currentDatabase, tableName)
new Path(
new Path(client.getDatabase(client.currentDatabase).location),
tableName.toLowerCase).toString
}

def tableExists(tableIdentifier: Seq[String]): Boolean = synchronized {
def tableExists(tableIdentifier: Seq[String]): Boolean = {
val tableIdent = processTableIdentifier(tableIdentifier)
val databaseName =
tableIdent
Expand Down Expand Up @@ -312,7 +310,7 @@ private[hive] class HiveMetastoreCatalog(val client: ClientInterface, hive: Hive
result.newInstance()
}

override def getTables(databaseName: Option[String]): Seq[(String, Boolean)] = synchronized {
override def getTables(databaseName: Option[String]): Seq[(String, Boolean)] = {
val db = databaseName.getOrElse(client.currentDatabase)

client.listTables(db).map(tableName => (tableName, false))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1149,8 +1149,8 @@ https://cwiki.apache.org/confluence/display/Hive/Enhanced+Aggregation%2C+Cube%2C
}

protected val escapedIdentifier = "`([^`]+)`".r
protected val singleQuotedString = "\"([^\"]+)\"".r
protected val doubleQuotedString = "'([^']+)'".r
protected val doubleQuotedString = "\"([^\"]+)\"".r
protected val singleQuotedString = "'([^']+)'".r

protected def unquoteString(str: String) = str match {
case singleQuotedString(s) => s
Expand Down

0 comments on commit 4b5cd41

Please sign in to comment.