Skip to content

Commit

Permalink
shim for both 0.12 & 0.13.1
Browse files Browse the repository at this point in the history
  • Loading branch information
chenghao-intel committed Oct 28, 2014
1 parent cfb3662 commit e011ef5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private[hive] class HiveMetastoreCatalog(hive: HiveContext) extends Catalog with
}

if (crtTbl != null && crtTbl.getLocation() != null) {
tbl.setDataLocation(new Path(crtTbl.getLocation()).toUri())
HiveShim.setLocation(tbl, crtTbl)
}

if (crtTbl != null && crtTbl.getSkewedColNames() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import org.apache.hadoop.hive.common.`type`.HiveDecimal
import org.apache.hadoop.hive.conf.HiveConf
import org.apache.hadoop.hive.ql.Context
import org.apache.hadoop.hive.ql.metadata.{Hive, Partition, Table}
import org.apache.hadoop.hive.ql.plan.{FileSinkDesc, TableDesc}
import org.apache.hadoop.hive.ql.plan.{CreateTableDesc, FileSinkDesc, TableDesc}
import org.apache.hadoop.hive.ql.processors._
import org.apache.hadoop.hive.ql.stats.StatsSetupConst
import org.apache.hadoop.hive.serde2.{Deserializer, ColumnProjectionUtils}
Expand Down Expand Up @@ -89,6 +89,9 @@ private[hive] object HiveShim {
"udf_concat"
)

def setLocation(tbl: Table, crtTbl: CreateTableDesc): Unit = {
tbl.setDataLocation(new Path(crtTbl.getLocation()).toUri())
}
}

class ShimFileSinkDesc(var dir: String, var tableInfo: TableDesc, var compressed: Boolean)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import org.apache.hadoop.hive.common.`type`.{HiveDecimal}
import org.apache.hadoop.hive.conf.HiveConf
import org.apache.hadoop.hive.ql.Context
import org.apache.hadoop.hive.ql.metadata.{Table, Hive, Partition}
import org.apache.hadoop.hive.ql.plan.{FileSinkDesc, TableDesc}
import org.apache.hadoop.hive.ql.plan.{CreateTableDesc, FileSinkDesc, TableDesc}
import org.apache.hadoop.hive.ql.processors.CommandProcessorFactory
import org.apache.hadoop.hive.serde2.{ColumnProjectionUtils, Deserializer}
import org.apache.hadoop.mapred.InputFormat
Expand Down Expand Up @@ -121,6 +121,10 @@ private[hive] object HiveShim {

def compatibilityBlackList = Seq()

def setLocation(tbl: Table, crtTbl: CreateTableDesc): Unit = {
tbl.setDataLocation(new Path(crtTbl.getLocation()))
}

/*
* Bug introdiced in hive-0.13. FileSinkDesc is serializable, but its member path is not.
* Fix it through wrapper.
Expand Down

0 comments on commit e011ef5

Please sign in to comment.