mirror of
https://github.com/apache/sqoop.git
synced 2025-05-03 20:40:58 +08:00
SQOOP-1764: Numeric Overflow when getting extent map
(David Robson via Venkat Ranganathan)
This commit is contained in:
parent
ad13ad0810
commit
eceff4c8f4
@ -29,7 +29,7 @@ public abstract class OraOopOracleDataChunk implements Writable {
|
||||
|
||||
private String id;
|
||||
|
||||
public abstract int getNumberOfBlocks();
|
||||
public abstract long getNumberOfBlocks();
|
||||
|
||||
public String getWhereClause() {
|
||||
return "1=1";
|
||||
|
@ -30,15 +30,16 @@ public class OraOopOracleDataChunkExtent extends OraOopOracleDataChunk {
|
||||
|
||||
private int oracleDataObjectId;
|
||||
private int relativeDatafileNumber;
|
||||
private int startBlockNumber;
|
||||
private int finishBlockNumber;
|
||||
private long startBlockNumber;
|
||||
private long finishBlockNumber;
|
||||
|
||||
OraOopOracleDataChunkExtent() {
|
||||
|
||||
}
|
||||
|
||||
OraOopOracleDataChunkExtent(String id, int oracleDataObjectId,
|
||||
int relativeDatafileNumber, int startBlockNumber, int finishBlockNumber) {
|
||||
int relativeDatafileNumber, long startBlockNumber,
|
||||
long finishBlockNumber) {
|
||||
|
||||
this.setId(id);
|
||||
this.oracleDataObjectId = oracleDataObjectId;
|
||||
@ -67,8 +68,8 @@ public void write(DataOutput output) throws IOException {
|
||||
Text.writeString(output, this.getId());
|
||||
output.writeInt(this.oracleDataObjectId);
|
||||
output.writeInt(this.relativeDatafileNumber);
|
||||
output.writeInt(this.startBlockNumber);
|
||||
output.writeInt(this.finishBlockNumber);
|
||||
output.writeLong(this.startBlockNumber);
|
||||
output.writeLong(this.finishBlockNumber);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -76,17 +77,16 @@ public void readFields(DataInput input) throws IOException {
|
||||
this.setId(Text.readString(input));
|
||||
this.oracleDataObjectId = input.readInt();
|
||||
this.relativeDatafileNumber = input.readInt();
|
||||
this.startBlockNumber = input.readInt();
|
||||
this.finishBlockNumber = input.readInt();
|
||||
this.startBlockNumber = input.readLong();
|
||||
this.finishBlockNumber = input.readLong();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNumberOfBlocks() {
|
||||
|
||||
if (this.finishBlockNumber == 0 && this.startBlockNumber == 0) {
|
||||
public long getNumberOfBlocks() {
|
||||
if (this.finishBlockNumber == 0L && this.startBlockNumber == 0L) {
|
||||
return 0;
|
||||
} else {
|
||||
return (this.finishBlockNumber - this.startBlockNumber) + 1;
|
||||
return (this.finishBlockNumber - this.startBlockNumber) + 1L;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,21 +30,21 @@
|
||||
public class OraOopOracleDataChunkPartition extends OraOopOracleDataChunk {
|
||||
|
||||
private boolean isSubPartition;
|
||||
private int blocks;
|
||||
private long blocks;
|
||||
|
||||
OraOopOracleDataChunkPartition() {
|
||||
|
||||
}
|
||||
|
||||
OraOopOracleDataChunkPartition(String partitionName, boolean isSubPartition,
|
||||
int blocks) {
|
||||
long blocks) {
|
||||
this.setId(partitionName);
|
||||
this.isSubPartition = isSubPartition;
|
||||
this.blocks = blocks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNumberOfBlocks() {
|
||||
public long getNumberOfBlocks() {
|
||||
return this.blocks;
|
||||
}
|
||||
|
||||
@ -52,14 +52,14 @@ public int getNumberOfBlocks() {
|
||||
public void write(DataOutput output) throws IOException {
|
||||
Text.writeString(output, this.getId());
|
||||
output.writeBoolean(this.isSubPartition);
|
||||
output.writeInt(this.blocks);
|
||||
output.writeLong(this.blocks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFields(DataInput input) throws IOException {
|
||||
this.setId(Text.readString(input));
|
||||
this.isSubPartition = input.readBoolean();
|
||||
this.blocks = input.readInt();
|
||||
this.blocks = input.readLong();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -324,7 +324,7 @@ private static void bindPartitionBindVars(PreparedStatement statement,
|
||||
OraOopOracleDataChunkPartition dataChunk =
|
||||
new OraOopOracleDataChunkPartition(resultSet
|
||||
.getString("partition_name"), resultSet
|
||||
.getBoolean("is_subpartition"), resultSet.getInt("blocks"));
|
||||
.getBoolean("is_subpartition"), resultSet.getLong("blocks"));
|
||||
result.add(dataChunk);
|
||||
}
|
||||
resultSet.close();
|
||||
@ -417,8 +417,8 @@ public static List<OraOopOracleDataChunkExtent> getOracleDataChunksExtent(
|
||||
OraOopOracleDataChunkExtent dataChunk =
|
||||
new OraOopOracleDataChunkExtent(dataChunkId, resultSet
|
||||
.getInt("data_object_id"), resultSet.getInt("relative_fno"),
|
||||
resultSet.getInt("start_block_id"), resultSet
|
||||
.getInt("end_block_id"));
|
||||
resultSet.getLong("start_block_id"), resultSet
|
||||
.getLong("end_block_id"));
|
||||
result.add(dataChunk);
|
||||
}
|
||||
|
||||
|
@ -51,4 +51,12 @@ public void testGetCurrentSchema() throws Exception {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLongBlockId() {
|
||||
OraOopOracleDataChunkExtent chunk =
|
||||
new OraOopOracleDataChunkExtent("1", 100, 1, 2147483648L, 4294967295L);
|
||||
String whereClause = chunk.getWhereClause();
|
||||
Assert.assertNotNull(whereClause);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user