Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for user defined functions #57

Closed
fruch opened this issue Nov 2, 2023 · 1 comment · Fixed by #61
Closed

Support for user defined functions #57

fruch opened this issue Nov 2, 2023 · 1 comment · Fixed by #61

Comments

@fruch
Copy link

fruch commented Nov 2, 2023

Rust driver can read/write UDTs:
https://rust-driver.docs.scylladb.com/stable/data-types/udt.html

but seems that using it from latte workload is not currently possible

passing in Rune object didn't worked:

❯ latte load docker/latte/workloads/custom_d1.rn -- 172.17.0.2
info: Loading workload script /home/fruch/projects/scylla-cluster-tests/docker/latte/workloads/custom_d1.rn...
info: Connecting to ["172.17.0.2"]...
info: Connected to  running Cassandra version 3.0.8
info: Preparing...
info: Erasing data...
info: Loading data...
error: Cassandra error: Unsupported type: Object

I'm guessing some constructs needs to be expose to Rune, for building needed UDT objects

@fruch
Copy link
Author

fruch commented Nov 2, 2023

a snippet from what I've tried

pub async fn prepare(db) {
    db.load_cycle_count = 100;
    db.prepare(INSERT, `INSERT INTO ${KEYSPACE}.${TABLE}(id, channel_id, bucket, webhook) VALUES (:id, :channel_id, :bucket, :webhook)`).await?;
    db.prepare(READ, `SELECT * FROM ${KEYSPACE}.${TABLE} WHERE id = :id AND channel_id = :channel_id AND bucket = :bucket`).await?;
}

pub async fn load(db, i) {
    let message_webhook =  #{};
    message_webhook["id"] = 123;
    message_webhook["username"] = "fruch";
    db.execute_prepared(INSERT, [latte::hash(i), latte::hash(i+100), latte::hash(i+200).to_i32(), message_webhook]).await?
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant