[
https://issues.apache.org/jira/browse/CALCITE-4994?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17485060#comment-17485060
]
Julian Hyde commented on CALCITE-4994:
--------------------------------------
I'm wondering why you added commit
[bfc043ec|https://github.com/apache/calcite/pull/2701/commits/bfc043ec998e562d8ea286d7e3b7844e4967075e]
to your PR. Your commit makes {{lookupExp}} method nullable, which is what it
used to be; my commit
[0f143553|https://github.com/julianhyde/calcite/commit/0f14355323ace283b1189cf0c62cb19c38e7479e]
makes it non-nullable (both in declared type and in practice - the point that
used to return null now throws {{AssertionError}}).
I think what I did is preferable.
It was difficult to tell what you intended because you squashed all of my
changes into a single commit 6a13f467ec.
> 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
> Time Spent: 0.5h
> 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)