Skip to content

Commit b1af8fe

Browse files
cj-zhukovSergey Zhukov
andauthored
Consolidate sql operations examples (apache#18142) (apache#18743)
## Which issue does this PR close? <!-- We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123. --> - part of #apache#18142. ## Rationale for this change This PR is for consolidating all the `sql_ops` examples (analysis, dialect, frontend, query) into a single example binary. We are agreed on the pattern and we can apply it to the remaining examples <!-- Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed. Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes. --> ## What changes are included in this PR? <!-- There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR. --> ## Are these changes tested? <!-- We typically require tests for all PRs in order to: 1. Prevent the code from being accidentally broken by subsequent changes 2. Serve as another way to document the expected behavior of the code If tests are not included in your PR, please explain why (for example, are they covered by existing tests)? --> ## Are there any user-facing changes? <!-- If there are user-facing changes then we may require documentation to be updated before approving the PR. --> <!-- If there are any breaking changes to public APIs, please add the `api change` label. --> --------- Co-authored-by: Sergey Zhukov <szhukov@aligntech.com>
1 parent d9d847e commit b1af8fe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+332
-144
lines changed

datafusion-examples/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ cargo run --example dataframe
9090
- [`examples/udf/simple_udf.rs`](examples/udf/simple_udf.rs): Define and invoke a User Defined Scalar Function (UDF)
9191
- [`examples/udf/simple_udtf.rs`](examples/udf/simple_udtf.rs): Define and invoke a User Defined Table Function (UDTF)
9292
- [`examples/udf/simple_udfw.rs`](examples/udf/simple_udwf.rs): Define and invoke a User Defined Window Function (UDWF)
93-
- [`sql_analysis.rs`](examples/sql_analysis.rs): Analyse SQL queries with DataFusion structures
94-
- [`sql_frontend.rs`](examples/sql_frontend.rs): Create LogicalPlans (only) from sql strings
95-
- [`sql_dialect.rs`](examples/sql_dialect.rs): Example of implementing a custom SQL dialect on top of `DFParser`
96-
- [`sql_query.rs`](examples/sql_query.rs): Query data using SQL (in memory `RecordBatches`, local Parquet files)
93+
- [`examples/sql_ops/analysis.rs`](examples/sql_ops/analysis.rs): Analyse SQL queries with DataFusion structures
94+
- [`examples/sql_ops/frontend.rs`](examples/sql_ops/frontend.rs): Create LogicalPlans (only) from sql strings
95+
- [`examples/sql_ops/dialect.rs`](examples/sql_ops/dialect.rs): Example of implementing a custom SQL dialect on top of `DFParser`
96+
- [`examples/sql_ops/query.rs`](examples/sql_ops/query.rs): Query data using SQL (in memory `RecordBatches`, local Parquet files)
9797

9898
## Distributed
9999

datafusion-examples/examples/builtin_functions/date_time.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18+
//! See `main.rs` for how to run it.
19+
1820
use std::sync::Arc;
1921

2022
use arrow::array::{Date32Array, Int32Array};

datafusion-examples/examples/builtin_functions/function_factory.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18+
//! See `main.rs` for how to run it.
19+
1820
use arrow::datatypes::DataType;
1921
use datafusion::common::tree_node::{Transformed, TreeNode};
2022
use datafusion::common::{exec_datafusion_err, exec_err, internal_err, DataFusionError};

datafusion-examples/examples/builtin_functions/regexp.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
// specific language governing permissions and limitations
1717
// under the License.
1818

19+
//! See `main.rs` for how to run it.
20+
1921
use datafusion::common::{assert_batches_eq, assert_contains};
2022
use datafusion::error::Result;
2123
use datafusion::prelude::*;

datafusion-examples/examples/custom_data_source/csv_json_opener.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18+
//! See `main.rs` for how to run it.
19+
1820
use std::sync::Arc;
1921

2022
use arrow::datatypes::{DataType, Field, Schema};

datafusion-examples/examples/custom_data_source/csv_sql_streaming.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18+
//! See `main.rs` for how to run it.
19+
1820
use datafusion::common::test_util::datafusion_test_data;
1921
use datafusion::error::Result;
2022
use datafusion::prelude::*;

datafusion-examples/examples/custom_data_source/custom_datasource.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18+
//! See `main.rs` for how to run it.
19+
1820
use std::any::Any;
1921
use std::collections::{BTreeMap, HashMap};
2022
use std::fmt::{self, Debug, Formatter};

datafusion-examples/examples/custom_data_source/custom_file_casts.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18+
//! See `main.rs` for how to run it.
19+
1820
use std::sync::Arc;
1921

2022
use arrow::array::{record_batch, RecordBatch};

datafusion-examples/examples/custom_data_source/custom_file_format.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18+
//! See `main.rs` for how to run it.
19+
1820
use std::{any::Any, sync::Arc};
1921

2022
use arrow::{

datafusion-examples/examples/custom_data_source/file_stream_provider.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18+
//! See `main.rs` for how to run it.
19+
1820
/// Demonstrates how to use [`FileStreamProvider`] and [`StreamTable`] to stream data
1921
/// from a file-like source (FIFO) into DataFusion for continuous querying.
2022
///

0 commit comments

Comments
 (0)