mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-09 21:42:05 +00:00
Add support of parsing struct field's options in BigQuery (#1890)
Some checks failed
license / Release Audit Tool (RAT) (push) Has been cancelled
Rust / codestyle (push) Has been cancelled
Rust / lint (push) Has been cancelled
Rust / benchmark-lint (push) Has been cancelled
Rust / compile (push) Has been cancelled
Rust / docs (push) Has been cancelled
Rust / compile-no-std (push) Has been cancelled
Rust / test (beta) (push) Has been cancelled
Rust / test (nightly) (push) Has been cancelled
Rust / test (stable) (push) Has been cancelled
Some checks failed
license / Release Audit Tool (RAT) (push) Has been cancelled
Rust / codestyle (push) Has been cancelled
Rust / lint (push) Has been cancelled
Rust / benchmark-lint (push) Has been cancelled
Rust / compile (push) Has been cancelled
Rust / docs (push) Has been cancelled
Rust / compile-no-std (push) Has been cancelled
Rust / test (beta) (push) Has been cancelled
Rust / test (nightly) (push) Has been cancelled
Rust / test (stable) (push) Has been cancelled
Co-authored-by: Ifeanyi Ubah <ify1992@yahoo.com>
This commit is contained in:
parent
be30697efb
commit
b1b379e570
5 changed files with 138 additions and 52 deletions
|
@ -428,14 +428,22 @@ impl fmt::Display for Interval {
|
|||
pub struct StructField {
|
||||
pub field_name: Option<Ident>,
|
||||
pub field_type: DataType,
|
||||
/// Struct field options.
|
||||
/// See [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#column_name_and_column_schema)
|
||||
pub options: Option<Vec<SqlOption>>,
|
||||
}
|
||||
|
||||
impl fmt::Display for StructField {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
if let Some(name) = &self.field_name {
|
||||
write!(f, "{name} {}", self.field_type)
|
||||
write!(f, "{name} {}", self.field_type)?;
|
||||
} else {
|
||||
write!(f, "{}", self.field_type)
|
||||
write!(f, "{}", self.field_type)?;
|
||||
}
|
||||
if let Some(options) = &self.options {
|
||||
write!(f, " OPTIONS({})", display_separated(options, ", "))
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue