db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1577566 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MergeNode.java
Date Fri, 14 Mar 2014 15:20:45 GMT
Author: rhillegas
Date: Fri Mar 14 15:20:45 2014
New Revision: 1577566

URL: http://svn.apache.org/r1577566
Log:
DERBY-3155: Eliminate redundant copies of columns in the select list of the driving left join
for MERGE statements; commit derby-3155-43-aa-eliminateDuplicateColumnRefs.diff.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MergeNode.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MergeNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MergeNode.java?rev=1577566&r1=1577565&r2=1577566&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MergeNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MergeNode.java Fri Mar
14 15:20:45 2014
@@ -24,6 +24,7 @@ package	org.apache.derby.impl.sql.compil
 import java.util.Arrays;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 
 import org.apache.derby.iapi.error.StandardException;
@@ -391,7 +392,7 @@ public final class MergeNode extends DML
             }
 
             ResultColumnList    selectList = buildSelectList();
-            
+
             // save a copy so that we can remap column references when generating the temporary
rows
             _selectList = selectList.copyListAndObjects();
 
@@ -687,15 +688,15 @@ public final class MergeNode extends DML
     /** Get the column names from the table with the given table number, in sorted order
*/
     private String[]    getColumns( int mergeTableID, HashMap<String,ColumnReference>
map )
     {
-        ArrayList<String>   list = new ArrayList<String>();
+        HashSet<String>     set = new HashSet<String>();
 
         for ( ColumnReference cr : map.values() )
         {
-            if ( cr.getMergeTableID() == mergeTableID ) { list.add( cr.getColumnName() );
}
+            if ( cr.getMergeTableID() == mergeTableID ) { set.add( cr.getColumnName() );
}
         }
 
-        String[]    retval = new String[ list.size() ];
-        list.toArray( retval );
+        String[]    retval = new String[ set.size() ];
+        set.toArray( retval );
         Arrays.sort( retval );
 
         return retval;



Mime
View raw message