Skip to content

Commit

Permalink
fix: remove code change and fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
kysshsy committed Dec 14, 2024
1 parent 9bbc5e2 commit 9c0f756
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
6 changes: 1 addition & 5 deletions src/fdw/trigger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,7 @@ fn construct_alter_table_statement(
column_name.to_string()
};

format!(
"ADD COLUMN {} {}",
spi::quote_identifier(column_name),
pg_type
)
format!("ADD COLUMN {} {}", column_name, pg_type)
})
.collect();

Expand Down
24 changes: 21 additions & 3 deletions tests/tests/fixtures/arrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,23 +245,41 @@ pub fn primitive_record_batch_single() -> Result<RecordBatch> {
}

pub fn reserved_column_record_batch() -> Result<RecordBatch> {
// INTEGER authorization is a reserved column name
// authorization is a reserved column name
let fields = vec![
Field::new("INTEGER", DataType::Int32, false),
Field::new("id", DataType::Utf8, false),
Field::new("operation_id", DataType::Utf8, false),
Field::new("order_id", DataType::Utf8, false),
Field::new("dealer_id", DataType::Utf8, false),
Field::new("dealer_name", DataType::Utf8, false),
Field::new("authorization", DataType::Utf8, false),
Field::new("on_day", DataType::Boolean, false),
];

let schema = Arc::new(Schema::new(fields));

Ok(RecordBatch::try_new(
schema,
vec![
Arc::new(Int32Array::from(vec![1, 2, 3])),
Arc::new(StringArray::from(vec![Some("1"), Some("2"), Some("3")])),
Arc::new(StringArray::from(vec![Some("1"), Some("2"), Some("3")])),
Arc::new(StringArray::from(vec![Some("1"), Some("2"), Some("3")])),
Arc::new(StringArray::from(vec![Some("1"), Some("2"), Some("3")])),
Arc::new(StringArray::from(vec![
Some("Jason"),
Some("Alice"),
Some("Bob"),
])),
Arc::new(StringArray::from(vec![
Some("auth_1"),
Some("auth_2"),
Some("auth_3"),
])),
Arc::new(BooleanArray::from(vec![
Some(true),
Some(false),
Some(true),
])),
],
)?)
}
Expand Down
2 changes: 1 addition & 1 deletion tests/tests/table_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ fn test_reserved_column_name(mut conn: PgConnection, tempdir: TempDir) -> Result
setup_parquet_wrapper_and_server().execute(&mut conn);

match format!(
"CREATE FOREIGN TABLE reserved_table_name () SERVER parquet_server OPTIONS (files '{}')",
"CREATE FOREIGN TABLE reserved_table_name () SERVER parquet_server OPTIONS (files '{}', preserve_casing 'true')",
parquet_path.to_str().unwrap()
)
.execute_result(&mut conn)
Expand Down

0 comments on commit 9c0f756

Please sign in to comment.