Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
Description
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
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);
So for a Sql Query
SELECT name, nation FROM customer
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.
Attachments
Issue Links
- links to