Cassandra中的用户定义类型(UDT)行为 [英] User Defined Type (UDT) behavior in Cassandra

查看:722
本文介绍了Cassandra中的用户定义类型(UDT)行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果有人在使用UDT(用户定义类型)方面有一些经验,我想了解如何向后兼容性工作。

if someone has some experience in using UDT (User Defined Types), I would like to understand how the backward compatibility would work.

说我有以下UDT

CREATE TYPE addr (
  street1 text,
  zip text,
  state text
);



如果我修改addrUDT有几个属性(例如zip_code2 int,和名称文字):

If I modify "addr" UDT to have a couple of more attributes (say for example zip_code2 int, and name text):

CREATE TYPE addr (
  street1 text,
  zip text,
  state text,
  zip_code2 int,
  name text
);

具有这些属性的旧行如何工作?是否兼容?

how does the older rows that does have these attributes work? Is it even compatible?

感谢

推荐答案

将与旧的定义兼容。用户定义的类型可以具有字段的空值,因此如果更改类型定义,那么该类型的所有现有值将只对所添加的字段具有空值。

The new UDT definition would be compatible with the old definition. User-defined types can have null values for fields, so if you alter the type definition, all existing values for that type will simply have null values for the added fields.

这篇关于Cassandra中的用户定义类型(UDT)行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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