Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Add built-in filter function for every Avro class #13

Closed
kostja opened this issue Jan 26, 2018 · 5 comments
Closed

Add built-in filter function for every Avro class #13

kostja opened this issue Jan 26, 2018 · 5 comments
Assignees
Milestone

Comments

@kostja
Copy link

kostja commented Jan 26, 2018

like()
regexp()

<
or
and

@Totktonada
Copy link
Member

Plan:

  • parsing of a filter (string or input object?)
  • pcre
  • eq, ne, lt, gt, le, ge
  • and, or, not
  • speedup using indexes

@Totktonada
Copy link
Member

More from #43:

  • IS NULL / IS NOT NULL

@Totktonada
Copy link
Member

Totktonada commented Feb 16, 2018

More from #39:

  • [maybe] Support for nested filtering by connection_name.field_name.

@Totktonada
Copy link
Member

Sink down to prio2 since PCRE support was extracted to #73.

@Totktonada Totktonada removed their assignment Mar 27, 2018
@Totktonada Totktonada added this to the 0.0.1 milestone Apr 17, 2018
@Totktonada Totktonada modified the milestones: 0.0.1, 0.0.2 Jul 10, 2018
@Totktonada
Copy link
Member

Syntax

C-style expressions. Field names (dot-separated for inner fields) of a current
object can be used. Variables can be used.

Grammar

TBD.

Overview

Create AST using lulpeg in the compile phase, save it in a query AST.

Set an usage flag for variables in use (to avoid an error re non-used
variable).

Pass the AST to accessor_general within extra arguments. Implement a tuple
filtering according by the AST in process_tuple.

If no index is found based on filters, offset or from a connection (see
get_index_name), then it is worth to use the AST to perform index search.
Basically we need to collect all always-checked predicates (maybe it worth to
construct CNF?): ones that are not under OR operator. Then prioritize it:
equality first, then less-great. Then attempt to match each predicate against
existing indexes (by a name of the field it operates on). When a match found,
then rewrite AST to avoid redundant operations in process_tuple (remove the
operation that will be performed by an index).

The approach above is very-very basic and cannot handle many cases. But I
think it is on optimal point between efficiency and simplicity for now.

Follow ups

Type checking

Each operation argument should have set of allowed types. Say, 'number' for a
+, -, <, >, 'boolean' for ||, &&, !, 'number' and 'string' for == and != as
well as a type of result.

A root expression must have the boolean type, because it will be used as the
predicate todecided whether an object should be filtered in.

It seems that we should take care of nullability of a type: say, regexp will
not work with null as an argument, but is_null will do.

Functions

E. g. regexp(<pattern: string expr>, ).

IS NULL / IS NOT NULL operations

is_null()
is_not_null()

Hollow111 added a commit to Hollow111/graphql that referenced this issue Sep 3, 2018
Hollow111 added a commit to Hollow111/graphql that referenced this issue Sep 12, 2018
Implement c-style filter expressions for graphql objects. Introduced
module containing parser and executor for them.

Needed for tarantool#13
Hollow111 added a commit to Hollow111/graphql that referenced this issue Sep 12, 2018
Hollow111 added a commit to Hollow111/graphql that referenced this issue Sep 12, 2018
Hollow111 added a commit to Hollow111/graphql that referenced this issue Sep 12, 2018
Implement c-style filter expressions for graphql objects. Introduced
module containing parser and executor for them.

Needed for tarantool#13
Hollow111 added a commit to Hollow111/graphql that referenced this issue Sep 12, 2018
Implement c-style filter expressions for graphql objects. Introduced
module containing parser and executor for them.

Needed for tarantool#13
Totktonada added a commit that referenced this issue Sep 13, 2018
Totktonada added a commit that referenced this issue Sep 13, 2018
Totktonada pushed a commit that referenced this issue Sep 13, 2018
Totktonada pushed a commit that referenced this issue Sep 13, 2018
Implement c-style filter expressions for graphql objects. Introduced
module containing parser and executor for them.

Needed for #13
Totktonada added a commit that referenced this issue Sep 13, 2018
Totktonada added a commit that referenced this issue Sep 13, 2018
Totktonada added a commit that referenced this issue Sep 13, 2018
Totktonada added a commit that referenced this issue Sep 13, 2018
Hollow111 added a commit to Hollow111/graphql that referenced this issue Sep 14, 2018
Implement c-style filter expressions for graphql objects. Introduced
executor into expressions module. Moved regexp implementation into
utils.lua.

Needed for tarantool#13
Totktonada added a commit that referenced this issue Sep 14, 2018
Totktonada pushed a commit to Hollow111/graphql that referenced this issue Sep 14, 2018
Totktonada pushed a commit to Hollow111/graphql that referenced this issue Sep 14, 2018
Implement c-style filter expressions for graphql objects. Introduced
executor into expressions module. Moved regexp implementation into
utils.lua.

Needed for tarantool#13
Totktonada added a commit that referenced this issue Sep 14, 2018
…sions

graphql: implement c-style expressions parser
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants