Repository: ArroyoSystems/arroyo (language: rust)

Issue:
Codegen panics when SQL aliases are not valid Rust identifiers
For example, this query:

```sql
SELECT 'a' as "1"
from nexmark;
```

produces a panic:

```
ERROR arroyo_server_common: panicked at 'Ident cannot be a number; use Literal instead', /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.66/src/fallback.rs:756:9 panic.file="/root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.66/src/fallback.rs" panic.line=756 panic.column=9
```



Discussion / hints:

Fix patch:
diff --git a/arroyo-sql/src/types.rs b/arroyo-sql/src/types.rs
index 4f9d6a553..efc6e1860 100644
--- a/arroyo-sql/src/types.rs
+++ b/arroyo-sql/src/types.rs
@@ -665,7 +665,7 @@ impl StructField {
         match parse_str(&self.field_name()) {
             Ok(ident) => ident,
             Err(_) => {
-                format_ident!("r#{}", self.field_name())
+                format_ident!("r#_{}", self.field_name())
             }
         }
     }


Test patch:
diff --git a/arroyo-sql-testing/src/full_query_tests.rs b/arroyo-sql-testing/src/full_query_tests.rs
index cfdae3c0a..b1ba5f1a9 100644
--- a/arroyo-sql-testing/src/full_query_tests.rs
+++ b/arroyo-sql-testing/src/full_query_tests.rs
@@ -436,3 +436,9 @@ full_pipeline_codegen! {"polling_http_source",
 SELECT value
 FROM polling_source;
 "}
+
+full_pipeline_codegen! {"aliases",
+"
+SELECT 'a' as \"1\"
+from nexmark;
+"}