wuwenchi commented on PR #4246:
URL: https://github.com/apache/iceberg/pull/4246#issuecomment-1110614217

   Hello, @hililiwei , can you help with a question?
   
   In PR #4625, I want to support watermark and computed columns with `Schema` 
and `ResolvedSchema`. I plan to record these expressions in table properties. 
However, when the user modifies the expression through the table properties, 
the content of the expression needs to be verified. 
   
   I first created a builder through `Schema.Builder`, and then want to use the 
`resolve` method of `Schema` to convert it to `ResolvedSchema`. In this 
conversion process, the verification of the expression has actually been 
completed.
   
   But the problem is that the input parameter of resolve is a schemaResolver. 
This value is a private property in `CatalogManager` and it is not available in 
the context where the user modifies the table property. So I built one myself 
by this method:
   ```
     public static ResolvedSchema convertToResolvedSchema(CatalogTable table) {
       StreamExecutionEnvironment env =  
StreamExecutionEnvironment.getExecutionEnvironment(new Configuration());
       StreamTableEnvironment streamTableEnvironment = 
StreamTableEnvironment.create(env);
       CatalogManager catalogManager = ((TableEnvironmentImpl) 
streamTableEnvironment).getCatalogManager();
       SchemaResolver schemaResolver = catalogManager.getSchemaResolver();
       return table.getUnresolvedSchema().resolve(schemaResolver);
     }
   ```
   
   But I feel this method is not very good, do you have a better solution?


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