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

Shengkai Fang commented on FLINK-22655:
---------------------------------------

Thanks for your hint. The solution doesn' t fix the problem when comment is in 
the same line, e.g. {{SET key = value; -- COMMENT}}. 

I think a better solution is use {{MASK}} to clean the lines.


{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(
                        buffer.stream()
                                .map(statementLine -> 
statementLine.replaceAll(MASK, ""))
                                .collect(Collectors.joining("\n")));
                buffer.clear();
            } else {
                buffer.add(line);
            }
        }
        if (!buffer.isEmpty()) {
            statements.add(String.join("\n", buffer));
        }
        return statements;
    }
{code}

Are you willing to help to fix this? 

> 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