alamb commented on code in PR #19672:
URL: https://github.com/apache/datafusion/pull/19672#discussion_r2674047101


##########
datafusion/sql/src/statement.rs:
##########
@@ -102,78 +103,72 @@ fn get_schema_name(schema_name: &SchemaName) -> String {
 /// Construct `TableConstraint`(s) for the given columns by iterating over
 /// `columns` and extracting individual inline constraint definitions.
 fn calc_inline_constraints_from_columns(columns: &[ColumnDef]) -> 
Vec<TableConstraint> {
-    let mut constraints = vec![];
+    let mut constraints: Vec<TableConstraint> = vec![];
     for column in columns {
         for ast::ColumnOptionDef { name, option } in &column.options {
             match option {
-                ast::ColumnOption::Unique {
-                    is_primary: false,
-                    characteristics,
-                } => constraints.push(TableConstraint::Unique {
-                    name: name.clone(),
-                    columns: vec![IndexColumn {
-                        column: OrderByExpr {
-                            expr: SQLExpr::Identifier(column.name.clone()),
-                            options: OrderByOptions {
-                                asc: None,
-                                nulls_first: None,
+                ast::ColumnOption::Unique(constraint) => {

Review Comment:
   I think Jefffry is suggesting explicitly destructuring like 
   ```rust
   ast::ColumnOption::Unique(UniqueConstraint {
     name, 
     index_name, 
     ...
     nulls_distinct: _,
   }) => {
   ```
   
   So that it is clear which of the fields are handled and which are ignored



##########
datafusion/sql/src/query.rs:
##########
@@ -170,6 +170,7 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
                     name: alias,
                     // Apply to all fields
                     columns: vec![],
+                    explicit: true,

Review Comment:
   so doesn't that mean we should match here on ` explicit: _` (to match both 
forms)? As written this code will no longer accept the `FROM table t` format if 
I understand correctly



-- 
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]

Reply via email to