Coder Social home page Coder Social logo

Comments (5)

xiangjinwu avatar xiangjinwu commented on June 25, 2024 2

One benefit of fixed-length 0x00012345 over 12345 is that consumer can order by it without casting it back to bigints, which can be easily forgotten. This is treating serial like an opaque type.

If that is not a concern, or we already display serial in decimal in some other places, using a consistent decimal representation could make crossing referencing much easier.

from risingwave.

shanicky avatar shanicky commented on June 25, 2024 1

I submitted a PR trying to use padded hexadecimal strings in the JSON. It looks ok.

{"_row_id":"0x05cd07777f434000","v":1}
{"_row_id":"0x05cd07758bc9c000","v":2}

from risingwave.

fuyufjh avatar fuyufjh commented on June 25, 2024

Any progress? @xxchan @shanicky

from risingwave.

shanicky avatar shanicky commented on June 25, 2024

Currently, we have supported int64 in protobuf format directly as a native number, but we haven't supported it in JSON and Avro formats. Because we need to use serial as a key and JSON's handling of large numbers cannot guarantee precision, we need to convert it to a string type. cc @fuyufjh Is this approach okay? Should we convert it directly to a string as "12345", or convert it to hexadecimal as "0x12345", or perhaps add a prefix like "rw-serial:12345"? Which option would have the lowest overhead for us in terms of interpretation?

Avro doesn't have this issue, so we can use native int64.

from risingwave.

fuyufjh avatar fuyufjh commented on June 25, 2024

Agree that the serial value needs to be converted to string. This because our row_id is almost 100% out of the MAX_SAFE_INTEGER so that a normal downstream JSON parser may lose precision.

Either plain string "12345" or hexadecimal "0x12345" looks good to me.

from risingwave.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.