[ 
https://issues.apache.org/jira/browse/FLINK-8865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16639924#comment-16639924
 ] 

ASF GitHub Bot commented on FLINK-8865:
---------------------------------------

twalthr commented on a change in pull request #6791: [FLINK-8865][sql-client] 
Add CLI query code completion in SQL Client
URL: https://github.com/apache/flink/pull/6791#discussion_r223035081
 
 

 ##########
 File path: 
flink-libraries/flink-sql-client/src/main/java/org/apache/flink/table/client/gateway/local/LocalExecutor.java
 ##########
 @@ -233,6 +238,36 @@ public String explainStatement(SessionContext session, 
String statement) throws
                }
        }
 
+       public org.apache.calcite.schema.Table getTable(SessionContext session, 
String name) throws SqlExecutionException {
+               final TableEnvironment tableEnv = 
getOrCreateExecutionContext(session)
+                       .createEnvironmentInstance()
+                       .getTableEnvironment();
+
+               Class<?> clazz = Object.class;
+               if (tableEnv instanceof StreamTableEnvironment) {
+                       StreamTableEnvironment tmpTableEnv = 
(StreamTableEnvironment) tableEnv;
+                       clazz = tmpTableEnv.getClass();
+               } else if (tableEnv instanceof BatchTableEnvironment) {
+                       BatchTableEnvironment tmpTableEnv = 
(BatchTableEnvironment) tableEnv;
+                       clazz = tmpTableEnv.getClass();
+               }
+
+               for (; clazz != Object.class; clazz = clazz.getSuperclass()) {
+                       try {
+                               Method[] methods = clazz.getDeclaredMethods();
+
+                               Method mt = clazz.getDeclaredMethod("getTable", 
String.class);
 
 Review comment:
   Instead of ugly reflection, we should implement a proper solution in the 
table environment.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Add CLI query code completion in SQL Client
> -------------------------------------------
>
>                 Key: FLINK-8865
>                 URL: https://issues.apache.org/jira/browse/FLINK-8865
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table API &amp; SQL
>            Reporter: Timo Walther
>            Assignee: xueyu
>            Priority: Major
>              Labels: pull-request-available
>
> This issue is a subtask of part two "Full Embedded SQL Client" of the 
> implementation plan mentioned inĀ 
> [FLIP-24|https://cwiki.apache.org/confluence/display/FLINK/FLIP-24+-+SQL+Client].
> Calcite already offers a code completion functionality. It would be great if 
> we could expose this feature also through the SQL CLI Client.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to