Skip to content
This repository was archived by the owner on Jun 7, 2021. It is now read-only.

Commit bb68005

Browse files
author
aven
committed
[TRAFODION-3183] fetch huge data give rise to core
1 parent 5e8bfc7 commit bb68005

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4ResultSet.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2779,6 +2779,19 @@ public boolean next() throws SQLException {
27792779
maxRowCnt = maxRows - totalRowsFetched_;
27802780
}
27812781

2782+
// if (row width) * (fetch rows) too large, there will have core in server side.
2783+
// once fetch bytes bigger than 1GB, devide several times to fetch,
2784+
// each time fetch bytes less than 1GB.
2785+
if (outputDesc_ != null && outputDesc_[0] != null) {
2786+
long rowLength = outputDesc_[0].rowLength_;
2787+
long oneGB = 1024 * 1024 * 1024;
2788+
if (rowLength * maxRowCnt >= oneGB) {
2789+
double multi = (rowLength * maxRowCnt) / (double)oneGB;
2790+
multi = Math.ceil(multi); // devide several times to fetch
2791+
maxRowCnt = (int) (maxRowCnt / multi);
2792+
}
2793+
}
2794+
27822795
if (maxRowCnt == 0) {
27832796
validRow = false;
27842797
} else {

0 commit comments

Comments
 (0)