[ https://issues.apache.org/jira/browse/CALCITE-4482?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17276300#comment-17276300 ]
Jiatao Tao commented on CALCITE-4482: ------------------------------------- Yeah, from the succinct perspective, it's better to do this in SqlPrettyWriter; do in SqlNode, we can save more CPU time cuz we don't do the lambda again and again. But I think the cost is not so big so I'll do this in SqlPrettyWriter. c -> c.withDialect(AnsiSqlDialect.DEFAULT) .withAlwaysUseParentheses(false) .withSelectListItemsOnSeparateLines(false) .withUpdateSetListNewline(false) .withIndentation(0); !image-2021-02-01-20-52-54-892.png|width=1310,height=207! > "ImmutableBeans.create" has performance issue > --------------------------------------------- > > Key: CALCITE-4482 > URL: https://issues.apache.org/jira/browse/CALCITE-4482 > Project: Calcite > Issue Type: Bug > Reporter: Jiatao Tao > Assignee: Jiatao Tao > Priority: Major > Attachments: image-2021-02-01-15-42-46-942.png, > image-2021-02-01-15-45-11-863.png, image-2021-02-01-15-46-08-056.png, > image-2021-02-01-15-47-31-577.png, image-2021-02-01-20-52-54-892.png > > > We are doing the stressing test, and we found SqlNode#toString's time is > unusually high, seems the call is all from SqlNode#toString, we can reduce > the useless call of "ImmutableBeans.create" to reduce the time: > My proposal is to extra default SqlWriterConfig to SqlNode and > SqlNode#toString use this static field. > > {code:java} > public static final SqlWriterConfig DEFAULT_SQL_WRITER_CONFIG = > SqlPrettyWriter.config().withDialect(AnsiSqlDialect.DEFAULT) > .withAlwaysUseParentheses(false) > .withSelectListItemsOnSeparateLines(false) > .withUpdateSetListNewline(false) > .withIndentation(0); > {code} > > -- This message was sent by Atlassian Jira (v8.3.4#803005)