class JoinNode extends PlanNode {

  @Override
  void validateKeyPresent(final SourceName sinkName, final Projection projection) {

    final boolean atLeastOneKey = joinKey.getAllViableKeys(schema).stream()
        .anyMatch(projection::containsExpression);

    if (!atLeastOneKey) {
      final boolean synthetic = joinKey.isSynthetic();
      final List<? extends Expression> viable = joinKey.getOriginalViableKeys(schema);

      throwKeysNotIncludedError(sinkName, "join expression", viable, false, synthetic);
    }
  }

  public  JoinNode(
      final PlanNodeId id,
      final JoinType joinType,
      final JoinKey joinKey,
      final boolean finalJoin,
      final PlanNode left,
      final PlanNode right,
      final Optional<WithinExpression> withinExpression
  );

}