Repository: great-expectations/great_expectations
Pull request: [BUGFIX] [batch.py] fix check for null value
Please annotate your PR title to describe what the PR does, then give a brief bulleted description of your PR below. PR titles should begin with [BUGFIX], [FEATURE],  [DOCS], or [MAINTENANCE]. If a new feature introduces breaking changes for the Great Expectations API or configuration files, please also add [BREAKING]. You can read about the tags in our [contributor checklist](https://docs.greatexpectations.io/en/latest/contributing/contribution_checklist.html).

Changes proposed in this pull request:
- Fix if condition that checks if dict value is not null (Currently this is breaking `RuntimeBatchRequest`)
   - Currently this if-condition fails when a dataframe is being passed as a value to `batch_data` when using `RuntimeBatchRequest`
   - Error: `ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().`
   - Proposed approach is to check if type is not NoneType. Same logic but will work with dataframes too. 


After submitting your PR, CI checks will run and @tiny-tim-bot will check for your CLA signature.


Previous Design Review notes:
- Closes #2846
- 
-


### Definition of Done
Please delete options that are not relevant.

- [x] My code follows the Great Expectations [style guide](https://docs.greatexpectations.io/en/latest/contributing/style_guide.html?highlight=style%20guide)
- [x] I have performed a [self-review](https://docs.greatexpectations.io/en/latest/contributing/contribution_checklist.html?highlight=checklist) of my own code
- [x] I have run any local integration tests and made sure that nothing is broken.


Thank you for submitting!


Problem statement:
ValueError on RunTimeBatchRequest.get_json_dict with a pandas df
**Describe the bug**
If you try to get a dict for a RunTimeBatchRequest with a pandas dataframe, you get `ValueError: The truth value of a PandasDataset is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().`

**To Reproduce**
```
from great_expectations.core.batch import RuntimeBatchRequest
RuntimeBatchRequest(
    datasource_name="dsn",
    data_connector_name="dcn",
    data_asset_name="dan",
    runtime_parameters={
      "batch_data": pd.DataFrame({'c': [1,2,3]})
    },
    batch_identifiers={
        "id1": 123,
        "id2": 'abc'
    }
).get_json_dict()
```

**Expected behavior**
Should not try to serialize df.

**Environment (please complete the following information):**
 - Great Expectations Version:  0.13.19

Hints from issue discussion:
@majidaldo Thank you for creating this issue! I see that you are trying to serialize the RuntimeBatchRequest. Could you show the broader context of this code snippet? 
> @majidaldo Thank you for creating this issue! I see that you are trying to serialize the RuntimeBatchRequest. Could you show the broader context of this code snippet?

...to collect it to create a dataset. maybe i can take it out of 'meta' after validation.

Commit message: precommit

Patch to review:
diff --git a/great_expectations/core/batch.py b/great_expectations/core/batch.py
index cb093bd22246..bd324f6f9d89 100644
--- a/great_expectations/core/batch.py
+++ b/great_expectations/core/batch.py
@@ -258,7 +258,9 @@ def get_json_dict(self) -> dict:
             json_dict["batch_identifiers"] = self.batch_identifiers
         if self.runtime_parameters is not None:
             json_dict["runtime_parameters"] = self.runtime_parameters
-            if json_dict["runtime_parameters"].get("batch_data"):
+            if not isinstance(
+                json_dict["runtime_parameters"].get("batch_data"), type(None)
+            ):
                 json_dict["runtime_parameters"]["batch_data"] = str(
                     type(json_dict["runtime_parameters"]["batch_data"])
                 )


Code review comments:
diff_hunk: @@ -258,7 +258,9 @@ def get_json_dict(self) -> dict:
             json_dict["batch_identifiers"] = self.batch_identifiers
         if self.runtime_parameters is not None:
             json_dict["runtime_parameters"] = self.runtime_parameters
-            if json_dict["runtime_parameters"].get("batch_data"):
+            if not isinstance(
+                json_dict["runtime_parameters"].get("batch_data"), type(None)
+            ):
path: great_expectations/core/batch.py
text: @user1:
```suggestion
            if json_dict["runtime_parameters"].get("batch_data") is not None:
```