apache / iceberg-rust

Apache Iceberg
https://rust.iceberg.apache.org/
Apache License 2.0
673 stars 159 forks source link

fix: avoid to create operator of memory storage every time #635

Closed ZENOTME closed 1 month ago

ZENOTME commented 2 months ago

The following assert will fail because the memory storage will create a new operator every time. To maintain the context, we should create the operator at init and clone it later.

   #[tokio::test]
    async fn test_memory_io() {
        let io = FileIOBuilder::new("memory").build().unwrap();
        //let io = create_local_file_io();

        let path = format!(
            "{}/1.txt",
            TempDir::new().unwrap().path().to_str().unwrap()
        );

        let output_file = io
            .new_output(path.clone())
            .unwrap();
        output_file.write("test".into()).await.unwrap();

        assert!(io.is_exist(path.clone()).await.unwrap());
    }
ZENOTME commented 2 months ago

cc @Xuanwo

Xuanwo commented 2 months ago

cc @liurenjie1024 for another look.

liurenjie1024 commented 1 month ago

Thanks @ZENOTME for this.