You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2018/10/23 07:50:00 UTC

[jira] [Commented] (CALCITE-2636) SQL parser has quadratic running time when SQL string is very large

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

Julian Hyde commented on CALCITE-2636:
--------------------------------------

Here is a test case and proposed fix: https://github.com/julianhyde/calcite/tree/2636-quadratic-parser. [~gian], can you please review.

> SQL parser has quadratic running time when SQL string is very large
> -------------------------------------------------------------------
>
>                 Key: CALCITE-2636
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2636
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Julian Hyde
>            Assignee: Julian Hyde
>            Priority: Major
>
> SQL parser has quadratic running time when SQL string is very large.
> This is due to {{SimpleCharStream.ExpandBuff(boolean)}} increasing the buffer in increments of 2,048 (2k) chars. If the SQL string is, say, 1,024k characters, then it will re-alloc at size 2k, 4k, 6k, ...,  1023k, and each time copy the whole string.
> This issue was discovered by [~gian].



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