SteNicholas commented on code in PR #1447:
URL: https://github.com/apache/paimon-rust/pull/1447#discussion_r4658243330


##########
crates/paimon/src/spec/generated_column.rs:
##########
@@ -0,0 +1,499 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! Generated-column metadata protection, without expression evaluation.
+
+use std::collections::{HashMap, HashSet};
+use std::sync::LazyLock;
+
+use regex::Regex;
+
+use crate::spec::{CoreOptions, DataField, DataType};
+use crate::{Error, Result};
+
+pub(super) fn validate_schema(
+    fields: &[DataField],
+    options: &HashMap<String, String>,
+) -> Result<()> {
+    let core_options = CoreOptions::new(options);
+    for field in fields {
+        validate_no_nested_generated_columns(field.data_type())?;
+        if field.generation_expression().is_none() {
+            continue;

Review Comment:
   Fixed in e24e33b1. Filesystem and REST CREATE now reject a new column 
carrying `generationExpression` before writing a schema file or sending a 
create request. Rust still loads opaque expressions from existing tables and 
preserves them across compatible schema changes.
   
   The filesystem regression reproduces your `source INT` and `generated STRING 
AS source` example and checks that no table or schema version is created. The 
direct REST API and catalog tests also pass, including `IF NOT EXISTS` for both 
missing and existing tables. I reran these tests on the rebased commit. 
[Filesystem 
regression](https://github.com/SteNicholas/paimon-rust/blob/e24e33b1aa1b3f3e4c178db7d0d173a6d5e2c95f/crates/paimon/src/catalog/filesystem.rs#L2458-L2503)
   



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