Copilot commented on code in PR #27524:
URL: https://github.com/apache/datafusion/pull/27524#discussion_r4600868024
##########
datafusion/sql/src/unparser/expr.rs:
##########
@@ -1811,6 +1811,30 @@ impl Unparser<'_> {
}))
}
+ fn array_to_ast_dtype(
+ &self,
+ data_type: &DataType,
+ inner: &FieldRef,
+ size: Option<i32>,
+ ) -> Result<ast::DataType> {
+ let elem = Box::new(self.arrow_dtype_to_ast_dtype(inner)?);
+ let elem_def = match (self.dialect.array_type_style(), size) {
+ (ArrayTypeStyle::SquareBracket, size) => {
+ ast::ArrayElemTypeDef::SquareBracket(elem, size.map(|s| s as
u64))
+ }
+ (ArrayTypeStyle::AngleBracket, None) => {
+ ast::ArrayElemTypeDef::AngleBracket(elem)
Review Comment:
With `BigQueryDialect`, casting to `List(List(Utf8))` now succeeds as
`CAST(... AS ARRAY<ARRAY<STRING>>)`, but [BigQuery explicitly prohibits arrays
whose elements are
arrays](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/data-types#array_type).
This replaces the previous unsupported-type error with SQL that the target
database rejects; the new nested BigQuery test also expects this invalid type.
Please add a dialect-specific check that rejects nested arrays for BigQuery and
update that test to expect an error, while retaining nested-array support for
dialects that allow it.
--
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]