Giter VIP home page Giter VIP logo

glin's Introduction

GLIN

Check out our preprint: GLIN: A Lightweight Learned Indexing Mechanism for Complex Geometries

Introduction

This paper introduces GLIN, a generic learned index for spatial range queries on complex geometries. To achieve that, GLIN transforms geometries to Z-address intervals, and builds a hierarchical model to learn the cumulative distribution function between these intervals and the record positions. The lightweight hierarchical model greatly shortens the index probing time. Furthermore, GLIN augments spatial range query using an add-on piecewise function to guarantee the query accuracy for both πΆπ‘œπ‘›π‘‘π‘Žπ‘–π‘›π‘  and πΌπ‘›π‘‘π‘’π‘Ÿπ‘ π‘’π‘π‘‘π‘  spatial relationships.

Highlights

  • GLIN transforms geometries to 1-dimensional sortable values,namely Z-address intervals, using Z-order curve.
  • GLIN is the first learned index that handles non-point geospatial values.
  • GLIN updates its index structure efficiently with query accuracy guaranteed.

Code Structure

  • GLIN: contains core glin fucntion other than Recursive model index(RMI) as following
    • Z-Address Interval transformation function
    • Index search function and update function (insertion and deletion)
    • Piecewise function initialization, query window augmentation, piecewise function updates
  • src: GLIN-customized ALEX recursive model, including nodes, node updates function, and model training.
  • test: tests related to GLIN-customized ALEX recursive model and GLIN's function

Dependencies

  • GEOS: brew install geos (geos-3.11.0)
  • BOOST C++ library : brew install boost

Build and Run test

  • Compile the project using CMake. It will build a new direcotory named as build ./build.sh

  • Run unit tests without query augmentation, for Contains relationship only ./build/test_glin

    • run unit tests with query augmentation. It supports both Contains and Intersects relationship

    ./build/test_glin_piece

  • GitHub Action automatically tests every commit using all unit tests.

API Doc

  • To construct a index for geometry colomn

alex::Glin<double, geos::geom::Geometry *> index

  • Bulkload to Index

index.glin_bulk_load(poly_vec, piecelimitation, "z", cell_xmin,cell_ymin, cell_x_intvl, cell_y_intvl, pieces)

  • Parameters:
    • poly_vec : a vector of Geometries in std::vector<geos::geom::Geometry *>
    • piecelimitation: a double, limits how many records is summarized in a single piece
    • space-filling-curve : z-order-filling-curve
    • cell_xmin: the minimal value of x in a geometry, for real-world data, set cell_xmin = -180
    • cell_ymin: the minimal value of y in a geometry, for real-world data, set cell_ymin = -180
    • cell_x_intvl, cell_y_intvl:: a small enough value is valid for all data, by default we set to 0.0000005, but it is tunable parameter
    • pieces: vector of piecewise function. If the user does not choose PIECEWISE setting, this value is empty.
  • Search in index

index.glin_find(query, "z", cell_xmin,cell_ymin, cell_x_intvl, cell_y_intvl, pieces, find_result, count_filter)

  • Parameters:
    • querywindow: the query window to perform search with
    • space-filling-curve : z-order-filling-curve
    • cell_xmin: the minimal value of x in a geometry, for real-world data, set cell_xmin = -180
    • cell_ymin: the minimal value of y in a geometry, for real-world data, set cell_ymin = -180
    • cell_x_intvl, cell_y_intvl:: a small enough value is valid for all data, by default we set to 0.0000005, but it is tunable parameter
    • pieces: vector of piecewise function. If the user does not choose PIECEWISE setting, this value is empty.
    • find result: The result after refine
    • count_filter : the number of result before refine
  • Insert geometry into index

index.glin_insert(insert_tuple, "z", cell_xmin,cell_ymin, cell_x_intvl, cell_y_intvl, piece_limit, pieces);

  • Parameters

    • insert_tuple: A tuple of to-be-inserted-Geometry and its MBR std::tuple<geos::geom::Geometry*, geos::geom::Envelope*>
    • space-filling-curve : z-order-filling-curve
    • cell_xmin: the minimal value of x in a geometry, for real-world data, set cell_xmin = -180
    • cell_ymin: the minimal value of y in a geometry, for real-world data, set cell_ymin = -180
    • cell_x_intvl, cell_y_intvl:: a small enough value is valid for all data, by default we set to 0.0000005, but it is tunable parameter
    • piece_limit: piece_limitation
    • pieces: vector of piecewise function. If the user does not choose PIECEWISE setting, this value is empty.
  • Delete geometry from index

    int num_erase = index.erase(poly, "z", cell_xmin,cell_ymin, cell_x_intvl, cell_y_intvl, piecelimitation, pieces);

  • Parameters:
    • poly: A to-be-remove geometry
    • space-filling-curve : z-order-filling-curve
    • cell_xmin: the minimal value of x in a geometry, for real-world data, set cell_xmin = -180
    • cell_ymin: the minimal value of y in a geometry, for real-world data, set cell_ymin = -180
    • cell_x_intvl, cell_y_intvl:: a small enough value is valid for all data, by default we set to 0.0000005, but it is tunable parameter
    • piece_limit: piece_limitation
    • pieces: vector of piecewise function. If the user does not choose PIECEWISE setting, this value is empty.
    • This function return a number of record are erased

Example can be found at unittest_glin.h and unittest_glin_maintenance.h

glin's People

Contributors

jiayuasu avatar junowang avatar pwrliang avatar

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.