如何在配置单元 table 中插入和检索十进制值

How to Insert and retrieve a decimal value in hive table

我想在配置单元 table 中插入和检索十进制值。 这是我的代码片段,它总是 returns NULL:

CREATE TABLE complex_types (c1 decimal);

INSERT INTO TABLE complex_types SELECT cast('100' as decimal);

SELECT * FROM complex_types;

您可以使用 LazySimpleSerDe 或 LazyBinarySerDe 在这样的 table 中读取和写入值。

例如:

alter table decimal_1 set serde 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'; 或者

alter table decimal_1 set serde 'org.apache.hadoop.hive.serde2.lazy.LazyBinarySerDe';

源信息为here