User Defined Type (UDT) behavior in Cassandra

不羁的心 提交于 2019-12-12 09:19:05

问题


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

Say I have the following UDT

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

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?

Thanks


回答1:


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.



来源:https://stackoverflow.com/questions/34300141/user-defined-type-udt-behavior-in-cassandra

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!