vegarsti commented on code in PR #17633: URL: https://github.com/apache/datafusion/pull/17633#discussion_r2383933775
########## datafusion-examples/examples/table_sample.rs: ########## @@ -0,0 +1,1252 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use datafusion::common::{ + arrow_datafusion_err, internal_err, not_impl_err, plan_datafusion_err, plan_err, + DFSchemaRef, ResolvedTableReference, Statistics, TableReference, +}; +use datafusion::error::Result; +use datafusion::logical_expr::sqlparser::ast::{ + SetExpr, Statement, TableFactor, TableSampleMethod, TableSampleUnit, +}; +use datafusion::logical_expr::{ + Extension, LogicalPlan, LogicalPlanBuilder, TableSource, UserDefinedLogicalNode, + UserDefinedLogicalNodeCore, +}; +use std::any::Any; +use std::collections::HashMap; + +use arrow::util::pretty::pretty_format_batches; + +use arrow_schema::SchemaRef; +use async_trait::async_trait; +use datafusion::datasource::provider_as_source; +use datafusion::error::DataFusionError; +use datafusion::execution::{ + SendableRecordBatchStream, SessionState, SessionStateBuilder, TaskContext, +}; +use datafusion::logical_expr::planner::ContextProvider; +use datafusion::logical_expr::sqlparser::dialect::PostgreSqlDialect; +use datafusion::logical_expr::sqlparser::parser::Parser; +use datafusion::physical_expr::EquivalenceProperties; +use datafusion::physical_plan::metrics::{ + BaselineMetrics, ExecutionPlanMetricsSet, MetricsSet, RecordOutput, +}; +use datafusion::physical_plan::{ + displayable, DisplayAs, DisplayFormatType, ExecutionPlan, PlanProperties, + RecordBatchStream, +}; +use datafusion::physical_planner::{ + DefaultPhysicalPlanner, ExtensionPlanner, PhysicalPlanner, +}; +use datafusion::prelude::*; +use datafusion::sql::planner::SqlToRel; +use datafusion::sql::sqlparser::ast::TableSampleKind; +use log::{debug, info}; +use std::fmt; +use std::fmt::{Debug, Formatter}; +use std::hash::{Hash, Hasher}; +use std::pin::Pin; +use std::str::FromStr; +use std::sync::Arc; +use std::task::{Context, Poll}; + +use arrow::array::UInt32Array; +use arrow::compute; +use arrow::record_batch::RecordBatch; + +use datafusion::execution::context::QueryPlanner; +use datafusion::execution::session_state::SessionContextProvider; +use datafusion::sql::sqlparser::ast; +use futures::stream::{Stream, StreamExt}; +use futures::{ready, TryStreamExt}; +use rand::rngs::StdRng; +use rand::{Rng, SeedableRng}; +use rand_distr::{Distribution, Poisson}; Review Comment: Drive by comment: Would these imports be tidier if they were in the same block? There's several sections of datafusion, several sections of arrow. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
