heyGrant opened a new issue, #3497:
URL: https://github.com/apache/arrow-datafusion/issues/3497

   code first as below:
   (you can skip and see the bottom codes about how to get a single value, it's 
my way, but I don't like it.)
   
   `use std::sync::Arc;
   use datafusion::arrow::datatypes::{
     DataType,
     Field,
     Schema};
   use datafusion::arrow::record_batch::RecordBatch;
   use datafusion::arrow::array::StringBuilder;
   use datafusion::arrow::array::StringArray;
    
   #[tokio::main]
   async fn main(){
     // create an arrow array first:
       let mut sbuilder = StringBuilder::new(100);
       sbuilder.append_value("a").unwrap();
       sbuilder.append_null().unwrap();
       sbuilder.append_value("hello").unwrap();
       sbuilder.append_value("add").unwrap();
       sbuilder.append_value("aaaaaa").unwrap();
       let a = sbuilder.finish();
    
       let schema = Arc::new(Schema::new(vec![
           Field::new("a", DataType::Utf8, false),
       ]));
       let batch = RecordBatch::try_new(
           schema.clone(),
           vec![
               Arc::new(a),
           ],
       ).unwrap();
    
       // print the first column:
       let firstcol = batch.column(0);
       println!("{:?}", firstcol);
   
   //so many steps to get  a single value from this array. is there a simple 
way to do that? who can help me?
       let da = firstcol.as_any();
       let da1 = da.downcast_ref::<StringArray>();
       let singlevalue3 = da1.unwrap();
       let s = singlevalue3.value(3);
       println!("{:?}",s);
   }`
   
   
   so many steps to get  a single value from this array. is there a simple way 
to do that? who can help me?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to