Cassandra alter column type: which types are compatible?

前端 未结 2 1121
刺人心
刺人心 2021-01-03 06:26

There\'s some patchy information on the interwebs about some examples when column type can\'t be changed. For example, on the DataStax site there\'s a mention:

2条回答
  •  -上瘾入骨i
    2021-01-03 06:54

    Great question! I have to admit that I was a bit surprised at the lack of thorough documentation on this one, as well. Your question inspired me to do a little investigation and blog about it as well.

    Essentially, here is a comprehensive list of Cassandra compatible CQL types (using Cassandra 2.2.0):

    • ascii -> blob, text, varchar
    • bigint -> blob, timestamp, varint
    • int -> blob, varint
    • text -> blob, varchar
    • timestamp -> bigint, blob, varint
    • timeuuid -> blob, UUID
    • varchar -> blob, text

    Notes:

    • blob is in there a lot, because anything can be converted to a blob.
    • cqlsh allows you to convert a varint to the new date type, but this is a bug (CASSANDRA-10027). Don't actually try that.

提交回复
热议问题