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

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

fhueske commented on a change in pull request #6606: [FLINK-10163] [sql-client] 
Support views in SQL Client
URL: https://github.com/apache/flink/pull/6606#discussion_r212693978
 
 

 ##########
 File path: 
flink-libraries/flink-sql-client/src/main/java/org/apache/flink/table/client/cli/CliClient.java
 ##########
 @@ -390,51 +395,101 @@ private void callSelect(SqlCommandCall cmdCall) {
                        view.open();
 
                        // view left
-                       
terminal.writer().println(CliStrings.messageInfo(CliStrings.MESSAGE_RESULT_QUIT).toAnsi());
-                       terminal.flush();
+                       printInfo(CliStrings.MESSAGE_RESULT_QUIT);
                } catch (SqlExecutionException e) {
-                       printException(e);
+                       printExecutionException(e);
                }
        }
 
        private boolean callInsertInto(SqlCommandCall cmdCall) {
-               
terminal.writer().println(CliStrings.messageInfo(CliStrings.MESSAGE_SUBMITTING_STATEMENT).toAnsi());
-               terminal.flush();
+               printInfo(CliStrings.MESSAGE_SUBMITTING_STATEMENT);
 
                try {
                        final ProgramTargetDescriptor programTarget = 
executor.executeUpdate(context, cmdCall.operands[0]);
                        
terminal.writer().println(CliStrings.messageInfo(CliStrings.MESSAGE_STATEMENT_SUBMITTED).toAnsi());
                        terminal.writer().println(programTarget.toString());
                        terminal.flush();
                } catch (SqlExecutionException e) {
-                       printException(e);
+                       printExecutionException(e);
                        return false;
                }
                return true;
        }
 
-       private void callSource(SqlCommandCall cmdCall) {
-               final String pathString = cmdCall.operands[0];
+       private void callCreateView(SqlCommandCall cmdCall) {
+               final String name = cmdCall.operands[0];
+               final String query = cmdCall.operands[1];
+
+               try {
+                       // validate with a copy
+                       final SessionContext contextCopy = context.copy();
 
 Review comment:
   This check fails if the VIEW query contains UDFs. 
   It seems that these are not registered yet.

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


> Support CREATE VIEW in SQL Client
> ---------------------------------
>
>                 Key: FLINK-10163
>                 URL: https://issues.apache.org/jira/browse/FLINK-10163
>             Project: Flink
>          Issue Type: New Feature
>          Components: Table API & SQL
>            Reporter: Timo Walther
>            Assignee: Timo Walther
>            Priority: Major
>              Labels: pull-request-available
>
> The possibility to define a name for a subquery would improve the usability 
> of the SQL Client. The SQL standard defines \{{CREATE VIEW}} for defining a 
> virtual table.
>  
> Example:
> {code}
>  CREATE VIEW viewName
>  [ '(' columnName [, columnName ]* ')' ]
>  AS Query
> {code}



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

Reply via email to