从JDBS表(Phoenix)读取varbinary作为double值

时间:2017-09-04 08:47:52

标签: sql phoenix

我在凤凰城的表现如下:

CREATE TABLE VROC_SENSORDATA (
    NODE_ID VARCHAR NOT NULL,
    DATA_TIMESTAMP BIGINT NOT NULL,
    YYYYMMDD UNSIGNED_INT,
    "HOUR" UNSIGNED_TINYINT,
    "MINUTE" UNSIGNED_TINYINT,
    "SECOND" UNSIGNED_TINYINT,
    DATA_QUALITY FLOAT,
    DATA_VALUE VARBINARY,
    CONSTRAINT VROC_SENSORDATA_PK PRIMARY KEY (NODE_ID,DATA_TIMESTAMP)
) ;

列名DATA_VALUE是VARBINARY并包含双值

我正在使用Spark,然后将JDBC(SQL)查询作为

SELECT *
FROM VROC_SENSORDATA WHERE NODE_ID='05535dbe-1aca-3789-aa16-adbd95ed2925';

我会得到像bellow

的结果
+------------------------------------+--------------+--------+----+------+------+------------+-------------------+
|NODE_ID                             |DATA_TIMESTAMP|YYYYMMDD|HOUR|MINUTE|SECOND|DATA_QUALITY|DATA_VALUE         |
+------------------------------------+--------------+--------+----+------+------+------------+-------------------+
|05535dbe-1aca-3789-aa16-adbd95ed2925|1455839492468 |20160219|7   |51    |32    |100.0       |[33 36 33 33 2E 30]|
|05535dbe-1aca-3789-aa16-adbd95ed2925|1455839492734 |20160219|7   |51    |32    |100.0       |[32 38 36 35 2E 30]|
|05535dbe-1aca-3789-aa16-adbd95ed2925|1455839492967 |20160219|7   |51    |32    |100.0       |[34 35 31 36 2E 30]|
|05535dbe-1aca-3789-aa16-adbd95ed2925|1455839493233 |20160219|7   |51    |33    |100.0       |[32 34 39 39 2E 30]|

我需要获得精确的double值。当我使用SQL查询时,无论如何将上面的值转换为double?

0 个答案:

没有答案