feat: support postgresql by holicc · Pull Request #286 · roapi/roapi

Recently, I found that we can simplify the code base by using the get_arrow API from connectorx.
@houqp Do you think we should modify the code like this?

impl DatabaseLoader {
        pub fn to_mem_table(
            &self,
            t: &TableSource,
        ) -> Result<datafusion::datasource::MemTable, ColumnQError> {
            debug!("loading database table data...");
            let queries = CXQuery::naked(format!("SELECT * FROM {}", t.name));
            let source = SourceConn::try_from(t.get_uri_str())
                .map_err(|e| ColumnQError::Database(e.to_string()))?;
            let destination = connectorx::get_arrow::get_arrow(&source, None, &[queries])
                .map_err(|e| ColumnQError::Database(e.to_string()))?;
            Ok(datafusion::datasource::MemTable::try_new(
                destination.arrow_schema(),
                vec![destination.arrow().unwrap()],
            )?)
        }
    }