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