如何在SnappyData中存储数组或Blob? [英] How to store Array or Blob in SnappyData?

查看:73
本文介绍了如何在SnappyData中存储数组或Blob?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个具有两列的表格,如下所示:

I'm trying to create a table with two columns like below:

CREATE TABLE test (col1 INT ,col2 Array<Decimal>) USING column options(BUCKETS '5');

它创建成功,但是当我尝试向其中插入数据时,它不接受任何格式的数组.我已经尝试过以下查询:

It is creating successfully but when i'm trying to insert data into it, it is not accepting any format of array. I've tried the following queries:

insert into test1 values(1,Array(Decimal("1"), Decimal("2")));

insert into test1 values(1,Array(1,2));

insert into test1 values(1,[1,2,1]);

insert into test1 values(1,"1,2,1");

insert into test1 values(1,<1,2,1>);

etc..

请帮助!

推荐答案

为此有一个开放的凭单:

There is an open ticket for this: https://jira.snappydata.io/browse/SNAP-1284 which will be addressed in next release for VALUES strings (JSON string and Spark compatible strings).

Spark Catalyst兼容格式将起作用:

The Spark Catalyst compatible format will work:

insert into test1 select 1, array(1, 2);

在选择数据时,默认情况下以序列化形式提供数据,并显示为二进制.现在,您必须使用"complexTypeAsJJson"提示来显示为JSON:

When selecting the data is by default shipped in serialized form and shown as binary. For now you have to use "complexTypeAsJson" hint to show as JSON:

select * from test1 --+complexTypeAsJson(true);

默认情况下,将在下一版本中添加对以更简单的字符串格式显示的支持.

Support for displaying in simpler string format by default will be added in next release.

在您的示例中还可以注意到的另一件事是存储桶的素数.在以前的版本中,这是首选文档,但从1.0版本开始,建议使用2或偶数的幂(例如,群集中的内核总数可能是个不错的选择)-也许某些示例仍在使用较旧的建议.

One other thing that can be noticed in your example is a prime value for buckets. This was documented as preferred in previous releases but as of 1.0 release it is recommended to use a power of two or some even number (e.g the total number of cores in your cluster can be a good choice) -- perhaps some examples are still using the older recommendation.

这篇关于如何在SnappyData中存储数组或Blob?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆