GraphScope icon indicating copy to clipboard operation
GraphScope copied to clipboard

feat (interactive): Migrating Gremlin compilation into the `Calsite`-based IR layer

Open longbinlai opened this issue 2 years ago • 2 comments

The GIE IR layer is re-factored based on Calsite, which has now been used to compile the Cypher language into multiple runtime. However, the compilation of Gremlin is still in the pre-IR route, making the dual-language support of GIE in an inconsistent state, and the Gremlin path can not benefit from the on-going developing features of IR, including new optimization rules.

It's now ready to initiate the migration.

longbinlai avatar Aug 23 '23 08:08 longbinlai

The following operators have currently been supported for conversion from syntax to Graph Relational: graph:

  • V()
  • E()
  • outE
  • inE()
  • bothE()
  • out() (include path_expand)
  • in()
  • both()
  • inV()
  • outV()
  • otherV()
  • endV()

filter:

  • hasLabel
  • hasId
  • hasNot
  • has supported gremlin predicates:
    • eq
    • neq
    • gt
    • gte
    • lt
    • lte
    • and
    • or
    • within
    • without
    • containing
    • notContaining
    • startingWith
    • notStartingWith
    • endingWith
    • notEndingWith
    • not
    • inside
    • outside

Project:

  • values
  • valueMap
  • elementMap
  • select (exclude apply)

shirly121 avatar Sep 27 '23 05:09 shirly121

Todo List: Support for other Syntax to Graph Relational conversion:

  • [x] order
  • [x] limit
  • [x] dedup
  • [x] groupBy
  • [x] union
  • [x] match
  • [x] expr
  • [x] subtask
  • [ ] subgraph

在原先gremlin链路新支持的功能:

  • [ ] until and more path_opt in path_expand
  • [ ] sample
  • [ ] unfold

Support for Graph Relational to IR Core conversion:

  • [ ] support nested map : select('a', 'b').by(valueMap(..))

  • [x] index predicate Allowing within operator in index predicate to support queries like g.V().hasId(1,2,3)

  • [x] MAP_VALUE_CONSTRUCTOR
    Further expand the implementation of varMap operator

  • [x] POSIX_REGEX_CASE_SENSITIVE To support startingWith/endingWith/containing/regex

  • [x] SEARCH SEARCH and Sarg in Calcite are used to represent a value within a continuous or discrete interval, which need to be further unified with the current ir core structure. For example:

      has('age', within(17, 20)) -> SEARCH(DEFAULT.age, Sarg[17, 20])
      has('age', without(17, 20)) -> SEARCH(DEFAULT.age, Sarg[(-∞..17), (17..20), (20..+∞)])
    
      has('age', inside(17, 20)) -> SEARCH(DEFAULT.age, Sarg[[18..19]])
      has('age', outside(17, 20)) -> SEARCH(DEFAULT.age, Sarg[(-∞..18), (19..+∞)])
    

shirly121 avatar Sep 27 '23 05:09 shirly121