NoahKusaba opened a new issue, #2959:
URL: https://github.com/apache/datafusion-ballista/issues/2959

   **Describe the bug**
   
   `SessionState::upgrade_for_ballista`, which 
`SessionContext::standalone_with_state` and `remote_with_state` call, replaces 
the session's scalar, aggregate and window functions with DataFusion's defaults 
(`ballista_scalar_functions()` and friends). Every function registered on the 
state beforehand is lost on the client:
   
   - A UDF registered with `register_udf` fails with `Invalid function`, even 
though the standalone executor, built from the original state, has it.
   - With `SessionStateBuilder::with_spark_features()`, Spark functions either 
vanish (`format_string`, `pmod`, `parse_url`, …) or quietly resolve to 
DataFusion's function of the same name. For example, Spark's `floor` and `ceil` 
return floats instead of integers, and `trunc`, `date_part`, `encode` and 
`round` behave differently.
   
   **To Reproduce**
   
   ```rust
   let config = SessionConfig::new_with_ballista();
   let setup = SessionContext::new_with_state(
       
SessionStateBuilder::new().with_config(config).with_default_features().build(),
   );
   let f = Arc::new(|a: &[ColumnarValue]| Ok(a[0].clone()));
   setup.register_udf(create_udf(
       "my_identity", vec![DataType::Int64], DataType::Int64, 
Volatility::Immutable, f,
   ));
   
   let ctx = SessionContext::standalone_with_state(setup.state()).await?;
   ctx.sql("SELECT my_identity(CAST(1 AS BIGINT))").await?.collect().await?;
   // Error during planning: Invalid function 'my_identity'.
   ```
   
   **Expected behavior**
   
   Functions registered on the state are kept. Ballista should add whatever it 
needs without replacing what the caller registered.
   
   **Additional context**
   
   Found by running DataFusion's sqllogictest files on Ballista (#2945). This 
is the largest group of failures there: about 2,280 records, mostly the 
`spark/` files plus files whose `TestContext` registers UDFs. Fixing it would 
let the suite check what those files actually test.
   


-- 
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]

Reply via email to