将Java原始长数据类型与SHC一起使用

时间:2019-04-29 19:36:38

标签: scala apache-spark hbase

当我使用下面的目录检索值为1552413600000时间戳时,SHC返回:3545798771364410166。为什么会这样?

val catalog = s"""{
    |"table": {
    |    "namespace": "default",
    |    "name": "Accounts",
    |    "tableCoder": "PrimitiveType"
    |},
    |"rowkey": "Key",
    |"columns": {
    |    "id": {"cf": "rowkey", "col": "Key", "type": "string"},
    |    "account": {"cf": "Meta", "col": "Account", "type": "string"},
    |    "timestamp": {"cf": "Meta", "col": "Timestamp", "type": "long"}
    |}
|}""".stripMargin

def withCatalog(catalog: String): DataFrame = {
    spark.sqlContext
    .read
    .options(Map(HBaseTableCatalog.tableCatalog -> catalog))
    .format("org.apache.spark.sql.execution.datasources.hbase")
    .load()
 }

val df = withCatalog(catalog)

df.show()

0 个答案:

没有答案