Embedded Databases (IoTDB, Realm etc)

Embedded Databases (IoTDB, Realm etc)

Development notes related to Embedded Databases used in the Playground

Table of contents:

Apache IoTDB

Phase1 PoC

  • Versions used for development: Apache IoTDB v1.2.2, Apache Go Client v1.1.7

  • Timeseries Schema

    • As there is no mechanism (that we are aware of) for a southbound feeder and WAII to negotiate/communicate a schema as a starting point a simple key/value pair schema was used within IoTDB to store VSS timeseries data. A simple schema is probably the best place to start anyway for simplicity of understanding.

    • The IoTDB data model supports hierarchical paths for efficiency of data at scale. The model uses a dot notation. So for example a vehicle DB may have the hierarchy root.region.model.

    • This causes a challenge integrating VSS node paths which also use a dot notation. For example using the VSS node path Vehicle.CurrentLocation.Longitude as the timeseries key/measurement would cause Vehicle and CurrentLocation to be used in the hierarchy. When scaled across millions of vehicles this would cause inefficiency in storage and retrieval.

    • A simple solution is to quote the VSS node path and is what used here.

      • Example: Using the Go Client the VSS node Vehicle.CurrentLocation.Longitude is back quoted and suffixed to the IoTDB timeseries path, e.g. root.region.model.`Vehicle.CurrentLocation.Longitude`

      • Example: querying stored last VSS value using the IoTDB Cli client:

      • --------------------- Starting IoTDB Cli ---------------------  _____       _________  ______   ______     |_   _|     |  _   _  ||_   _ `.|_   _ \      | |   .--.|_/ | | \_|  | | `. \ | |_) |     | | / .'`\ \  | |      | |  | | |  __'.    _| |_| \__. | _| |_    _| |_.' /_| |__) |  |_____|'.__.' |_____|  |______.'|_______/  version 1.2.2 (Build: 5d0bfb0)                                             Successfully login at iotdb-service:6667 IoTDB> select last `Vehicle.CurrentLocation.Longitude` from root.test2.dev1 +------------------------+---------------------------------------------------+--------+--------+ |                    Time|                                         Timeseries|   Value|DataType| +------------------------+---------------------------------------------------+--------+--------+ |2024-02-01T19:57:37.604Z|root.test2.dev1.`Vehicle.CurrentLocation.Longitude`|-73.9873|   FLOAT| +------------------------+---------------------------------------------------+--------+--------+ Total line number = 1 It costs 0.177s IoTDB> 
  • Creating VSS aligned timeseries

    • Examples of creating a schema for an aligned VSS timeseries using SQL

      CREATE ALIGNED TIMESERIES root.test2.dev1(`Vehicle.CurrentLocation.Longitude` FLOAT, `Vehicle.CurrentLocation.Longitude` FLOAT, `Vehicle.Cabin.Infotainment.HMI.DistanceUnit` TEXT) CREATE ALIGNED TIMESERIES root.test2.dev1(`Vehicle.CurrentLocation.Longitude` FLOAT encoding=PLAIN compressor=SNAPPY, `Vehicle.CurrentLocation.Longitude` FLOAT encoding=PLAIN compressor=SNAPPY, `Vehicle.Cabin.Infotainment.HMI.DistanceUnit` TEXT encoding=PLAIN compressor=SNAPPY)

       

      •  

MongoDB Realm