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 2022/02/01 09:08:00 UTC
[jira] [Resolved] (CALCITE-4994) SQL-to-RelNode conversion is slow if table contains hundreds of fields
[ https://issues.apache.org/jira/browse/CALCITE-4994?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Julian Hyde resolved CALCITE-4994.
----------------------------------
Fix Version/s: 1.30.0
Resolution: Fixed
Fixed in [e6f7cac6|https://github.com/apache/calcite/commit/e6f7cac6a2fc4cd4ddf9dc6f29723947cbf99afe]; thanks for the PR, [~jaynarale]!
> SQL-to-RelNode conversion is slow if table contains hundreds of fields
> ----------------------------------------------------------------------
>
> Key: CALCITE-4994
> URL: https://issues.apache.org/jira/browse/CALCITE-4994
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Reporter: Jay Narale
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.30.0
>
> Time Spent: 40m
> Remaining Estimate: 0h
>
> When converting from Sql To Rel, In SqlToRelConverter for every single instance of an identifier we create a new map in
> *_org.apache.calcite.sql2rel.SqlToRelConverter.Blackboard#lookupExp_*
>
> {code:java}
> final Map<String, Integer> fieldOffsets = new HashMap<>();
> for (RelDataTypeField f : resolve.rowType().getFieldList()) {
> if (!fieldOffsets.containsKey(f.getName())) {
> fieldOffsets.put(f.getName(), f.getIndex());
> }
> }
> final Map<String, Integer> map = ImmutableMap.copyOf(fieldOffsets);{code}
>
> So for a Sql Query
> {code:java}
> SELECT name, nation FROM customer{code}
> We would do the above operation twice.
> Memoization of this information will improve performance.
> In my database, I had observed that for a large table involving 1200 columns and a huge select having multiple expressions and operators, this part was a bottleneck.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)