shyjsarah commented on code in PR #444:
URL: https://github.com/apache/paimon-rust/pull/444#discussion_r3518752979


##########
crates/integrations/datafusion/src/table/mod.rs:
##########
@@ -89,6 +97,119 @@ impl PaimonTableProvider {
     }
 }
 
+/// Build a `CREATE TABLE` DDL string for a Paimon table.
+///
+/// Mirrors the syntax accepted by `SQLContext::handle_create_table`:
+/// `CREATE TABLE <db>.<table> (<col> <type>, ..., PRIMARY KEY (...)) 
[PARTITIONED BY (...)] [WITH ('k'='v', ...)]`.
+fn build_table_definition(table: &Table) -> String {
+    let identifier = table.identifier();
+    let schema = table.schema();
+    let mut ddl = String::new();
+    let _ = write!(
+        ddl,
+        "CREATE TABLE {}.{} (",
+        identifier.database(),
+        identifier.object()
+    );
+
+    for (i, field) in schema.fields().iter().enumerate() {
+        if i > 0 {
+            ddl.push_str(", ");
+        }
+        let _ = write!(

Review Comment:
   Fixed in 4795977 — `data_type_to_sql` now preserves `NOT NULL` for 
non-nullable types. A follow-up (c0ffdf6) moved the `NOT NULL` suffix out of 
`data_type_to_sql` and into `build_table_definition`, so it only renders at the 
column level and doesn't leak into nested type arguments like `MAP(INT NOT 
NULL, ...)`.



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

Reply via email to