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

Jiatao Tao commented on CALCITE-4482:
-------------------------------------

Hi [~julianhyde], in the frame, as you mentioned, are all used when 
SqlToRelConverter.AggConverter initializing.

 
{code:java}
for (int i = 0; i < selectList.size(); i++) {
  SqlNode selectItem = selectList.get(i);
  String name = null;
  if (SqlUtil.isCallTo(
      selectItem,
      SqlStdOperatorTable.AS)) {
    final SqlCall call = (SqlCall) selectItem;
    selectItem = call.operand(0);
    name = call.operand(1).toString();
  }
  if (name == null) {
    name = validator().deriveAlias(selectItem, i);
    assert name != null : "alias must not be null for " + selectItem + ", i=" + 
i;
  }
  nameMap.put(selectItem.toString(), name);
}
{code}

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

Reply via email to