MAPREDUCE-6012. DBInputSplit creates invalid ranges on Oracle. (Wei Yan via kasha)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1618694 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d51f81c3b6
commit
73325f23f6
|
@ -233,6 +233,9 @@ Release 2.6.0 - UNRELEASED
|
|||
MAPREDUCE-6036. TestJobEndNotifier fails intermittently in branch-2 (chang
|
||||
li via jlowe)
|
||||
|
||||
MAPREDUCE-6012. DBInputSplit creates invalid ranges on Oracle.
|
||||
(Wei Yan via kasha)
|
||||
|
||||
Release 2.5.0 - UNRELEASED
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -81,15 +81,14 @@ public class OracleDBRecordReader<T extends DBWritable> extends DBRecordReader<T
|
|||
|
||||
try {
|
||||
DBInputFormat.DBInputSplit split = getSplit();
|
||||
if (split.getLength() > 0 && split.getStart() > 0){
|
||||
if (split.getLength() > 0){
|
||||
String querystring = query.toString();
|
||||
|
||||
query = new StringBuilder();
|
||||
query.append("SELECT * FROM (SELECT a.*,ROWNUM dbif_rno FROM ( ");
|
||||
query.append(querystring);
|
||||
query.append(" ) a WHERE rownum <= ").append(split.getStart());
|
||||
query.append(" + ").append(split.getLength());
|
||||
query.append(" ) WHERE dbif_rno >= ").append(split.getStart());
|
||||
query.append(" ) a WHERE rownum <= ").append(split.getEnd());
|
||||
query.append(" ) WHERE dbif_rno > ").append(split.getStart());
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
// ignore, will not throw.
|
||||
|
|
|
@ -110,7 +110,7 @@ public class TestDbClasses {
|
|||
splitter, NullDBWritable.class, configuration, connect,
|
||||
dbConfiguration, "condition", fields, "table");
|
||||
assertEquals(
|
||||
"SELECT * FROM (SELECT a.*,ROWNUM dbif_rno FROM ( SELECT f1, f2 FROM table WHERE condition ORDER BY Order ) a WHERE rownum <= 1 + 9 ) WHERE dbif_rno >= 1",
|
||||
"SELECT * FROM (SELECT a.*,ROWNUM dbif_rno FROM ( SELECT f1, f2 FROM table WHERE condition ORDER BY Order ) a WHERE rownum <= 10 ) WHERE dbif_rno > 1",
|
||||
recorder.getSelectQuery());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue