Hi,
I noticed that it's possible to use eval(<field>) instead of eval(<expression>) to evaluate an expression stored in <field> value. Although this is not mentioned in documentation, this feature is extremely useful in my case.
However, after running a small test case (bellow), I noticed that when having multiple records, the behavior is a bit odd. The expression appears to be only parsed once from whichever record comes first, and then evaluated for all records.
Is this a potential defect, or a performance decision? Are there any plans to support a more dynamic eval() with expressions in fields?
I am using latest OrientDB 2.1.10 GA Community Edition
Thanks.
========
Test Case:
========
orientdb {db=ylg-test1}> INFO CLASS TestClass1
CLASS 'TestClass1'
Super classes........: [V]
Default cluster......: testclass1 (id=30)
Supported clusters...: testclass1(30)
Cluster selection....: round-robin
Oversize.............: 0.0
PROPERTIES
-------------------------------+------------------+-------------------------------------+---------------------+------------------+----------------+-------------+-----------+----------------+
NAME | TYPE | LINKED TYPE/CLASS | MANDATORY | READONLY | NOT NULL | MIN | MAX | COLLATE |
-------------------------------+------------------+-------------------------------------+---------------------+------------------+----------------+-------------+-----------+----------------+
b | STRING | null | false | false | false | | | default |
a | STRING | null | false | false | false | | | default |
-------------------------------+------------------+------------------------------------+----------------------+------------------+----------------+-------------+-----------+----------------+
orientdb {db=ylg-test1}> SELECT a, b, eval(b) FROM TestClass1
----+-------------+----+--------------+----
# |@CLASS|a |b |eval
----+-------------+----+--------------+----
0 |null |5 |a + 3 |8
1 |null |7 |3 + 2 + a |10 <------- expected: 12
2 |null |7 |3 |10 <------- expected: 3
----+-------------+----+--------------+----
3 item(s) found. Query executed in 0.01 sec(s).