Skip to content

Commit

Permalink
fix clippy and add license
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb committed Sep 27, 2024
1 parent 8d3bc19 commit e1151eb
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions datafusion/core/tests/user_defined/insert_operation.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
// 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 std::{any::Any, sync::Arc};

use arrow_schema::{DataType, Field, Schema, SchemaRef};
Expand All @@ -20,16 +37,16 @@ async fn insert_operation_is_passed_correctly_to_table_provider() {
.unwrap();

let sql = "INSERT INTO testing (column) VALUES (1)";
assert_insert_op(&ctx, &sql, InsertOp::Append).await;
assert_insert_op(&ctx, sql, InsertOp::Append).await;

let sql = "INSERT OVERWRITE testing (column) VALUES (1)";
assert_insert_op(&ctx, &sql, InsertOp::Overwrite).await;
assert_insert_op(&ctx, sql, InsertOp::Overwrite).await;

let sql = "REPLACE INTO testing (column) VALUES (1)";
assert_insert_op(&ctx, &sql, InsertOp::Replace).await;
assert_insert_op(&ctx, sql, InsertOp::Replace).await;

let sql = "INSERT OR REPLACE INTO testing (column) VALUES (1)";
assert_insert_op(&ctx, &sql, InsertOp::Replace).await;
assert_insert_op(&ctx, sql, InsertOp::Replace).await;
}

async fn assert_insert_op(ctx: &SessionContext, sql: &str, insert_op: InsertOp) {
Expand All @@ -46,6 +63,7 @@ fn session_ctx_with_dialect(dialect: impl Into<String>) -> SessionContext {
SessionContext::new_with_config(config)
}

#[derive(Debug)]
struct TestInsertTableProvider {
schema: SchemaRef,
}
Expand Down

0 comments on commit e1151eb

Please sign in to comment.