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

JasonLee commented on FLINK-22655:
----------------------------------

Hi ShengKai,I think adding a judgment condition to this method can solve this 
problem like the following, what do you think ?
{code:java}
public static List<String> splitContent(String content) {
    List<String> statements = new ArrayList<>();
    List<String> buffer = new ArrayList<>();

    for (String line : content.split("\n")) {
        if (isEndOfStatement(line)) {
            buffer.add(line);
            statements.add(String.join("\n", buffer));
            buffer.clear();
        } else if (!line.startsWith("--")) {
            buffer.add(line);
        }
    }
    if (!buffer.isEmpty()) {
        statements.add(String.join("\n", buffer));
    }
    return statements;
}
{code}
 

> When using -i <init.sql> option to initialize SQL Client session It should be 
> possible to annotate the script with --
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: FLINK-22655
>                 URL: https://issues.apache.org/jira/browse/FLINK-22655
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table SQL / Client
>    Affects Versions: 1.13.0
>            Reporter: JasonLee
>            Assignee: Shengkai Fang
>            Priority: Major
>             Fix For: 1.14.0
>
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to