thibaultcha / lua-cassandra

Pure Lua driver for Apache Cassandra
https://thibaultcha.github.io/lua-cassandra
Other
98 stars 35 forks source link

`client:execute` function returns `unserializable table` #151

Open howiezhao opened 1 year ago

howiezhao commented 1 year ago

On my ARM machine (M1 MacBook Pro), when I call the execute (such as SELECT * FROM test;) function, it returns me an unserializable table. On x86 machines, it can return a serializable table.

After my investigation, if there is a column in my Cassandra table schema that is of map<timestamp, text> or map<timestamp, int> type, it will not be serialized on ARM, but it will be normal on x86.

I found that on an x86 machine, it can convert a number key to a string type, but on an arm machine, it cannot, which may be the reason why the table cannot be serialized.

How can I find out the real reason? Any suggestions? grateful.

ximouzhao commented 9 months ago

when the key is int and it is greater than 10, the serialize will occur error.

> x= { [11]="a"} return (require "cjson.safe").encode(x)
nil Cannot serialise table: excessively sparse array
> x= { [10]="a"} return (require "cjson.safe").encode(x)
[null,null,null,null,null,null,null,null,null,"a"]