perspective icon indicating copy to clipboard operation
perspective copied to clipboard

Add a failing test for updating a table with a headerless CSV.

Open sinistersnare opened this issue 6 months ago • 1 comments

This PR adds a test that crashes the test suite. It does not provide a fix, so the PR is marked as a draft for now.

Currently Perspective aborts in the C++ by updating a table with a CSV that has no header.

tbl = Table({ "stringcol": "string" })
tbl.update("rowval  \n another row val")

Results in Fatal Python error: Aborted

This bug also occurs in Rust, see the example in the below comment

sinistersnare avatar Jun 13 '25 14:06 sinistersnare

Here is the Rust example:

use std::error::Error;

use perspective::client::{ColumnType, TableData, UpdateData};
use perspective::server::Server;

#[tokio::main(flavor = "multi_thread")]
async fn main() -> Result<(), Box<dyn Error>> {
    let server = Server::default();
    let client = server.new_local_client();
    let schema = TableData::Schema(vec![("stringcol".into(), ColumnType::String)]);
    let table = client.table(schema, Default::default()).await?;
    // Note: No header row!
    let update = UpdateData::Csv("A\nB\n".to_string());
    table.update(update, Default::default()).await?;
    let csv = table.view(None).await?.to_csv(Default::default()).await?;
    println!("CSV:: {csv:?}");
    client.close().await;
    Ok(())
}
$ cargo run
   Compiling example_repo v1.0.0 (/Path/To/Example)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.53s
     Running `target/debug/example_repo`
libc++abi: terminating due to uncaught exception of type std::invalid_argument: stoll: no conversion
[1]    19940 abort      cargo run

sinistersnare avatar Jun 13 '25 14:06 sinistersnare

This is becoming a bit out-of-scope as CSV parsing is no longer directly handled by Perspective, so I'm going to go ahead and close this. We may revisit the issue in the future as we broaden Perspective's engine support.

texodus avatar Oct 10 '25 01:10 texodus