killzoner commented on code in PR #1420:
URL:
https://github.com/apache/datafusion-ballista/pull/1420#discussion_r2817552370
##########
ballista/client/tests/context_unsupported.rs:
##########
@@ -143,4 +149,52 @@ mod unsupported {
Ok(())
}
+
+ #[rstest]
+ #[case::standalone(standalone_context())]
+ #[case::remote(remote_context())]
+ #[tokio::test]
+ async fn should_support_on_cache_collect(
+ #[future(awt)]
+ #[case]
+ ctx: SessionContext,
+ ) -> datafusion::error::Result<()> {
+ // opt out case, should fail
+ ctx.sql("SET ballista.cache_noop = false")
+ .await?
+ .show()
+ .await?;
+ let cached_df = ctx.sql("SELECT 1").await?.cache().await?;
+
+ // Collect fails because extension node is not handled for now by
default query planner
+ let result = cached_df.collect().await;
+
+ assert!(result.is_err());
+ let err_msg = result.unwrap_err().to_string();
+ assert!(
+ err_msg.contains("No installed planner was able to convert the
custom node to an execution plan: BallistaCacheNode"),
+ "Expected planner error, got: {err_msg}"
+ );
+
+ // opt in case, should succeed transparently without effective cache
+ ctx.sql("SET ballista.cache_noop = true")
+ .await?
+ .show()
+ .await?;
+ let cached_df = ctx.sql("SELECT 1").await?.cache().await?;
+ // Collect does not fail because cache is ignored silently with
cache_noop
+ let result = cached_df.collect().await;
+
+ assert!(result.is_ok());
+ let expected = [
+ "+----------+",
+ "| Int64(1) |",
+ "+----------+",
+ "| 1 |",
+ "+----------+",
+ ];
+ assert_batches_eq!(expected, &result?);
+
Review Comment:
i wanted to group test with both `ballista.cache_noop` values, will move it
to specific cases then
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]