Files
scylladb/test/resource/wasm/rust/test_complex_null_values.rs
Wojciech Mitros 1e18731a69 cql-pytest: translate Cassandra's UFTypesTest
This is a translation of Cassandra's CQL unit test source file
validation/entities/UFTypesTest.java into our cql-pytest framework.

There are 7 tests, which reproduce one known bug:
Refs #13746: UDF can only be used in SELECT, and abort when used in WHERE, or in INSERT/UPDATE/DELETE commands

And uncovered two previously unknown bugs:

Refs #13855: UDF with a non-frozen collection parameter cannot be called on a frozen value
Refs #13860: A non-frozen collection returned by a UDF cannot be used as a frozen one

Additionally, we encountered an issue that can be treated as either a bug or a hole in documentation:

Refs #13866: Argument and return types in UDFs can be frozen

Closes #13867
2023-05-14 15:22:03 +03:00

34 lines
647 B
Rust

use scylla_udf::{export_udf, export_udt};
use std::collections::{BTreeMap, BTreeSet};
#[export_udf]
fn return_input_flist(x: Option<Vec<f64>>) -> Option<Vec<f64>> {
x
}
#[export_udf]
fn return_input_fset(x: Option<BTreeSet<String>>) -> Option<BTreeSet<String>> {
x
}
#[export_udf]
fn return_input_fmap(x: Option<BTreeMap<i32, bool>>) -> Option<BTreeMap<i32, bool>> {
x
}
#[export_udf]
fn return_input_ftup(x: Option<(f64, String, i32, bool)>) -> Option<(f64, String, i32, bool)> {
x
}
#[export_udt]
struct MyUdt {
txt: String,
i: i32,
}
#[export_udf]
fn return_input_fudt(x: Option<MyUdt>) -> Option<MyUdt> {
x
}