File tree Expand file tree Collapse file tree
core/src/test/java/org/apache/datafusion Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -441,4 +441,26 @@ void udfAppliedToMultiRowQuery_processesAllRows() throws Exception {
441441 }
442442 }
443443 }
444+
445+ @ Test
446+ void volatilityBytesRoundTrip_forAllThreeKinds () throws Exception {
447+ for (Volatility v : Volatility .values ()) {
448+ try (SessionContext ctx = new SessionContext ();
449+ BufferAllocator allocator = new RootAllocator ()) {
450+ ctx .registerUdf (
451+ "add_one_" + v .name ().toLowerCase (),
452+ new AddOne (),
453+ new ArrowType .Int (32 , true ),
454+ List .of (new ArrowType .Int (32 , true )),
455+ v );
456+ try (DataFrame df =
457+ ctx .sql ("SELECT add_one_" + v .name ().toLowerCase () + "(CAST(0 AS INT))" );
458+ ArrowReader r = df .collect (allocator )) {
459+ assertEquals (true , r .loadNextBatch ());
460+ IntVector y = (IntVector ) r .getVectorSchemaRoot ().getVector (0 );
461+ assertEquals (1 , y .get (0 ));
462+ }
463+ }
464+ }
465+ }
444466}
You can’t perform that action at this time.
0 commit comments