How to downcast to timestamp in arrow?

use datafusion::arrow::util::pretty;
use datafusion::error::Result;
use datafusion::prelude::*;
use datafusion::arrow::array::{
use datafusion::arrow::datatypes::DataType::Timestamp;

async fn main() -> Result<()> {
     let ctx = SessionContext::new();
     let avro_file = "alltypes_plain.avro";
     ctx.register_avro("alltypes_plain", avro_file, AvroReadOptions::default())

     let df = ctx.sql("select timestamp_col as timevalue from alltypes_plain").await?;
     let results = df.collect().await?;
    // get the first column,
     let dcol = results.get(0).unwrap().column(0);
     println!("{:?}", &dcol);
     //I want to downcast the first column (timevalue) into arrow timestamp or datetime value  , obviously the "Timestamp" is not correct, which should i use to do so?
     let e = dcol.as_any().downcast_ref::<Timestamp/Datetime>().unwrap();
     // println!("{:?}", e);

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.