You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Alessandro Solimando (Jira)" <ji...@apache.org> on 2024/08/08 12:12:00 UTC

[jira] [Resolved] (CALCITE-6471) Improve performance of SqlToRelConverter by preventing unconditional conversion of sqlNodes to string for null-check messages

     [ https://issues.apache.org/jira/browse/CALCITE-6471?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alessandro Solimando resolved CALCITE-6471.
-------------------------------------------
    Resolution: Fixed

Fixed via [{{2d6e9a7}}|https://github.com/apache/calcite/commit/2d6e9a7dda70313bbfcf0e39f4cffc1404f1f521], thanks for your contribution [~korlov], and thanks to [~mbudiu] and [~caicancai] for your reviews!

> Improve performance of SqlToRelConverter by preventing unconditional conversion of sqlNodes to string for null-check messages 
> ------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-6471
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6471
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.37.0
>            Reporter: Konstantin Orlov
>            Assignee: Konstantin Orlov
>            Priority: Minor
>              Labels: pull-request-available
>
> Currently, {{SqlToRelConverter}} contains a few places where {{sqlNode}} is concatenated to some prefix and passed as plain string rather that message supplier as parameter to {{requireNonNull}} method. These are, namely, lines 1019, 4031, and 5344 at commit  29c413a3:
> {code:java}
>         SqlNode elseOperand =
>             requireNonNull(caseNode.getElseOperand(),
>                 "getElseOperand for " + caseNode);
> {code}
> {code:java}
>   protected RelOptTable getTargetTable(SqlNode call) {
>     final SqlValidatorNamespace targetNs = getNamespace(call);
>     SqlValidatorNamespace namespace;
>     if (targetNs.isWrapperFor(SqlValidatorImpl.DmlNamespace.class)) {
>       namespace = targetNs.unwrap(SqlValidatorImpl.DmlNamespace.class);
>     } else {
>       namespace = targetNs.resolve();
>     }
>     RelOptTable table = SqlValidatorUtil.getRelOptTable(namespace, catalogReader, null, null);
>     return requireNonNull(table, "no table found for " + call);
>   }
> {code}
> {code:java}
>           return Pair.of(c, (e, fieldName) -> {
>             final int j = requireNonNull(fieldMap.get(fieldName), "field " + fieldName);
>             return rexBuilder.makeFieldAccess(e, j);
>           });
> {code}
> We can shave a few microseconds by simply replacing plain string with message supplier.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)