Repository: incubator-trafodion Updated Branches: refs/heads/master d5a7f5b68 -> 8a01b5a8d
fix TRAFODION-2830 Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/7d185ab4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/7d185ab4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/7d185ab4 Branch: refs/heads/master Commit: 7d185ab4c323ed838026a673681657457b7195d1 Parents: a07222f Author: SuJinpei <[email protected]> Authored: Wed Dec 6 16:35:40 2017 +0800 Committer: SuJinpei <[email protected]> Committed: Wed Dec 6 16:35:40 2017 +0800 ---------------------------------------------------------------------- core/conn/odb/src/odb.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/7d185ab4/core/conn/odb/src/odb.c ---------------------------------------------------------------------- diff --git a/core/conn/odb/src/odb.c b/core/conn/odb/src/odb.c index 31bdb95..c5242f7 100755 --- a/core/conn/odb/src/odb.c +++ b/core/conn/odb/src/odb.c @@ -5772,8 +5772,14 @@ static void etabadd(char type, char *run, int id) } if ( etab[no].ps ) { /* Multi-stream table analysis */ if ( etab[no].sb ) { /* split by */ - snprintf((char *)Obuf[0], sizeof(Obuf[0]), - "SELECT MIN(%s), MAX(%s) FROM %s", etab[no].sb, etab[no].sb, etab[no].src); + if (etab[no].map) { /* if we get a pwhere condition, we apply it to improve perfomance */ + snprintf((char *)Obuf[0], sizeof(Obuf[0]), + "SELECT MIN(%s), MAX(%s) FROM %s WHERE %s", etab[no].sb, etab[no].sb, etab[no].src, etab[no].map); + } + else { + snprintf((char *)Obuf[0], sizeof(Obuf[0]), + "SELECT MIN(%s), MAX(%s) FROM %s", etab[no].sb, etab[no].sb, etab[no].src); + } if (!SQL_SUCCEEDED(Oret=SQLExecDirect (Os1, Obuf[0], SQL_NTS))) { Oerr(-1, -1, __LINE__, Os1, SQL_HANDLE_STMT); goto etabadd_exit;
