# Join inner result check

`join-inner-result-check` · version 1.0.0 · Numbers & math · free, no key needed

Check a claimed ordered inner join index result and report its first discrepancy.

**Use when you need to: check claimed inner join result · validate ordered inner join pairs · find first wrong inner join row.**

## Decide before calling

Read the [versioned contract](/v1/tools/join-inner-result-check/versions/1.0.0) and the supported scope below. Reuse `join-inner-result-check@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `join-inner-result-check@1.0.0` for check claimed inner join result. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- check claimed inner join result
- validate ordered inner join pairs
- find first wrong inner join row
- audit inner join output certificate
- verify duplicate-key inner join order
- compare claimed inner join indices

## Not supported

- compute or return a replacement joined table
- evaluate arbitrary SQL predicates or expressions
- coerce key types or treat nulls as equal

## Behavior

- Rows are compared by own-property keys; key values are null, strings, booleans, or exact JSON safe integers. No coercion occurs. Null never matches, including null against null.
- Nested-loop order is deterministic: ascending left index, then ascending right index. Duplicates produce distinct pairs. LEFT emits one null right index for an unmatched left row; SEMI emits each matching left index once.
- claimed_rows is a certificate, not row data: inner/left entries identify source pairs; semi entries identify source left rows. The first missing, unequal, or extra entry is reported and the claim is never repaired.
- Input objects must be ordinary plain objects with own properties. Unknown fields, inherited/prototype-polluted objects, missing join keys, unsupported key types, non-safe integers, and out-of-range certificate indices are invalid_input.
- Reference version: ISO/IEC 9075-2:2023 §7.7 + deep24 deterministic-order profile 1.0.0.

## Input

- `left_rows` (array of object, required): max items 200
- `right_rows` (array of object, required): max items 200
- `left_key` (string, required): min length 1; max length 64
- `right_key` (string, required): min length 1; max length 64
- `claimed_rows` (array of object, required): max items 40000

## Output

- `valid` (boolean, required)
- `reason` (one of "result_mismatch", null, required)
- `discrepancy` (null or object, required)
- `reference_version` (constant "ISO/IEC 9075-2:2023 §7.7 + deep24 deterministic-order profile 1.0.0", required)

## Limits

- max left rows: 200
- max right rows: 200
- max claimed rows: 40000
- max comparisons: 40000
- max key chars: 64
- max input bytes: 1048576

## Example

Request input:

```json
{
  "left_rows": [
    {
      "id": 1
    },
    {
      "id": 2
    }
  ],
  "right_rows": [
    {
      "id": 2
    },
    {
      "id": 2
    }
  ],
  "left_key": "id",
  "right_key": "id",
  "claimed_rows": [
    {
      "left_index": 1,
      "right_index": 0
    },
    {
      "left_index": 1,
      "right_index": 1
    }
  ]
}
```

Response:

```json
{
  "result": {
    "valid": true,
    "reason": null,
    "discrepancy": null,
    "reference_version": "ISO/IEC 9075-2:2023 §7.7 + deep24 deterministic-order profile 1.0.0"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "join-inner-result-check",
  "version": "1.0.0",
  "input": {
    "left_rows": [
      {
        "id": 1
      },
      {
        "id": 2
      }
    ],
    "right_rows": [
      {
        "id": 2
      },
      {
        "id": 2
      }
    ],
    "left_key": "id",
    "right_key": "id",
    "claimed_rows": [
      {
        "left_index": 1,
        "right_index": 0
      },
      {
        "left_index": 1,
        "right_index": 1
      }
    ]
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/join-inner-result-check/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"left_rows":[{"id":1},{"id":2}],"right_rows":[{"id":2},{"id":2}],"left_key":"id","right_key":"id","claimed_rows":[{"left_index":1,"right_index":0},{"left_index":1,"right_index":1}]}'
```

The machine-readable contract is at [/v1/tools/join-inner-result-check/versions/1.0.0](/v1/tools/join-inner-result-check/versions/1.0.0).

### CLI

```sh
node cli.mjs run join-inner-result-check 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Join left result check](/tools/join-left-result-check): Check a claimed ordered left join index result and report its first discrepancy.
- [Join semi result check](/tools/join-semi-result-check): Check a claimed ordered semi-join index result and report its first discrepancy.
- [Dedupe first check](/tools/dedupe-first-check): Check an exact first-wins SameValueZero deduplication claim and report its first discrepancy.
- [Dedupe keyed check](/tools/dedupe-keyed-check): Check an exact keyed Map deduplication claim and report its first discrepancy.
- [Dedupe last check](/tools/dedupe-last-check): Check an exact last-wins SameValueZero deduplication claim and report its first discrepancy.
- [Permutation indices check](/tools/permutation-indices-check): Check whether claimed indices are exactly one occurrence of every source index, reporting the first discrepancy.
