Repository: great-expectations/great_expectations

Issue:
[BUG] unexpected_indices cannot be returned without 'unexpected_index_column_names'
**Describe the bug**
Without changing anything, the upgrade from 0.15.47 to 0.15.48 results in this error as shown
<img width="1394" alt="image" src="https://user-images.githubusercontent.com/51312880/218242507-f2986f77-8ed6-4ec4-89de-996c28811ee2.png">

This is due to the fact im using column pair expectations and maybe with the recent id/pk with spark?
<img width="333" alt="image" src="https://user-images.githubusercontent.com/51312880/218242614-ea274122-23ca-4b09-beb4-2a241034232d.png">


Whether i have this  (with result_format)
<img width="784" alt="image" src="https://user-images.githubusercontent.com/51312880/218242533-b0507e3b-c397-4061-bd4a-98841397f51d.png">

or  (without result_format)
<img width="814" alt="image" src="https://user-images.githubusercontent.com/51312880/218242565-1c03a48c-8768-4eff-b94d-85bcf185f8d8.png">

which my checkpoint is default to this
<img width="263" alt="image" src="https://user-images.githubusercontent.com/51312880/218242584-c10e8ba6-4065-442f-85ab-7f42eecc1e81.png">


it shows up with this error

**To Reproduce**


4. See error
<img width="1394" alt="image" src="https://user-images.githubusercontent.com/51312880/218242507-f2986f77-8ed6-4ec4-89de-996c28811ee2.png">


**Expected behavior**
This error would not have shown (for all the pass test case) and for failed test case, the ID/PK feature that would have been activated

**Environment (please complete the following information):**
 - Operating System: [e.g. Linux, MacOS, Windows] Mac
 - Great Expectations Version: [e.g. 0.13.2] 0.15.48

**Additional context**
Add any other context about the problem here.



Discussion:
Hi @data-han - thanks for raising this. We will review and be in touch.

Resolving patch:
diff --git a/great_expectations/expectations/expectation.py b/great_expectations/expectations/expectation.py
--- a/great_expectations/expectations/expectation.py
+++ b/great_expectations/expectations/expectation.py
@@ -77,8 +77,6 @@
 )
 from great_expectations.execution_engine import (
     ExecutionEngine,
-    PandasExecutionEngine,
-    SparkDFExecutionEngine,
     SqlAlchemyExecutionEngine,
 )
 from great_expectations.expectations.registry import (
@@ -2765,64 +2763,33 @@ def get_validation_dependencies(
         if result_format_str in ["BASIC"]:
             return validation_dependencies
 
-        # only for SUMMARY and COMPLETE
-        if isinstance(execution_engine, PandasExecutionEngine):
-            metric_kwargs = get_metric_kwargs(
-                metric_name=f"{self.map_metric}.{SummarizationMetricNameSuffixes.UNEXPECTED_INDEX_LIST.value}",
-                configuration=configuration,
-                runtime_configuration=runtime_configuration,
-            )
-            validation_dependencies.set_metric_configuration(
+        metric_kwargs = get_metric_kwargs(
+            metric_name=f"{self.map_metric}.{SummarizationMetricNameSuffixes.UNEXPECTED_INDEX_LIST.value}",
+            configuration=configuration,
+            runtime_configuration=runtime_configuration,
+        )
+        validation_dependencies.set_metric_configuration(
+            metric_name=f"{self.map_metric}.{SummarizationMetricNameSuffixes.UNEXPECTED_INDEX_LIST.value}",
+            metric_configuration=MetricConfiguration(
                 metric_name=f"{self.map_metric}.{SummarizationMetricNameSuffixes.UNEXPECTED_INDEX_LIST.value}",
-                metric_configuration=MetricConfiguration(
-                    metric_name=f"{self.map_metric}.{SummarizationMetricNameSuffixes.UNEXPECTED_INDEX_LIST.value}",
-                    metric_domain_kwargs=metric_kwargs["metric_domain_kwargs"],
-                    metric_value_kwargs=metric_kwargs["metric_value_kwargs"],
-                ),
-            )
-            metric_kwargs = get_metric_kwargs(
-                metric_name=f"{self.map_metric}.{SummarizationMetricNameSuffixes.UNEXPECTED_INDEX_QUERY.value}",
-                configuration=configuration,
-                runtime_configuration=runtime_configuration,
-            )
-            validation_dependencies.set_metric_configuration(
+                metric_domain_kwargs=metric_kwargs["metric_domain_kwargs"],
+                metric_value_kwargs=metric_kwargs["metric_value_kwargs"],
+            ),
+        )
+        metric_kwargs = get_metric_kwargs(
+            metric_name=f"{self.map_metric}.{SummarizationMetricNameSuffixes.UNEXPECTED_INDEX_QUERY.value}",
+            configuration=configuration,
+            runtime_configuration=runtime_configuration,
+        )
+        validation_dependencies.set_metric_configuration(
+            metric_name=f"{self.map_metric}.{SummarizationMetricNameSuffixes.UNEXPECTED_INDEX_QUERY.value}",
+            metric_configuration=MetricConfiguration(
                 metric_name=f"{self.map_metric}.{SummarizationMetricNameSuffixes.UNEXPECTED_INDEX_QUERY.value}",
-                metric_configuration=MetricConfiguration(
-                    metric_name=f"{self.map_metric}.{SummarizationMetricNameSuffixes.UNEXPECTED_INDEX_QUERY.value}",
-                    metric_domain_kwargs=metric_kwargs["metric_domain_kwargs"],
-                    metric_value_kwargs=metric_kwargs["metric_value_kwargs"],
-                ),
-            )
-        if isinstance(
-            execution_engine, (SparkDFExecutionEngine, SqlAlchemyExecutionEngine)
-        ):
-            if "unexpected_index_column_names" in validation_dependencies.result_format:
-                metric_kwargs = get_metric_kwargs(
-                    metric_name=f"{self.map_metric}.{SummarizationMetricNameSuffixes.UNEXPECTED_INDEX_LIST.value}",
-                    configuration=configuration,
-                    runtime_configuration=runtime_configuration,
-                )
-                validation_dependencies.set_metric_configuration(
-                    metric_name=f"{self.map_metric}.{SummarizationMetricNameSuffixes.UNEXPECTED_INDEX_LIST.value}",
-                    metric_configuration=MetricConfiguration(
-                        metric_name=f"{self.map_metric}.{SummarizationMetricNameSuffixes.UNEXPECTED_INDEX_LIST.value}",
-                        metric_domain_kwargs=metric_kwargs["metric_domain_kwargs"],
-                        metric_value_kwargs=metric_kwargs["metric_value_kwargs"],
-                    ),
-                )
-                metric_kwargs = get_metric_kwargs(
-                    metric_name=f"{self.map_metric}.{SummarizationMetricNameSuffixes.UNEXPECTED_INDEX_QUERY.value}",
-                    configuration=configuration,
-                    runtime_configuration=runtime_configuration,
-                )
-                validation_dependencies.set_metric_configuration(
-                    metric_name=f"{self.map_metric}.{SummarizationMetricNameSuffixes.UNEXPECTED_INDEX_QUERY.value}",
-                    metric_configuration=MetricConfiguration(
-                        metric_name=f"{self.map_metric}.{SummarizationMetricNameSuffixes.UNEXPECTED_INDEX_QUERY.value}",
-                        metric_domain_kwargs=metric_kwargs["metric_domain_kwargs"],
-                        metric_value_kwargs=metric_kwargs["metric_value_kwargs"],
-                    ),
-                )
+                metric_domain_kwargs=metric_kwargs["metric_domain_kwargs"],
+                metric_value_kwargs=metric_kwargs["metric_value_kwargs"],
+            ),
+        )
+
         return validation_dependencies
 
     def _validate(
diff --git a/great_expectations/expectations/metrics/map_metric_provider.py b/great_expectations/expectations/metrics/map_metric_provider.py
--- a/great_expectations/expectations/metrics/map_metric_provider.py
+++ b/great_expectations/expectations/metrics/map_metric_provider.py
@@ -2510,7 +2510,6 @@ def _sqlalchemy_map_condition_query(
     ) = metrics.get("unexpected_condition")
 
     result_format: dict = metric_value_kwargs["result_format"]
-
     # We will not return map_condition_query if return_unexpected_index_query = False
     return_unexpected_index_query: bool = result_format.get(
         "return_unexpected_index_query"
@@ -2542,14 +2541,15 @@ def _sqlalchemy_map_condition_query(
     unexpected_index_column_names: List[str] = result_format.get(
         "unexpected_index_column_names"
     )
-    for column_name in unexpected_index_column_names:
-        if column_name not in all_table_columns:
-            raise gx_exceptions.InvalidMetricAccessorDomainKwargsKeyError(
-                message=f'Error: The unexpected_index_column: "{column_name}" in does not exist in SQL Table. '
-                f"Please check your configuration and try again."
-            )
+    if unexpected_index_column_names:
+        for column_name in unexpected_index_column_names:
+            if column_name not in all_table_columns:
+                raise gx_exceptions.InvalidMetricAccessorDomainKwargsKeyError(
+                    message=f'Error: The unexpected_index_column: "{column_name}" in does not exist in SQL Table. '
+                    f"Please check your configuration and try again."
+                )
 
-        column_selector.append(sa.column(column_name))
+            column_selector.append(sa.column(column_name))
 
     for column_name in domain_column_name_list:
         column_selector.append(sa.column(column_name))
@@ -2583,7 +2583,7 @@ def _sqlalchemy_map_condition_index(
     metric_value_kwargs: Dict,
     metrics: Dict[str, Any],
     **kwargs,
-) -> List[Dict[str, Any]]:
+) -> list[dict[str, Any]] | None:
     """
     Returns indices of the metric values which do not meet an expected Expectation condition for instances
     of ColumnMapExpectation.
@@ -2597,6 +2597,10 @@ def _sqlalchemy_map_condition_index(
         accessor_domain_kwargs,
     ) = metrics.get("unexpected_condition")
 
+    result_format = metric_value_kwargs["result_format"]
+    if "unexpected_index_column_names" not in result_format:
+        return None
+
     domain_column_name_list: List[str] = list()
     # column map expectations
     if "column" in accessor_domain_kwargs:
@@ -2616,8 +2620,6 @@ def _sqlalchemy_map_condition_index(
         domain_column_name_list = column_list
 
     domain_kwargs: dict = dict(**compute_domain_kwargs, **accessor_domain_kwargs)
-    result_format: dict = metric_value_kwargs["result_format"]
-
     all_table_columns: List[str] = metrics.get("table.columns")
 
     unexpected_index_column_names: Optional[List[str]] = result_format.get(
@@ -2867,6 +2869,10 @@ def _spark_map_condition_index(
     if unexpected_condition is None:
         return None
 
+    result_format = metric_value_kwargs["result_format"]
+    if "unexpected_index_column_names" not in result_format:
+        return None
+
     domain_column_name_list: List[str] = list()
     # column map expectations
     if "column" in accessor_domain_kwargs:


Test patch:
diff --git a/tests/checkpoint/test_checkpoint_result_format.py b/tests/checkpoint/test_checkpoint_result_format.py
--- a/tests/checkpoint/test_checkpoint_result_format.py
+++ b/tests/checkpoint/test_checkpoint_result_format.py
@@ -1,5 +1,7 @@
+from __future__ import annotations
+
 import logging
-from typing import Any, Dict, List, Union
+from typing import Any, Dict, List
 
 import pandas as pd
 import pytest
@@ -10,7 +12,11 @@
     ExpectationSuiteValidationResult,
 )
 from great_expectations.core.yaml_handler import YAMLHandler
-from great_expectations.data_context.data_context.data_context import DataContext
+from great_expectations.data_context.data_context.data_context import (
+    DataContext,
+    FileDataContext,
+    AbstractDataContext,
+)
 from great_expectations.data_context.types.base import CheckpointConfig
 from great_expectations.exceptions import CheckpointError
 from great_expectations.util import filter_properties_dict
@@ -273,7 +279,7 @@ def batch_request_for_spark_unexpected_rows_and_index_multicolumn_sum(
 
 
 @pytest.fixture
-def expected_unexpected_indices_output() -> List[Dict[str, Union[str, int]]]:
+def expected_unexpected_indices_output() -> list[dict[str, str | int]]:
     return [
         {"animals": "giraffe", "pk_1": 3},
         {"animals": "lion", "pk_1": 4},
@@ -294,11 +300,11 @@ def expected_spark_query_output() -> str:
 
 
 def _add_expectations_and_checkpoint(
-    data_context: DataContext,
+    data_context: DataContext | EphemeralDataContext | FileDataContext,
     checkpoint_config: dict,
     expectations_list: List[ExpectationConfiguration],
-    dict_to_update_checkpoint: Union[dict, None] = None,
-) -> DataContext:
+    dict_to_update_checkpoint: dict | None = None,
+) -> DataContext | EphemeralDataContext | FileDataContext:
     """
     Helper method for adding Checkpoint and Expectations to DataContext.
 
@@ -336,11 +342,11 @@ def _add_expectations_and_checkpoint(
 
 @pytest.mark.integration
 def test_sql_result_format_in_checkpoint_pk_defined_one_expectation_complete_output(
-    data_context_with_connection_to_metrics_db,
-    reference_sql_checkpoint_config_for_animal_names_table,
-    expectation_config_expect_column_values_to_be_in_set,
-    expected_unexpected_indices_output,
-    expected_sql_query_output,
+    data_context_with_connection_to_metrics_db: FileDataContext,
+    reference_sql_checkpoint_config_for_animal_names_table: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
+    expected_sql_query_output: str,
 ):
     """
     What does this test?
@@ -390,11 +396,11 @@ def test_sql_result_format_in_checkpoint_pk_defined_one_expectation_complete_out
 
 @pytest.mark.integration
 def test_sql_result_format_in_checkpoint_pk_defined_one_expectation_complete_output_with_query(
-    data_context_with_connection_to_metrics_db,
-    reference_sql_checkpoint_config_for_animal_names_table,
-    expectation_config_expect_column_values_to_be_in_set,
-    expected_unexpected_indices_output,
-    expected_sql_query_output,
+    data_context_with_connection_to_metrics_db: FileDataContext,
+    reference_sql_checkpoint_config_for_animal_names_table: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
+    expected_sql_query_output: str,
 ):
     """
     What does this test?
@@ -446,9 +452,9 @@ def test_sql_result_format_in_checkpoint_pk_defined_one_expectation_complete_out
 
 @pytest.mark.integration
 def test_sql_result_format_in_checkpoint_pk_defined_column_pair_expectation_complete_output_with_query(
-    data_context_with_connection_to_metrics_db,
-    reference_sql_checkpoint_config_for_column_pairs_table,
-    expectation_config_expect_column_pair_values_to_be_equal,
+    data_context_with_connection_to_metrics_db: FileDataContext,
+    reference_sql_checkpoint_config_for_column_pairs_table: dict,
+    expectation_config_expect_column_pair_values_to_be_equal: ExpectationConfiguration,
 ):
     dict_to_update_checkpoint: dict = {
         "result_format": {
@@ -500,9 +506,9 @@ def test_sql_result_format_in_checkpoint_pk_defined_column_pair_expectation_comp
 
 @pytest.mark.integration
 def test_sql_result_format_in_checkpoint_pk_defined_column_pair_expectation_summary_output(
-    data_context_with_connection_to_metrics_db,
-    reference_sql_checkpoint_config_for_column_pairs_table,
-    expectation_config_expect_column_pair_values_to_be_equal,
+    data_context_with_connection_to_metrics_db: FileDataContext,
+    reference_sql_checkpoint_config_for_column_pairs_table: dict,
+    expectation_config_expect_column_pair_values_to_be_equal: ExpectationConfiguration,
 ):
     dict_to_update_checkpoint: dict = {
         "result_format": {
@@ -547,9 +553,9 @@ def test_sql_result_format_in_checkpoint_pk_defined_column_pair_expectation_summ
 
 @pytest.mark.integration
 def test_sql_result_format_in_checkpoint_pk_defined_multi_column_sum_expectation_complete_output_with_query(
-    data_context_with_connection_to_metrics_db,
-    reference_sql_checkpoint_config_for_multi_column_sum_table,
-    expectation_config_expect_multicolumn_sum_to_equal,
+    data_context_with_connection_to_metrics_db: FileDataContext,
+    reference_sql_checkpoint_config_for_multi_column_sum_table: dict,
+    expectation_config_expect_multicolumn_sum_to_equal: ExpectationConfiguration,
 ):
     """
     What does this test?
@@ -616,9 +622,9 @@ def test_sql_result_format_in_checkpoint_pk_defined_multi_column_sum_expectation
 
 @pytest.mark.integration
 def test_sql_result_format_in_checkpoint_pk_defined_multi_column_sum_expectation_summary_output(
-    data_context_with_connection_to_metrics_db,
-    reference_sql_checkpoint_config_for_multi_column_sum_table,
-    expectation_config_expect_multicolumn_sum_to_equal,
+    data_context_with_connection_to_metrics_db: FileDataContext,
+    reference_sql_checkpoint_config_for_multi_column_sum_table: dict,
+    expectation_config_expect_multicolumn_sum_to_equal: ExpectationConfiguration,
 ):
     dict_to_update_checkpoint: dict = {
         "result_format": {
@@ -666,10 +672,10 @@ def test_sql_result_format_in_checkpoint_pk_defined_multi_column_sum_expectation
 
 @pytest.mark.integration
 def test_sql_result_format_in_checkpoint_pk_defined_one_expectation_complete_output_no_query(
-    data_context_with_connection_to_metrics_db,
-    reference_sql_checkpoint_config_for_animal_names_table,
-    expectation_config_expect_column_values_to_be_in_set,
-    expected_unexpected_indices_output,
+    data_context_with_connection_to_metrics_db: FileDataContext,
+    reference_sql_checkpoint_config_for_animal_names_table: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     """
     What does this test?
@@ -718,11 +724,11 @@ def test_sql_result_format_in_checkpoint_pk_defined_one_expectation_complete_out
 
 @pytest.mark.integration
 def test_sql_result_format_not_in_checkpoint_passed_into_run_checkpoint_one_expectation_complete_output(
-    data_context_with_connection_to_metrics_db,
-    reference_sql_checkpoint_config_for_animal_names_table,
-    expectation_config_expect_column_values_to_be_in_set,
-    expected_unexpected_indices_output,
-    expected_sql_query_output,
+    data_context_with_connection_to_metrics_db: FileDataContext,
+    reference_sql_checkpoint_config_for_animal_names_table: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
+    expected_sql_query_output: str,
 ):
     """
     What does this test?
@@ -768,10 +774,10 @@ def test_sql_result_format_not_in_checkpoint_passed_into_run_checkpoint_one_expe
 
 @pytest.mark.integration
 def test_sql_result_format_not_in_checkpoint_passed_into_run_checkpoint_one_expectation_complete_output_limit_1(
-    data_context_with_connection_to_metrics_db,
-    reference_sql_checkpoint_config_for_animal_names_table,
-    expectation_config_expect_column_values_to_be_in_set,
-    expected_sql_query_output,
+    data_context_with_connection_to_metrics_db: FileDataContext,
+    reference_sql_checkpoint_config_for_animal_names_table: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expected_sql_query_output: str,
 ):
     """
     What does this test?
@@ -814,9 +820,9 @@ def test_sql_result_format_not_in_checkpoint_passed_into_run_checkpoint_one_expe
 
 @pytest.mark.integration
 def test_sql_result_format_not_in_checkpoint_passed_into_run_checkpoint_one_expectation_complete_output_incorrect_column(
-    data_context_with_connection_to_metrics_db,
-    reference_sql_checkpoint_config_for_animal_names_table,
-    expectation_config_expect_column_values_to_be_in_set,
+    data_context_with_connection_to_metrics_db: FileDataContext,
+    reference_sql_checkpoint_config_for_animal_names_table: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
 ):
     """
     What does this test?
@@ -849,12 +855,12 @@ def test_sql_result_format_not_in_checkpoint_passed_into_run_checkpoint_one_expe
 
 @pytest.mark.integration
 def test_sql_result_format_in_checkpoint_pk_defined_two_expectation_complete_output(
-    data_context_with_connection_to_metrics_db,
-    reference_sql_checkpoint_config_for_animal_names_table,
-    expectation_config_expect_column_values_to_be_in_set,
-    expectation_config_expect_column_values_to_not_be_in_set,
-    expected_unexpected_indices_output,
-    expected_sql_query_output,
+    data_context_with_connection_to_metrics_db: FileDataContext,
+    reference_sql_checkpoint_config_for_animal_names_table: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expectation_config_expect_column_values_to_not_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
+    expected_sql_query_output: str,
 ):
     """
     What does this test?
@@ -912,10 +918,10 @@ def test_sql_result_format_in_checkpoint_pk_defined_two_expectation_complete_out
 
 @pytest.mark.integration
 def test_sql_result_format_in_checkpoint_pk_defined_one_expectation_summary_output(
-    data_context_with_connection_to_metrics_db,
-    reference_sql_checkpoint_config_for_animal_names_table,
-    expectation_config_expect_column_values_to_be_in_set,
-    expected_unexpected_indices_output,
+    data_context_with_connection_to_metrics_db: FileDataContext,
+    reference_sql_checkpoint_config_for_animal_names_table: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     """
     What does this test?
@@ -958,9 +964,9 @@ def test_sql_result_format_in_checkpoint_pk_defined_one_expectation_summary_outp
 
 @pytest.mark.integration
 def test_sql_result_format_in_checkpoint_pk_defined_one_expectation_basic_output(
-    data_context_with_connection_to_metrics_db,
-    reference_sql_checkpoint_config_for_animal_names_table,
-    expectation_config_expect_column_values_to_be_in_set,
+    data_context_with_connection_to_metrics_db: FileDataContext,
+    reference_sql_checkpoint_config_for_animal_names_table: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
 ):
     """
     What does this test?
@@ -1003,14 +1009,60 @@ def test_sql_result_format_in_checkpoint_pk_defined_one_expectation_basic_output
     assert evrs[0]["results"][0]["result"].get("unexpected_index_query") is None
 
 
+@pytest.mark.integration
+def test_sql_complete_output_no_id_pk_fallback(
+    data_context_with_connection_to_metrics_db: FileDataContext,
+    reference_sql_checkpoint_config_for_animal_names_table: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+):
+    dict_to_update_checkpoint: dict = {
+        "result_format": {
+            "result_format": "COMPLETE",
+        }
+    }
+    context: DataContext = _add_expectations_and_checkpoint(
+        data_context=data_context_with_connection_to_metrics_db,
+        checkpoint_config=reference_sql_checkpoint_config_for_animal_names_table,
+        expectations_list=[expectation_config_expect_column_values_to_be_in_set],
+        dict_to_update_checkpoint=dict_to_update_checkpoint,
+    )
+
+    result: CheckpointResult = context.run_checkpoint(
+        checkpoint_name="my_checkpoint",
+    )
+    evrs: List[ExpectationSuiteValidationResult] = result.list_validation_results()
+    index_column_names: List[str] = evrs[0]["results"][0]["result"].get(
+        "unexpected_index_column_names"
+    )
+    assert not index_column_names
+
+    first_result_full_list: List[Dict[str, Any]] = evrs[0]["results"][0]["result"].get(
+        "unexpected_index_list"
+    )
+    assert not first_result_full_list
+    first_result_partial_list = evrs[0]["results"][0]["result"].get(
+        "partial_unexpected_index_list"
+    )
+    assert not first_result_partial_list
+
+    unexpected_index_query = evrs[0]["results"][0]["result"].get(
+        "unexpected_index_query"
+    )
+    # query does not contain id_pk column
+    assert (
+        unexpected_index_query
+        == "SELECT animals \nFROM animal_names \nWHERE animals IS NOT NULL AND (animals NOT IN ('cat', 'fish', 'dog'));"
+    )
+
+
 # pandas
 @pytest.mark.integration
 def test_pandas_result_format_in_checkpoint_pk_defined_one_expectation_complete_output(
-    in_memory_runtime_context,
-    batch_request_for_pandas_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
-    expected_unexpected_indices_output,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_pandas_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     """ """
     dict_to_update_checkpoint: dict = {
@@ -1055,11 +1107,11 @@ def test_pandas_result_format_in_checkpoint_pk_defined_one_expectation_complete_
 
 @pytest.mark.integration
 def test_pandas_result_format_in_checkpoint_pk_defined_one_expectation_complete_output_with_query(
-    in_memory_runtime_context,
-    batch_request_for_pandas_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
-    expected_unexpected_indices_output,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_pandas_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     """ """
     dict_to_update_checkpoint: dict = {
@@ -1105,11 +1157,11 @@ def test_pandas_result_format_in_checkpoint_pk_defined_one_expectation_complete_
 
 @pytest.mark.integration
 def test_pandas_result_format_in_checkpoint_pk_defined_one_expectation_complete_output_no_query(
-    in_memory_runtime_context,
-    batch_request_for_pandas_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
-    expected_unexpected_indices_output,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_pandas_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     """ """
     dict_to_update_checkpoint: dict = {
@@ -1152,11 +1204,11 @@ def test_pandas_result_format_in_checkpoint_pk_defined_one_expectation_complete_
 
 @pytest.mark.integration
 def test_pandas_result_format_in_checkpoint_pk_defined_one_expectation_complete_output_partial_unexpected_count_1(
-    in_memory_runtime_context,
-    batch_request_for_pandas_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
-    expected_unexpected_indices_output,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_pandas_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     """ """
     dict_to_update_checkpoint: dict = {
@@ -1203,11 +1255,11 @@ def test_pandas_result_format_in_checkpoint_pk_defined_one_expectation_complete_
 
 @pytest.mark.integration
 def test_pandas_result_format_not_in_checkpoint_passed_into_run_checkpoint_one_expectation_complete_output(
-    in_memory_runtime_context,
-    batch_request_for_pandas_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
-    expected_unexpected_indices_output,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_pandas_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     context: DataContext = _add_expectations_and_checkpoint(
         data_context=in_memory_runtime_context,
@@ -1248,10 +1300,10 @@ def test_pandas_result_format_not_in_checkpoint_passed_into_run_checkpoint_one_e
 
 @pytest.mark.integration
 def test_pandas_result_format_not_in_checkpoint_passed_into_run_checkpoint_one_expectation_summary_output_limit_1(
-    in_memory_runtime_context,
-    batch_request_for_pandas_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_pandas_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
 ):
     context: DataContext = _add_expectations_and_checkpoint(
         data_context=in_memory_runtime_context,
@@ -1286,10 +1338,10 @@ def test_pandas_result_format_not_in_checkpoint_passed_into_run_checkpoint_one_e
 
 @pytest.mark.integration
 def test_pandas_result_format_not_in_checkpoint_passed_into_run_checkpoint_one_expectation_complete_output_incorrect_column(
-    in_memory_runtime_context,
-    batch_request_for_pandas_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_pandas_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
 ):
     dict_to_update_checkpoint: dict = {
         "result_format": {
@@ -1319,12 +1371,12 @@ def test_pandas_result_format_not_in_checkpoint_passed_into_run_checkpoint_one_e
 
 @pytest.mark.integration
 def test_pandas_result_format_in_checkpoint_pk_defined_two_expectation_complete_output(
-    in_memory_runtime_context,
-    batch_request_for_pandas_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
-    expectation_config_expect_column_values_to_not_be_in_set,
-    expected_unexpected_indices_output,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_pandas_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expectation_config_expect_column_values_to_not_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     dict_to_update_checkpoint: dict = {
         "result_format": {
@@ -1383,12 +1435,11 @@ def test_pandas_result_format_in_checkpoint_pk_defined_two_expectation_complete_
 
 @pytest.mark.integration
 def test_pandas_result_format_in_checkpoint_pk_defined_one_expectation_summary_output(
-    in_memory_runtime_context,
-    batch_request_for_pandas_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
-    expected_unexpected_indices_output,
-    unexpected_index_query_output,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_pandas_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     dict_to_update_checkpoint: dict = {
         "result_format": {
@@ -1433,11 +1484,11 @@ def test_pandas_result_format_in_checkpoint_pk_defined_one_expectation_summary_o
 
 @pytest.mark.integration
 def test_pandas_result_format_not_in_checkpoint_passed_into_run_checkpoint_one_expectation_complete_output(
-    in_memory_runtime_context,
-    batch_request_for_pandas_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
-    expected_unexpected_indices_output,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_pandas_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     context: DataContext = _add_expectations_and_checkpoint(
         data_context=in_memory_runtime_context,
@@ -1470,10 +1521,10 @@ def test_pandas_result_format_not_in_checkpoint_passed_into_run_checkpoint_one_e
 
 @pytest.mark.integration
 def test_pandas_result_format_not_in_checkpoint_passed_into_run_checkpoint_one_expectation_summary_output_limit_1(
-    in_memory_runtime_context,
-    batch_request_for_pandas_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_pandas_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
 ):
     context: DataContext = _add_expectations_and_checkpoint(
         data_context=in_memory_runtime_context,
@@ -1502,10 +1553,10 @@ def test_pandas_result_format_not_in_checkpoint_passed_into_run_checkpoint_one_e
 
 @pytest.mark.integration
 def test_pandas_result_format_not_in_checkpoint_passed_into_run_checkpoint_one_expectation_complete_output_incorrect_column(
-    in_memory_runtime_context,
-    batch_request_for_pandas_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_pandas_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
 ):
     dict_to_update_checkpoint: dict = {
         "result_format": {
@@ -1535,12 +1586,12 @@ def test_pandas_result_format_not_in_checkpoint_passed_into_run_checkpoint_one_e
 
 @pytest.mark.integration
 def test_pandas_result_format_in_checkpoint_pk_defined_two_expectation_complete_output(
-    in_memory_runtime_context,
-    batch_request_for_pandas_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
-    expectation_config_expect_column_values_to_not_be_in_set,
-    expected_unexpected_indices_output,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_pandas_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expectation_config_expect_column_values_to_not_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     dict_to_update_checkpoint: dict = {
         "result_format": {
@@ -1591,11 +1642,11 @@ def test_pandas_result_format_in_checkpoint_pk_defined_two_expectation_complete_
 
 @pytest.mark.integration
 def test_pandas_result_format_in_checkpoint_pk_defined_one_expectation_summary_output(
-    in_memory_runtime_context,
-    batch_request_for_pandas_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
-    expected_unexpected_indices_output,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_pandas_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     dict_to_update_checkpoint: dict = {
         "result_format": {
@@ -1630,10 +1681,10 @@ def test_pandas_result_format_in_checkpoint_pk_defined_one_expectation_summary_o
 
 @pytest.mark.integration
 def test_pandas_result_format_in_checkpoint_pk_defined_one_expectation_basic_output(
-    in_memory_runtime_context,
-    batch_request_for_pandas_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_pandas_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
 ):
     dict_to_update_checkpoint: dict = {
         "result_format": {
@@ -1669,12 +1720,12 @@ def test_pandas_result_format_in_checkpoint_pk_defined_one_expectation_basic_out
 # spark
 @pytest.mark.integration
 def test_spark_result_format_in_checkpoint_pk_defined_one_expectation_complete_output(
-    in_memory_runtime_context,
-    batch_request_for_spark_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
-    expected_unexpected_indices_output,
-    expected_spark_query_output,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_spark_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
+    expected_spark_query_output: str,
 ):
     """
     What does this test?
@@ -1717,12 +1768,12 @@ def test_spark_result_format_in_checkpoint_pk_defined_one_expectation_complete_o
 
 @pytest.mark.integration
 def test_spark_result_format_not_in_checkpoint_passed_into_run_checkpoint_one_expectation_complete_output(
-    in_memory_runtime_context,
-    batch_request_for_spark_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
-    expected_unexpected_indices_output,
-    expected_spark_query_output,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_spark_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
+    expected_spark_query_output: str,
 ):
     """
     What does this test?
@@ -1771,12 +1822,12 @@ def test_spark_result_format_not_in_checkpoint_passed_into_run_checkpoint_one_ex
 
 @pytest.mark.integration
 def test_spark_result_format_not_in_checkpoint_passed_into_run_checkpoint_one_expectation_complete_output_with_query(
-    in_memory_runtime_context,
-    batch_request_for_spark_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
-    expected_unexpected_indices_output,
-    expected_spark_query_output,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_spark_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
+    expected_spark_query_output: str,
 ):
     """
     What does this test?
@@ -1828,11 +1879,11 @@ def test_spark_result_format_not_in_checkpoint_passed_into_run_checkpoint_one_ex
 
 @pytest.mark.integration
 def test_spark_result_format_not_in_checkpoint_passed_into_run_checkpoint_one_expectation_complete_output_no_query(
-    in_memory_runtime_context,
-    batch_request_for_spark_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
-    expected_unexpected_indices_output,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_spark_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     """
     What does this test?
@@ -1880,10 +1931,10 @@ def test_spark_result_format_not_in_checkpoint_passed_into_run_checkpoint_one_ex
 
 @pytest.mark.integration
 def test_spark_result_format_not_in_checkpoint_passed_into_run_checkpoint_one_expectation_complete_output_incorrect_column(
-    in_memory_runtime_context,
-    batch_request_for_spark_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_spark_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
 ):
     """
     What does this test?
@@ -1918,13 +1969,13 @@ def test_spark_result_format_not_in_checkpoint_passed_into_run_checkpoint_one_ex
 
 @pytest.mark.integration
 def test_spark_result_format_in_checkpoint_pk_defined_two_expectation_complete_output(
-    in_memory_runtime_context,
-    batch_request_for_spark_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
-    expectation_config_expect_column_values_to_not_be_in_set,
-    expected_unexpected_indices_output,
-    expected_spark_query_output,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_spark_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expectation_config_expect_column_values_to_not_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
+    expected_spark_query_output: str,
 ):
     """
     What does this test?
@@ -1986,11 +2037,11 @@ def test_spark_result_format_in_checkpoint_pk_defined_two_expectation_complete_o
 
 @pytest.mark.integration
 def test_spark_result_format_in_checkpoint_pk_defined_one_expectation_summary_output(
-    in_memory_runtime_context,
-    batch_request_for_spark_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
-    expected_unexpected_indices_output,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_spark_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     """
     What does this test?
@@ -2036,10 +2087,10 @@ def test_spark_result_format_in_checkpoint_pk_defined_one_expectation_summary_ou
 
 @pytest.mark.integration
 def test_spark_result_format_in_checkpoint_pk_defined_one_expectation_basic_output(
-    in_memory_runtime_context,
-    batch_request_for_spark_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_spark_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
 ):
     """
     What does this test?
@@ -2085,10 +2136,10 @@ def test_spark_result_format_in_checkpoint_pk_defined_one_expectation_basic_outp
 
 @pytest.mark.integration
 def test_spark_result_format_in_checkpoint_one_column_pair_expectation_complete_output(
-    in_memory_runtime_context,
-    batch_request_for_spark_unexpected_rows_and_index_column_pair,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_pair_values_to_be_equal,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_spark_unexpected_rows_and_index_column_pair: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_pair_values_to_be_equal: ExpectationConfiguration,
 ):
     dict_to_update_checkpoint: dict = {
         "result_format": {
@@ -2140,10 +2191,10 @@ def test_spark_result_format_in_checkpoint_one_column_pair_expectation_complete_
 
 @pytest.mark.integration
 def test_spark_result_format_in_checkpoint_one_column_pair_expectation_summary_output(
-    in_memory_runtime_context,
-    batch_request_for_spark_unexpected_rows_and_index_column_pair,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_pair_values_to_be_equal,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_spark_unexpected_rows_and_index_column_pair: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_pair_values_to_be_equal: ExpectationConfiguration,
 ):
     dict_to_update_checkpoint: dict = {
         "result_format": {
@@ -2188,10 +2239,10 @@ def test_spark_result_format_in_checkpoint_one_column_pair_expectation_summary_o
 
 @pytest.mark.integration
 def test_spark_result_format_in_checkpoint_one_column_pair_expectation_basic_output(
-    in_memory_runtime_context,
-    batch_request_for_spark_unexpected_rows_and_index_column_pair,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_pair_values_to_be_equal,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_spark_unexpected_rows_and_index_column_pair: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_pair_values_to_be_equal: ExpectationConfiguration,
 ):
     dict_to_update_checkpoint: dict = {
         "result_format": {
@@ -2234,10 +2285,10 @@ def test_spark_result_format_in_checkpoint_one_column_pair_expectation_basic_out
 
 @pytest.mark.integration
 def test_spark_result_format_in_checkpoint_one_multicolumn_map_expectation_complete_output(
-    in_memory_runtime_context,
-    batch_request_for_spark_unexpected_rows_and_index_multicolumn_sum,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_multicolumn_sum_to_equal,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_spark_unexpected_rows_and_index_multicolumn_sum: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_multicolumn_sum_to_equal: ExpectationConfiguration,
 ):
     dict_to_update_checkpoint: dict = {
         "result_format": {
@@ -2295,10 +2346,10 @@ def test_spark_result_format_in_checkpoint_one_multicolumn_map_expectation_compl
 
 @pytest.mark.integration
 def test_spark_result_format_in_checkpoint_one_multicolumn_map_expectation_summary_output(
-    in_memory_runtime_context,
-    batch_request_for_spark_unexpected_rows_and_index_multicolumn_sum,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_multicolumn_sum_to_equal,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_spark_unexpected_rows_and_index_multicolumn_sum: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_multicolumn_sum_to_equal: ExpectationConfiguration,
 ):
     dict_to_update_checkpoint: dict = {
         "result_format": {
@@ -2342,10 +2393,10 @@ def test_spark_result_format_in_checkpoint_one_multicolumn_map_expectation_summa
 
 @pytest.mark.integration
 def test_spark_result_format_in_checkpoint_one_multicolumn_map_expectation_basic_output(
-    in_memory_runtime_context,
-    batch_request_for_spark_unexpected_rows_and_index_multicolumn_sum,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_multicolumn_sum_to_equal,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_spark_unexpected_rows_and_index_multicolumn_sum: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_multicolumn_sum_to_equal: ExpectationConfiguration,
 ):
     dict_to_update_checkpoint: dict = {
         "result_format": {
@@ -2385,13 +2436,60 @@ def test_spark_result_format_in_checkpoint_one_multicolumn_map_expectation_basic
     assert not unexpected_index_query
 
 
+@pytest.mark.integration
+def test_spark_complete_output_no_id_pk_fallback(
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_spark_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+):
+    dict_to_update_checkpoint: dict = {
+        "result_format": {
+            "result_format": "COMPLETE",
+        }
+    }
+    context: DataContext = _add_expectations_and_checkpoint(
+        data_context=in_memory_runtime_context,
+        checkpoint_config=reference_checkpoint_config_for_unexpected_column_names,
+        expectations_list=[expectation_config_expect_column_values_to_be_in_set],
+        dict_to_update_checkpoint=dict_to_update_checkpoint,
+    )
+
+    result: CheckpointResult = context.run_checkpoint(
+        checkpoint_name="my_checkpoint",
+        expectation_suite_name="metrics_exp",
+        batch_request=batch_request_for_spark_unexpected_rows_and_index,
+    )
+    evrs: List[ExpectationSuiteValidationResult] = result.list_validation_results()
+
+    index_column_names: List[str] = evrs[0]["results"][0]["result"].get(
+        "unexpected_index_column_names"
+    )
+    assert not index_column_names
+    first_result_full_list: List[Dict[str, Any]] = evrs[0]["results"][0]["result"].get(
+        "unexpected_index_list"
+    )
+    assert not first_result_full_list
+    first_result_partial_list: List[Dict[str, Any]] = evrs[0]["results"][0][
+        "result"
+    ].get("partial_unexpected_index_list")
+    assert not first_result_partial_list
+    unexpected_index_query: List[int] = evrs[0]["results"][0]["result"].get(
+        "unexpected_index_query"
+    )
+    assert (
+        unexpected_index_query
+        == "df.filter(F.expr((animals IS NOT NULL) AND (NOT (animals IN (cat, fish, dog)))))"
+    )
+
+
 @pytest.mark.integration
 def test_pandas_result_format_in_checkpoint_pk_defined_one_expectation_complete_output_partial_unexpected_count_1(
-    in_memory_runtime_context,
-    batch_request_for_pandas_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
-    expected_unexpected_indices_output,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_pandas_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     """ """
     dict_to_update_checkpoint: dict = {
@@ -2433,11 +2531,11 @@ def test_pandas_result_format_in_checkpoint_pk_defined_one_expectation_complete_
 
 @pytest.mark.integration
 def test_pandas_result_format_in_checkpoint_named_index_one_index_column(
-    in_memory_runtime_context,
-    pandas_animals_dataframe_for_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
-    expected_unexpected_indices_output,
+    in_memory_runtime_context: AbstractDataContext,
+    pandas_animals_dataframe_for_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     """
     What does this test?
@@ -2505,11 +2603,11 @@ def test_pandas_result_format_in_checkpoint_named_index_one_index_column(
 
 @pytest.mark.integration
 def test_pandas_result_format_in_checkpoint_named_index_one_index_column_wrong_column(
-    in_memory_runtime_context,
-    pandas_animals_dataframe_for_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
-    expected_unexpected_indices_output,
+    in_memory_runtime_context: AbstractDataContext,
+    pandas_animals_dataframe_for_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     """
     What does this test?
@@ -2559,11 +2657,11 @@ def test_pandas_result_format_in_checkpoint_named_index_one_index_column_wrong_c
 
 @pytest.mark.integration
 def test_pandas_result_format_in_checkpoint_named_index_two_index_column(
-    in_memory_runtime_context,
-    pandas_animals_dataframe_for_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
-    expected_unexpected_indices_output,
+    in_memory_runtime_context: AbstractDataContext,
+    pandas_animals_dataframe_for_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     """
     What does this test?
@@ -2632,11 +2730,11 @@ def test_pandas_result_format_in_checkpoint_named_index_two_index_column(
 
 @pytest.mark.integration
 def test_pandas_result_format_in_checkpoint_named_index_two_index_column_not_set(
-    in_memory_runtime_context,
-    pandas_animals_dataframe_for_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
-    expected_unexpected_indices_output,
+    in_memory_runtime_context: AbstractDataContext,
+    pandas_animals_dataframe_for_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     """
     What does this test?
@@ -2695,11 +2793,11 @@ def test_pandas_result_format_in_checkpoint_named_index_two_index_column_not_set
 
 @pytest.mark.integration
 def test_pandas_result_format_in_checkpoint_named_index_two_index_column_not_set(
-    in_memory_runtime_context,
-    pandas_animals_dataframe_for_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
-    expected_unexpected_indices_output,
+    in_memory_runtime_context: AbstractDataContext,
+    pandas_animals_dataframe_for_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     """
     What does this test?
@@ -2765,11 +2863,11 @@ def test_pandas_result_format_in_checkpoint_named_index_two_index_column_not_set
 
 @pytest.mark.integration
 def test_pandas_result_format_in_checkpoint_named_index_different_column_specified_in_result_format(
-    in_memory_runtime_context,
-    pandas_animals_dataframe_for_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
-    expected_unexpected_indices_output,
+    in_memory_runtime_context: AbstractDataContext,
+    pandas_animals_dataframe_for_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     """
     What does this test?
@@ -2822,11 +2920,11 @@ def test_pandas_result_format_in_checkpoint_named_index_different_column_specifi
 
 @pytest.mark.integration
 def test_pandas_result_format_in_checkpoint_named_index_two_index_column_set(
-    in_memory_runtime_context,
-    pandas_animals_dataframe_for_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
-    expected_unexpected_indices_output,
+    in_memory_runtime_context: AbstractDataContext,
+    pandas_animals_dataframe_for_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     """
     What does this test?
@@ -2893,11 +2991,11 @@ def test_pandas_result_format_in_checkpoint_named_index_two_index_column_set(
 
 @pytest.mark.integration
 def test_pandas_result_format_in_checkpoint_one_expectation_complete_output(
-    in_memory_runtime_context,
-    batch_request_for_pandas_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_values_to_be_in_set,
-    expected_unexpected_indices_output,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_pandas_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_values_to_be_in_set: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     """ """
     dict_to_update_checkpoint: dict = {
@@ -2931,11 +3029,11 @@ def test_pandas_result_format_in_checkpoint_one_expectation_complete_output(
 
 @pytest.mark.integration
 def test_pandas_result_format_in_checkpoint_one_column_pair_expectation_complete_output(
-    in_memory_runtime_context,
-    batch_request_for_pandas_unexpected_rows_and_index_column_pair,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_pair_values_to_be_equal,
-    expected_unexpected_indices_output,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_pandas_unexpected_rows_and_index_column_pair: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_pair_values_to_be_equal: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     dict_to_update_checkpoint: dict = {
         "result_format": {
@@ -2984,11 +3082,11 @@ def test_pandas_result_format_in_checkpoint_one_column_pair_expectation_complete
 
 @pytest.mark.integration
 def test_pandas_result_format_in_checkpoint_one_column_pair_expectation_complete_output_one_index_column(
-    in_memory_runtime_context,
-    pandas_column_pairs_dataframe_for_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_pair_values_to_be_equal,
-    expected_unexpected_indices_output,
+    in_memory_runtime_context: AbstractDataContext,
+    pandas_column_pairs_dataframe_for_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_pair_values_to_be_equal: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     dict_to_update_checkpoint: dict = {
         "result_format": {
@@ -3055,11 +3153,11 @@ def test_pandas_result_format_in_checkpoint_one_column_pair_expectation_complete
 
 @pytest.mark.integration
 def test_pandas_result_format_in_checkpoint_one_column_pair_expectation_complete_output_two_index_column(
-    in_memory_runtime_context,
-    pandas_column_pairs_dataframe_for_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_column_pair_values_to_be_equal,
-    expected_unexpected_indices_output,
+    in_memory_runtime_context: AbstractDataContext,
+    pandas_column_pairs_dataframe_for_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_column_pair_values_to_be_equal: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     dict_to_update_checkpoint: dict = {
         "result_format": {
@@ -3127,11 +3225,11 @@ def test_pandas_result_format_in_checkpoint_one_column_pair_expectation_complete
 
 @pytest.mark.integration
 def test_pandas_result_format_in_checkpoint_one_multicolumn_map_expectation_complete_output(
-    in_memory_runtime_context,
-    batch_request_for_pandas_unexpected_rows_and_index_multicolumn_sum,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_multicolumn_sum_to_equal,
-    expected_unexpected_indices_output,
+    in_memory_runtime_context: AbstractDataContext,
+    batch_request_for_pandas_unexpected_rows_and_index_multicolumn_sum: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_multicolumn_sum_to_equal: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     dict_to_update_checkpoint: dict = {
         "result_format": {
@@ -3186,11 +3284,11 @@ def test_pandas_result_format_in_checkpoint_one_multicolumn_map_expectation_comp
 
 @pytest.mark.integration
 def test_pandas_result_format_in_checkpoint_one_multicolumn_map_expectation_complete_output_one_index_column(
-    in_memory_runtime_context,
-    pandas_multicolumn_sum_dataframe_for_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_multicolumn_sum_to_equal,
-    expected_unexpected_indices_output,
+    in_memory_runtime_context: AbstractDataContext,
+    pandas_multicolumn_sum_dataframe_for_unexpected_rows_and_index: dict,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_multicolumn_sum_to_equal: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     dict_to_update_checkpoint: dict = {
         "result_format": {
@@ -3262,11 +3360,11 @@ def test_pandas_result_format_in_checkpoint_one_multicolumn_map_expectation_comp
 
 @pytest.mark.integration
 def test_pandas_result_format_in_checkpoint_one_multicolumn_map_expectation_complete_output_two_index_column(
-    in_memory_runtime_context,
-    pandas_multicolumn_sum_dataframe_for_unexpected_rows_and_index,
-    reference_checkpoint_config_for_unexpected_column_names,
-    expectation_config_expect_multicolumn_sum_to_equal,
-    expected_unexpected_indices_output,
+    in_memory_runtime_context: AbstractDataContext,
+    pandas_multicolumn_sum_dataframe_for_unexpected_rows_and_index: pd.DataFrame,
+    reference_checkpoint_config_for_unexpected_column_names: dict,
+    expectation_config_expect_multicolumn_sum_to_equal: ExpectationConfiguration,
+    expected_unexpected_indices_output: list[dict[str, str | int]],
 ):
     dict_to_update_checkpoint: dict = {
         "result_format": {
diff --git a/tests/conftest.py b/tests/conftest.py
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -36,7 +36,11 @@
     UsageStatisticsHandler,
 )
 from great_expectations.core.util import get_or_create_spark_application
-from great_expectations.data_context import BaseDataContext, CloudDataContext
+from great_expectations.data_context import (
+    AbstractDataContext,
+    BaseDataContext,
+    CloudDataContext,
+)
 from great_expectations.data_context.cloud_constants import (
     GXCloudEnvironmentVariable,
     GXCloudRESTResource,
@@ -7109,7 +7113,7 @@ def multibatch_generic_csv_generator_context(monkeypatch, empty_data_context):
 
 
 @pytest.fixture
-def in_memory_runtime_context():
+def in_memory_runtime_context() -> AbstractDataContext:
     return build_in_memory_runtime_context()
 
 
@@ -7289,7 +7293,7 @@ def pandas_column_pairs_dataframe_for_unexpected_rows_and_index():
 
 
 @pytest.fixture
-def pandas_multicolumn_sum_dataframe_for_unexpected_rows_and_index():
+def pandas_multicolumn_sum_dataframe_for_unexpected_rows_and_index() -> pd.DataFrame:
     return pd.DataFrame(
         {
             "pk_1": [0, 1, 2, 3, 4, 5],
diff --git a/tests/expectations/metrics/column_map_metrics/test_unexpected_indices_and_query.py b/tests/expectations/metrics/column_map_metrics/test_unexpected_indices_and_query.py
--- a/tests/expectations/metrics/column_map_metrics/test_unexpected_indices_and_query.py
+++ b/tests/expectations/metrics/column_map_metrics/test_unexpected_indices_and_query.py
@@ -11,8 +11,13 @@
 from great_expectations.execution_engine import (
     PandasExecutionEngine,
     SqlAlchemyExecutionEngine,
+    SparkDFExecutionEngine,
+)
+from great_expectations.self_check.util import (
+    build_pandas_engine,
+    build_sa_engine,
+    build_spark_engine,
 )
-from great_expectations.self_check.util import build_pandas_engine, build_sa_engine
 from great_expectations.validator.computed_metric import MetricValue
 from great_expectations.validator.metric_configuration import MetricConfiguration
 from tests.expectations.test_util import get_table_columns_metric
@@ -237,10 +242,10 @@ def test_sa_unexpected_index_list_metric_without_id_pk(sa, animal_table_df):
         "unexpected_condition": unexpected_columns_metric,
         "table.columns": table_columns_metric,
     }
-    with pytest.raises(MetricResolutionError):
-        results: Dict[Tuple[str, str, str], MetricValue] = engine.resolve_metrics(
-            metrics_to_resolve=(unexpected_index_list,), metrics=metrics
-        )
+    results: Dict[Tuple[str, str, str], MetricValue] = engine.resolve_metrics(
+        metrics_to_resolve=(unexpected_index_list,), metrics=metrics
+    )
+    assert list(results.values())[0] is None
 
 
 @pytest.mark.unit
@@ -305,7 +310,159 @@ def test_sa_unexpected_index_query_metric_without_id_pk(sa, animal_table_df):
         "unexpected_condition": unexpected_columns_metric,
         "table.columns": table_columns_metric,
     }
-    with pytest.raises(MetricResolutionError):
-        results: Dict[Tuple[str, str, str], MetricValue] = engine.resolve_metrics(
-            metrics_to_resolve=(unexpected_index_query,), metrics=metrics
+    results: Dict[Tuple[str, str, str], MetricValue] = engine.resolve_metrics(
+        metrics_to_resolve=(unexpected_index_query,), metrics=metrics
+    )
+    for (key, val) in results.items():
+        assert (
+            val == "SELECT animals \n"
+            "FROM test \n"
+            "WHERE animals IS NOT NULL AND (animals NOT IN ('cat', 'fish', 'dog'));"
+        )
+
+
+@pytest.mark.integration
+def test_spark_unexpected_index_list_metric_with_id_pk(
+    spark_session, animal_table_df, metric_value_kwargs_complete
+):
+    engine: SparkDFExecutionEngine = build_spark_engine(
+        spark=spark_session, df=animal_table_df, batch_id="my_id"
+    )
+
+    (
+        table_columns_metric,
+        unexpected_columns_metric,
+        metrics,
+    ) = _build_table_columns_and_unexpected(engine, metric_value_kwargs_complete)
+
+    unexpected_index_list = MetricConfiguration(
+        metric_name=f"column_values.in_set.{SummarizationMetricNameSuffixes.UNEXPECTED_INDEX_LIST.value}",
+        metric_domain_kwargs={"column": "animals"},
+        metric_value_kwargs=metric_value_kwargs_complete,
+    )
+    unexpected_index_list.metric_dependencies = {
+        "unexpected_condition": unexpected_columns_metric,
+        "table.columns": table_columns_metric,
+    }
+    results: Dict[Tuple[str, str, str], MetricValue] = engine.resolve_metrics(
+        metrics_to_resolve=(unexpected_index_list,), metrics=metrics
+    )
+    for val in results.values():
+        assert val == [
+            {"animals": "giraffe", "pk_1": 3},
+            {"animals": "lion", "pk_1": 4},
+            {"animals": "zebra", "pk_1": 5},
+        ]
+
+
+@pytest.mark.integration
+def test_spark_unexpected_index_list_metric_without_id_pk(
+    spark_session, animal_table_df
+):
+    metric_value_kwargs: dict = {
+        "value_set": ["cat", "fish", "dog"],
+        "parse_strings_as_datetimes": False,
+        "result_format": {
+            "result_format": "COMPLETE",
+            "partial_unexpected_count": 20,
+            "include_unexpected_rows": False,
+        },
+    }
+
+    engine: SparkDFExecutionEngine = build_spark_engine(
+        spark=spark_session, df=animal_table_df, batch_id="my_id"
+    )
+    (
+        table_columns_metric,
+        unexpected_columns_metric,
+        metrics,
+    ) = _build_table_columns_and_unexpected(engine, metric_value_kwargs)
+
+    unexpected_index_list = MetricConfiguration(
+        metric_name=f"column_values.in_set.{SummarizationMetricNameSuffixes.UNEXPECTED_INDEX_LIST.value}",
+        metric_domain_kwargs={"column": "animals"},
+        metric_value_kwargs=metric_value_kwargs,
+    )
+    unexpected_index_list.metric_dependencies = {
+        "unexpected_condition": unexpected_columns_metric,
+        "table.columns": table_columns_metric,
+    }
+    results: Dict[Tuple[str, str, str], MetricValue] = engine.resolve_metrics(
+        metrics_to_resolve=(unexpected_index_list,), metrics=metrics
+    )
+    assert list(results.values())[0] is None
+
+
+@pytest.mark.integration
+def test_spark_unexpected_index_query_metric_with_id_pk(
+    spark_session, animal_table_df, metric_value_kwargs_complete
+):
+    metric_value_kwargs: dict = metric_value_kwargs_complete
+
+    engine: SparkDFExecutionEngine = build_spark_engine(
+        spark=spark_session, df=animal_table_df, batch_id="my_id"
+    )
+    (
+        table_columns_metric,
+        unexpected_columns_metric,
+        metrics,
+    ) = _build_table_columns_and_unexpected(engine, metric_value_kwargs_complete)
+    unexpected_index_query: MetricConfiguration = MetricConfiguration(
+        metric_name=f"column_values.in_set.{SummarizationMetricNameSuffixes.UNEXPECTED_INDEX_QUERY.value}",
+        metric_domain_kwargs={"column": "animals"},
+        metric_value_kwargs=metric_value_kwargs,
+    )
+    unexpected_index_query.metric_dependencies = {
+        "unexpected_condition": unexpected_columns_metric,
+        "table.columns": table_columns_metric,
+    }
+    results: Dict[Tuple[str, str, str], MetricValue] = engine.resolve_metrics(
+        metrics_to_resolve=(unexpected_index_query,), metrics=metrics
+    )
+    for val in results.values():
+        assert (
+            val
+            == "df.filter(F.expr((animals IS NOT NULL) AND (NOT (animals IN (cat, fish, dog)))))"
+        )
+
+
+@pytest.mark.integration
+def test_spark_unexpected_index_query_metric_without_id_pk(
+    spark_session, animal_table_df, metric_value_kwargs_complete
+):
+    metric_value_kwargs: dict = {
+        "value_set": ["cat", "fish", "dog"],
+        "parse_strings_as_datetimes": False,
+        "result_format": {
+            "result_format": "COMPLETE",
+            "partial_unexpected_count": 20,
+            "include_unexpected_rows": False,
+        },
+    }
+
+    engine: SparkDFExecutionEngine = build_spark_engine(
+        spark=spark_session, df=animal_table_df, batch_id="my_id"
+    )
+
+    (
+        table_columns_metric,
+        unexpected_columns_metric,
+        metrics,
+    ) = _build_table_columns_and_unexpected(engine, metric_value_kwargs)
+    unexpected_index_query: MetricConfiguration = MetricConfiguration(
+        metric_name=f"column_values.in_set.{SummarizationMetricNameSuffixes.UNEXPECTED_INDEX_QUERY.value}",
+        metric_domain_kwargs={"column": "animals"},
+        metric_value_kwargs=metric_value_kwargs,
+    )
+    unexpected_index_query.metric_dependencies = {
+        "unexpected_condition": unexpected_columns_metric,
+        "table.columns": table_columns_metric,
+    }
+    results: Dict[Tuple[str, str, str], MetricValue] = engine.resolve_metrics(
+        metrics_to_resolve=(unexpected_index_query,), metrics=metrics
+    )
+    for val in results.values():
+        assert (
+            val
+            == "df.filter(F.expr((animals IS NOT NULL) AND (NOT (animals IN (cat, fish, dog)))))"
         )
diff --git a/tests/expectations/metrics/test_map_metric.py b/tests/expectations/metrics/test_map_metric.py
--- a/tests/expectations/metrics/test_map_metric.py
+++ b/tests/expectations/metrics/test_map_metric.py
@@ -816,6 +816,8 @@ def test_spark_single_column_complete_result_format(
         ],
         "partial_unexpected_list": ["giraffe", "lion", "zebra"],
         "unexpected_count": 3,
+        "unexpected_index_query": "df.filter(F.expr((animals IS NOT NULL) AND (NOT "
+        "(animals IN (cat, fish, dog)))))",
         "unexpected_list": ["giraffe", "lion", "zebra"],
         "unexpected_percent": 50.0,
         "unexpected_percent_nonmissing": 50.0,
@@ -1025,6 +1027,10 @@ def test_sqlite_single_column_complete_result_format(
         ],
         "partial_unexpected_list": ["giraffe", "lion", "zebra"],
         "unexpected_count": 3,
+        "unexpected_index_query": "SELECT animals \n"
+        "FROM animal_names \n"
+        "WHERE animals IS NOT NULL AND (animals NOT IN "
+        "('cat', 'fish', 'dog'));",
         "unexpected_list": ["giraffe", "lion", "zebra"],
         "unexpected_percent": 50.0,
         "unexpected_percent_nonmissing": 50.0,