adding documentation for predicate processing protocol

This commit is contained in:
Mark Wolters committed 2025-03-04 11:00:36 -05:00
1 parent 7c37f30374
commit 9b3bb6d161
1 file changed
+18
@@ -0,0 +1,18 @@
| size in bytes | Description | Values | Notes |
|----------------------------------------------|--------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------|
| 1 | Type | 0 = PRED<br>1 = AND<br>2 = OR | |
| 1 | Number of child nodes | (byte) int <= 127 | Only present if TYPE != PRED |
| | <I><B>Predicate Fields | | <I>The following fields represent the values associated with a single predicate. Multiple predicates may apply to a single query. |
| 1 | Enumerated value for predicate field | (byte) int <= 127<br>for whole predicate (byte) -1 | This is the name of the column or field the predicate is being applied to, e.g.<br>0=company<br>1=division<br>2=market<br> |
| 1 | Predicate condition operator | 0 = GREATER THAN<br>1 = LESS THAN<br>2 = EQUAL TO<br>3 = NOT EQUAL TO<br>4 = GREATER THAN OR EQUAL TO<br>5 = LESS THAN OR EQUAL TO<br>6 = IN | |
| 2 | \# of comparator values | (short) int < 127 | |
| ((size of long) \* <# of comparator values>) | comparator value(s) | Any valid integer value | For IN condition this will include multiple values. For any other operator this is a single numeric |
<B>EXAMPLES</B>
| Predicate Statement | Binary Encoding | [B=binary(1) H=short int(2) Q=long int(8)] |
| ----------------------------------------------------- | ---------------------------------------------------------------- | ------------------------------------------ |
| company = 7 | [0, 0, 2, 1, 7] | packed: BBBHQ length 13 |
| division IN (1,3,5) | [0, 1, 6, 3, 1, 3, 5] | packed: BBBHQQQ length 29 |
| market = 10 OR company = 13 | [2, 2, 0, 2, 2, 1, 10, 0, 0, 2, 1, 13] | packed: BBBBBHQBBBHQ length 28 |
| company = 12 AND (division IN (11,13) OR market = 15) | [1, 2, 0, 0, 2, 1, 12, 2, 2, 0, 1, 6, 2, 11, 13, 0, 2, 2, 1, 15] | packed: BBBBBHQBBBBBHQQBBBHQ length 51 |