featzhang commented on code in PR #28145:
URL: https://github.com/apache/flink/pull/28145#discussion_r3228515857


##########
flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/cli/parser/SqlClientSyntaxHighlighter.java:
##########
@@ -47,15 +47,23 @@ public class SqlClientSyntaxHighlighter extends 
DefaultHighlighter {
                             .map(t -> t.replaceAll("\"", ""))
                             .collect(Collectors.toSet()));
 
-    private final Executor executor;
+    private ReadableConfig configuration;
 
     public SqlClientSyntaxHighlighter(Executor executor) {
-        this.executor = executor;
+        updateSessionConfig(executor.getSessionConfig());
+    }
+
+    public void updateSessionConfig(ReadableConfig configuration) {
+        if (configuration != null) {
+            this.configuration = configuration;
+        }
     }
 
     @Override
     public AttributedString highlight(LineReader reader, String buffer) {
-        ReadableConfig configuration = executor.getSessionConfig();
+        if (configuration == null) {

Review Comment:
   The null-guard is defensive, but when would `configuration` be null after 
construction?
   
   The constructor calls `updateSessionConfig(executor.getSessionConfig())`, 
which guards against null. If `executor.getSessionConfig()` can return null, 
maybe the constructor should handle it explicitly:
   
   ```java
   public SqlClientSyntaxHighlighter(Executor executor) {
       ReadableConfig config = executor.getSessionConfig();
       if (config == null) {
           // LOG.warn or throw?
       }
       this.configuration = config;
   }
   ```
   
   Otherwise the null-check in `highlight()` might mask an initialization issue.



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