Closed secfree closed 9 years ago
I will take a look at it.
Hi @secfree,
I tried the following case:
sql(
"""CREATE TABLE test (shop_id Long, vender_id Double, sku_id Long,
|PRIMARY KEY (sku_id))
|MAPPED BY (test, COLS=[shop_id=d.shop_id,vender_id=d.vender_id])""".stripMargin
)
sql("INSERT INTO table test VALUES(0, 0.1, 0)")
sql("INSERT INTO table test VALUES(32, 1.2, 2)")
sql("INSERT INTO table test VALUES(12312, 2.1, 4)")
sql("INSERT INTO table test VALUES(11, 3.2, 3)")
sql("select * from test limit 3").show
And it give me the correct result. Thus, may I have your test cases and the data in the table?
Here is a row of my table which i mapped from a exist table in HBase.
| 0| 1| 0| 0| 0| 6183| 0| 0.147| 0| 42061.206177 |
When mapping, if I set all column's type to long or double, it cause the error I reported.
If I just set the type to string, it's ok.
Hi @secfree,
I am sorry. For now, we don't support the existed table that created by hbase directly.
Ok, maybe I got a misunderstanding about the title: Example 1: Create and query SparkSQL table map to existing Hbase table
Hi @secfree,
It isn't your fault. It's our mistake. I will tell our leader to delete this mis-guiding info. Sorry for the confusion.
Hi @secfree,
We just checkin the new feature to support pre-exist table in HBase. You are welcome to checkout and have a try. :) The syntax to create a mapping to the table created by hbase is similar to :
"CREATE TABLE tb0 (column2 INTEGER, column1 INTEGER, column4 FLOAT, column3 SHORT, PRIMARY KEY(column1)) MAPPED BY (testNamespace.ht0, COLS=[column2=family0.qualifier0, column3=family1.qualifier1, column4=family2.qualifier2]) IN StringFormat"
当列中有数据类型定义为 double 或 long 时, 使用:
报错:
或者
这是一个 bug ?