Record Equijoin Cardinality Counter
Count exact typed-scalar equijoin pairs with full duplicate multiplicity; absent members do not join, explicit null values can join.
Description
Count exact typed-scalar equijoin pairs with full duplicate multiplicity; absent members do not join, explicit null values can join.
Duplicate join keys can multiply the rows produced by an equality join. Cardinality estimates expose that expansion without materializing the joined records.
When to use this tool
Count exact typed-scalar equijoin pairs with full duplicate multiplicity; absent members do not join, explicit null values can join.
- Prepare the supplied leftRecordsJson, rightRecordsJson, leftKey, rightKey fields for this operation.
- Compare the complete example with the representation used by your own input before carrying the result into another step.
How to use the tool and how it works
- Enter leftRecordsJson, rightRecordsJson, leftKey, rightKey. Use the exact text syntax, units and index conventions explained below.
- Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
- Read result.matchingPairCount, result.rightMatchCountsPerLeft. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.
For every left record with its key present, count right records with an equal typed scalar key. Return those per-left counts and their sum as the matching-pair count.1
| Input field | Meaning and representation | Accepted input |
|---|---|---|
| leftRecordsJson | JSON text, entered as one text field. The decoded structure is illustrated below; it is not a separate file. | Text |
| rightRecordsJson | JSON text, entered as one text field. The decoded structure is illustrated below; it is not a separate file. | Text |
| leftKey | left key. | Text; at most 8,192 UTF-16 code units, subject to the grammar above |
| rightKey | right key. | Text; at most 8,192 UTF-16 code units, subject to the grammar above |
For the JSON text fields, the following decoded structures show the example records before they are serialized into input strings. Keep field names, list nesting and value types as shown.
[
{
"field": "leftRecordsJson",
"decoded": [
{
"id": 1
},
{
"id": 1
}
]
},
{
"field": "rightRecordsJson",
"decoded": [
{
"key": 1
},
{
"key": 1
}
]
}
] | Output field | Interpretation |
|---|---|
| result | Object containing the named outputs below. |
| result.matchingPairCount | The matching pair count value under the stated formula or text convention. |
| result.rightMatchCountsPerLeft | The right match counts per left list in the ordering and representation described above. |
{
"input": {
"leftRecordsJson": "[{\"id\":1},{\"id\":1}]",
"rightRecordsJson": "[{\"key\":1},{\"key\":1}]",
"leftKey": "id",
"rightKey": "key"
},
"output": {
"result": {
"matchingPairCount": 4,
"rightMatchCountsPerLeft": [
2,
2
]
}
}
} Limitations and assumptions
- Missing keys contribute no matches; null can match null. This describes an inner equality join's pair count, not a left join's final row count or a joined table.
- Decoded JSON is bounded to 20,000 nodes and 32 nesting levels; record arrays have at most 128 records. Parsed number values use JavaScript floating point rather than arbitrary-precision decimal arithmetic.
- Every declared top-level field is required and unexpected fields are rejected. Numeric inputs must be finite; ordinary text fields are bounded to 8,192 UTF-16 code units, with tighter operation-specific limits where stated.
- Ordinary string lists have at most 128 entries of at most 128 code units each; numeric lists and matrices have separate bounded size checks. Nonfinite results and excessively large serialized outputs are rejected.
- Indexes are zero-based and spans have an exclusive end unless explicitly stated otherwise. A valid false, null or empty-list result is distinct from malformed input.
Alternative or Complementary methods
For document-wide requirements, combine these structural inventories with an explicit JSON Schema. Preserve the distinction between missing properties and null values, and between numbers and numeric-looking strings when building joins or indexes.
References
Similar or alternative tools
- Record Left Anti Join Tool
Return left records without an exact typed-scalar right-key match, retaining absent left-key records and source indexes.
- Record Array Unique Key Indexer
Build a unique typed-scalar record index as entries; numeric and string keys remain distinct, missing and duplicate keys fail.