Skip to content

Commit 3a6d0ae

Browse files
author
Senthil Nathan
committed
Changes done for v1.0.8.
1 parent 1572450 commit 3a6d0ae

File tree

3 files changed

+69
-8
lines changed

3 files changed

+69
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changes
22

3+
## v1.0.8
4+
* May/23/2021
5+
* Added more commentary and fixed a few typos.
6+
37
## v1.0.7
48
* May/05/2021
59
* Made all C++ functions as inline.

impl/include/eval_predicate.h

Lines changed: 64 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/*
88
============================================================
99
First created on: Mar/05/2021
10-
Last modified on: May/05/2021
10+
Last modified on: May/23/2021
1111
1212
This toolkit's public GitHub URL:
1313
https://github.com/IBMStreams/streamsx.eval_predicate
@@ -100,6 +100,13 @@ So, I took a fresh approach to write this new eval_predicate function
100100
with my own ideas along with sufficient commentary to explain the logic.
101101
That obviously led to implementation and feature differences between
102102
the built-in evalPredicate and my new eval_predicate in this file.
103+
As this toolkit evolved from start to finish, it ended up with
104+
very good features needed to make it as a great rule processing
105+
engine within the IBM Streams product. If positioned properly,
106+
this can be a huge difference maker for IBM Streams in the
107+
competitive marketplace. It will also help customers and partners
108+
to create useful and powerful custom rule processors for many
109+
use cases in different business domains.
103110
============================================================
104111
*/
105112
#ifndef FUNCTIONS_H_
@@ -120,7 +127,8 @@ the built-in evalPredicate and my new eval_predicate in this file.
120127
#include <tr1/unordered_map>
121128

122129
// ====================================================================
123-
// All the constants are defined here.
130+
// All the constants are defined here. It covers all the
131+
// error codes returned by the eval_predicate function.
124132
#define ALL_CLEAR 0
125133
#define EMPTY_EXPRESSION 1
126134
#define MISSING_OPEN_TUPLE_TAG 2
@@ -283,6 +291,8 @@ namespace eval_predicate_functions {
283291
// have a full evaluation plan made ready for use whenever
284292
// needed. That will allow us to evaluate a given expression string
285293
// using a readily available evaluation plan by executing its steps.
294+
// In essence, it is a blueprint that defines the expression evaluation plan.
295+
//
286296
// Following is the class that represents the evaluation plan for a
287297
// given expression. In this class, we store the data structures
288298
// required to evaluate each subexpression present within a given
@@ -346,11 +356,29 @@ namespace eval_predicate_functions {
346356

347357
private:
348358
// Private member variables.
359+
// The entire user given expression is stored in this variable.
349360
rstring expression;
361+
362+
// The schema literal for the tuple associated with a fully
363+
// validated expression is stored in this variable.
350364
rstring tupleSchema;
365+
366+
// This map contains the details about the different
367+
// subexpressions present in a fully validated expression.
368+
// It is important to understand the structure of this map which
369+
// is explained in great detail throughout this file.
370+
// One such explanation is available around line 635 of this file.
351371
SPL::map<rstring, SPL::list<rstring> > subexpressionsMap;
372+
373+
// This list provides the subexpression map keys in sorted order.
352374
SPL::list<rstring> subexpressionsMapKeys;
375+
376+
// This map contains the logical operators used within a subexpression.
377+
// Key for this map is the subexpression id and the value is the logical operator.
353378
SPL::map<rstring, rstring> intraNestedSubexpressionLogicalOperatorsMap;
379+
380+
// This list contains the logical operators used in between
381+
// different subexpressions present in a user given expression string.
354382
SPL::list<rstring> interSubexpressionLogicalOperatorsList;
355383
};
356384

@@ -423,7 +451,7 @@ namespace eval_predicate_functions {
423451
void performCollectionSizeCheckEvalOperations(int32 const & lhsSize,
424452
int32 const & rhsInt32, rstring const & operationVerb,
425453
boolean & subexpressionEvalResult, int32 & error);
426-
// Perform relational or arithmetic eval operatios.
454+
// Perform relational or arithmetic eval operations.
427455
template<class T1>
428456
void performRelationalOrArithmeticEvalOperations(T1 const & lhsValue,
429457
T1 const & rhsValue, rstring const & operationVerb,
@@ -488,7 +516,6 @@ namespace eval_predicate_functions {
488516
SPL::map<rstring, rstring> const & tupleAttributesMap,
489517
SPL::list<rstring> const & attributeNameLayoutList,
490518
T1 const & myTuple, T2 & value, int32 & error, boolean trace);
491-
492519
// ====================================================================
493520

494521
// Evaluate a given expression.
@@ -602,7 +629,7 @@ namespace eval_predicate_functions {
602629
}
603630

604631
// If trace is enabled let us do the introspection of the
605-
// user provided tuple and display its sttribute names and values.
632+
// user provided tuple and display its attribute names and values.
606633
traceTupleAtttributeNamesAndValues(myTuple, tupleAttributesMap, trace);
607634

608635
// Note: The space below between > > is a must. Otherwise, compiler will give an error.
@@ -740,7 +767,7 @@ namespace eval_predicate_functions {
740767
} // End of the else block.
741768

742769
// We have a valid iterator from the eval plan cache for the given expression.
743-
// We can go ahead execute the evaluation plan now.
770+
// We can go ahead and execute the evaluation plan now.
744771
SPLAPPTRC(L_TRACE, "Begin timing measurement 4", "ExpressionEvaluation");
745772
// We are making a non-recursive call.
746773
result = evaluateExpression(it->second, myTuple, error, trace);
@@ -1022,7 +1049,7 @@ namespace eval_predicate_functions {
10221049

10231050
// The attribute name of this nested tuple is just after the
10241051
// close angle bracket where we are at now. Let us parse that tuple name.
1025-
// Let us locate either the comma or an angle bracket after thetuple name.
1052+
// Let us locate either the comma or an angle bracket after the tuple name.
10261053
int32 idx3 = -1;
10271054

10281055
for(int x=idx2+1; x<stringLength; x++) {
@@ -10181,3 +10208,33 @@ namespace eval_predicate_functions {
1018110208
// ====================================================================
1018210209

1018310210
#endif
10211+
10212+
/*
10213+
==================================================================
10214+
Coda
10215+
----
10216+
Whatever lies ahead for IBM Streams beyond June/2021, I'm proud to
10217+
have played a key role in this product team from 2007 to 2021.
10218+
IBM Streams gave me so many marvelous opportunities to create
10219+
amazing extensions, build cutting edge streaming analytics solutions,
10220+
coach/train top notch customers and co-create meaningful
10221+
production-ready software assets for such customers. It formed the
10222+
best period in my 36 years of Software career thus far. I'm lucky to
10223+
get a chance to build this toolkit as my final official project for
10224+
IBM Streams. That too for meeting a critical business need of a
10225+
prestigious customer in the semiconductor manufacturing industry.
10226+
This particular toolkit is technically challenging and
10227+
super interesting. I'm glad that it serves as a bookend for my
10228+
technical contributions to the incomparable IBM Streams. I'm hopeful
10229+
that I will get another chance to associate with this wonderful
10230+
product as it finds a new home soon either inside or outside of IBM.
10231+
Until then, I will continue to reminisce this unforgettable journey
10232+
made possible by passionate researchers, engineers and managers who
10233+
are all simply world class in their talent and camaraderie.
10234+
10235+
Long live IBM Streams.
10236+
10237+
Yours truly,
10238+
SN
10239+
==================================================================
10240+
*/

info.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<info:identity>
55
<info:name>eval_predicate</info:name>
66
<info:description>Toolkit for user defined rule (expression) processing</info:description>
7-
<info:version>1.0.7</info:version>
7+
<info:version>1.0.8</info:version>
88
<info:requiredProductVersion>4.2.1.6</info:requiredProductVersion>
99
</info:identity>
1010
<info:dependencies/>

0 commit comments

Comments
 (0)