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

Julian Hyde commented on CALCITE-1666:
--------------------------------------

[~kliew], regarding your comment

{quote}
If projectMap is a SortedMap, we could use a PriorityQueue here to improve the 
time complexity. wdyt?
{quote}

I think you can optimize

{code}
          Integer projectedOrdinal = null;
          for (Integer ordinal : modifiableViewTable.getColumnMapping()) {
            if (entry.getKey().intValue() == ordinal.intValue()) {
              projectedOrdinal = ordinal;
              break;
            }
          }
          if (projectedOrdinal == null) {
            // The constrained column was not projected in the view definition.
            continue;
          }
{code}

to something like

{code}
if (!modifiableViewTable.getColumnMapping().contains(entry.getKey())) {
  continue;
}
{code}

And if you need to intersect the sets of column ids consider creating an 
{{ImmutableBitSet}} for each and using {{ImmutableBitSet#intersects}}. This 
compares bits in order so is basically doing a "merge".

> Support for modifiable views with extended columns
> --------------------------------------------------
>
>                 Key: CALCITE-1666
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1666
>             Project: Calcite
>          Issue Type: Improvement
>    Affects Versions: 1.11.0
>            Reporter: Kevin Liew
>            Assignee: Julian Hyde
>              Labels: validator, view
>
> The changes for this PR is to:
> - propagate extended columns (already parsed into namespaces in the 
> validator) through to the planner
> - validate {{INSERT}} and {{UPDATE}} operations against the constraints of 
> the modifiable view
> [~maryannxue], [~rajeshbabu], [~jamestaylor]



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to