mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sro...@apache.org
Subject svn commit: r954243 - /mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/MySQLJDBCIDMigrator.java
Date Sun, 13 Jun 2010 15:33:56 GMT
Author: srowen
Date: Sun Jun 13 15:33:56 2010
New Revision: 954243

URL: http://svn.apache.org/viewvc?rev=954243&view=rev
Log:
INSERT IGNORE more sensible and faster than REPLACE INTO to handle possible duplicates

Modified:
    mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/MySQLJDBCIDMigrator.java

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/MySQLJDBCIDMigrator.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/MySQLJDBCIDMigrator.java?rev=954243&r1=954242&r2=954243&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/MySQLJDBCIDMigrator.java
(original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/MySQLJDBCIDMigrator.java
Sun Jun 13 15:33:56 2010
@@ -28,9 +28,8 @@ import javax.sql.DataSource;
  * 
  * <pre>
  * CREATE TABLE taste_id_migration (
- *   long_id BIGINT NOT NULL,
- *   string_id VARCHAR(255) NOT NULL,
- *   PRIMARY KEY (long_id)
+ *   long_id BIGINT NOT NULL PRIMARY KEY,
+ *   string_id VARCHAR(255) NOT NULL UNIQUE
  * )
  * </pre>
  * 
@@ -60,8 +59,9 @@ public final class MySQLJDBCIDMigrator e
                              String mappingTable,
                              String longIDColumn,
                              String stringIDColumn) {
-    super(dataSource, "SELECT " + stringIDColumn + " FROM " + mappingTable + " WHERE " +
longIDColumn + "=?",
-        "REPLACE INTO " + mappingTable + " (" + longIDColumn + ',' + stringIDColumn + ")
VALUES (?,?)");
+    super(dataSource,
+          "SELECT " + stringIDColumn + " FROM " + mappingTable + " WHERE " + longIDColumn
+ "=?",
+          "INSERT IGNORE INTO " + mappingTable + " (" + longIDColumn + ',' + stringIDColumn
+ ") VALUES (?,?)");
   }
   
 }
\ No newline at end of file



Mime
View raw message