hortonworks-spark / shc

The Apache Spark - Apache HBase Connector is a library to support Spark accessing HBase table as external data source or sink.
Apache License 2.0
552 stars 281 forks source link

Using Java Primitive Long Data Type with SHC #311

Open kingbari opened 5 years ago

kingbari commented 5 years ago

When I use the catalog below to retrieve the timestamp with a value of: 1552413600000, SHC returns: 3545798771364410166. Why is that?

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()