Coder Social home page Coder Social logo

Comments (3)

velvia avatar velvia commented on June 12, 2024

Note: we will probably move to a model where there is a separate Segment key from the sort key. The sort key is the primary key within a partition, whereas all records with the same segment key map into the same segment. Within a segment, rows will be sorted by the sort key.

The segment key does not need to be a physically separate column. It could, and may usually be, a computed function on another column. For example, let's say for a time-series example, the sort key is a composite of ["timestamp", "uuid"]. Let's say we want to group all records into 30-second buckets. Then the segment key would be (timeslice timestamp 30s) which is a function slicing the timestamp column (assumed to be milliseconds) into 30-second buckets.

from filodb.

velvia avatar velvia commented on June 12, 2024

Proposed initial set of expressions:

  • (timeslice <ms-timestamp-col> <timeunitstr>)
  • (round <int/long col> <number>) -- the default 10000 segment len would be the function (round colA 10000)
  • (stringPrefix <str col> <numChars>) -- gets the first numChars of the string

Some relevant code, for rounding:

  def getSegment(key: Long): (Long, Long) = {
    val segmentNum = key / segmentLen
    (segmentNum * segmentLen, (segmentNum + 1) * segmentLen)
  }

for string prefixing:

  def getSegment(key: String): (String, String) = {
    val start = key.take(prefixLen)
    val end = start.take(start.length - 1) + ((start(start.length - 1) + 1).toChar)
    (start, end)
  }

from filodb.

velvia avatar velvia commented on June 12, 2024

Also:

  • (getOrElse <col name> <default value>) -- provide a default value if the column value is null
  • (autoid) -- generate an auto incrementing ID within each partition (need to think about how this works - might be a TimeUUID)
  • (const <val>) - returns a constant value. Only useful for doing a default partition key.

from filodb.

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.