From 40a68041925190adcac35f6f844d325fdb1a71f7 Mon Sep 17 00:00:00 2001 From: Crystark Date: Mon, 7 Apr 2014 17:37:03 +0200 Subject: [PATCH] Support for postgresql I think it was the last request using 'end' missing the postgresql support. --- .../src/main/java/io/druid/indexer/DbUpdaterJob.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/indexing-hadoop/src/main/java/io/druid/indexer/DbUpdaterJob.java b/indexing-hadoop/src/main/java/io/druid/indexer/DbUpdaterJob.java index 36b67e10c05..543d2c40bf1 100644 --- a/indexing-hadoop/src/main/java/io/druid/indexer/DbUpdaterJob.java +++ b/indexing-hadoop/src/main/java/io/druid/indexer/DbUpdaterJob.java @@ -39,13 +39,15 @@ public class DbUpdaterJob implements Jobby private final HadoopDruidIndexerConfig config; private final IDBI dbi; + private final DbConnector dbConnector; public DbUpdaterJob( HadoopDruidIndexerConfig config ) { this.config = config; - this.dbi = new DbConnector(config.getUpdaterJobSpec(), null).getDBI(); + this.dbConnector = new DbConnector(config.getUpdaterJobSpec(), null); + this.dbi = this.dbConnector.getDBI(); } @Override @@ -61,8 +63,11 @@ public class DbUpdaterJob implements Jobby { final PreparedBatch batch = handle.prepareBatch( String.format( - "INSERT INTO %s (id, dataSource, created_date, start, end, partitioned, version, used, payload) " - + "VALUES (:id, :dataSource, :created_date, :start, :end, :partitioned, :version, :used, :payload)", + dbConnector.isPostgreSQL() ? + "INSERT INTO %s (id, dataSource, created_date, start, \"end\", partitioned, version, used, payload) " + + "VALUES (:id, :dataSource, :created_date, :start, :end, :partitioned, :version, :used, :payload)" : + "INSERT INTO %s (id, dataSource, created_date, start, end, partitioned, version, used, payload) " + + "VALUES (:id, :dataSource, :created_date, :start, :end, :partitioned, :version, :used, :payload)", config.getUpdaterJobSpec().getSegmentTable() ) );