dbt-labs/dbt-core · error

Table.join

Error message

Table.join: {e}

What it means

Generic wrapper around any error produced while materializing the join result in Table.join: the Arrow `take` (gather) with the left/right row-index selection vectors, or RecordBatch construction from the two tables, failed. The underlying Arrow/DataFusion error is re-tagged with the Table.join context; the real cause is in {e}.

Solutions

  1. Read the embedded {e} text to identify the actual Arrow failure (usually incompatible schemas between the two tables)
  2. Ensure the joined tables have compatible column types on the key columns
  3. Inspect the two RecordBatches passed to to_record_batch() for schema drift
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at crates/dbt-agate/src/join.rs:291 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07). Data as JSON: /api/errors/460e7777235543ec. Report an issue: GitHub.

Appendix: source

Thrown at crates/dbt-agate/src/join.rs:291

        // Use take (aka gather, select) with the selection vectors produced above
        // to materialize the joined result set.
        let left_row_indices = joined_rows
            .iter()
            .map(|&(left_row_idx, _)| left_row_idx.map(|idx| idx as u64))
            .collect::<UInt64Array>();
        let right_row_indices = joined_rows
            .iter()
            .map(|&(_, right_row_idx)| right_row_idx.map(|idx| idx as u64))
            .collect::<UInt64Array>();

        let left_batch = self.to_record_batch();
        let right_batch = right_table.to_record_batch();
        let mut fields =
            Vec::with_capacity(left_batch.num_columns() + right_projection_columns.len());
        let mut arrays = Vec::with_capacity(fields.capacity());
        let gather = |array: &ArrayRef, indices: &UInt64Array| {
            arrow::compute::take(array.as_ref(), indices, None)
                .map_err(|e| Error::new(ErrorKind::InvalidOperation, format!("Table.join: {e}")))
        };

        for (i, field) in left_batch.schema_ref().fields().iter().enumerate() {
            // unmatched right rows make every left column nullable
            fields.push(field.as_ref().clone().with_nullable(true));
            arrays.push(gather(left_batch.column(i), &left_row_indices)?);
        }
        // ```python
        //         if name in self.column_names:
        //             column_names.append('%s2' % name)
        //         else:
        //             column_names.append(name)
        // ```
        for &i in &right_projection_columns {
            let field = right_batch.schema_ref().field(i);
            let name = if self.column_names_iter().any(|n| n == field.name()) {
                format!("{}2", field.name())
            } else {

View on GitHub (pinned to 0267ce9170)