libAtoms / abcd

1 stars 4 forks source link

Function/arithmetic expressions in queries #75

Open fekad opened 4 years ago

fekad commented 4 years ago

The idea is that such Functions/arithmetic expressions can only be calcualted on-the-fly during the queries:

functions:

arithmetics:

mixture:

Possible solution:

  1. It is relatively easy to parse the query but is way more difficult to compile it into an eg.: mongo query. One possible solution is to precalculate and store them in some kind of cache for all the expressions. In this case, the reconstructed query itself contains regular terms only. (Note: the cache may need to be cleaned occasionally)

  2. Another possible way is the usage of the exec command. A snippet of python code generates a new property which is directly queriable. This could be the return value of (multiple) simple or (few) complex expression.

Note: The first option could provide better performance if the precalculation can happen within the mongo framework (JAVA) but it takes huge development effort to implement it. If the precalculation part happens in Python the two methods have the same performance.

fekad commented 4 years ago

Decision: although the grammar still contains all the features, but their implementation will raise an error because right now there is a new alternative way to use complex queries (#79).

gabor1 commented 3 years ago

79 partly helps this in the meantime