[GitHub] incubator-trafodion pull request: [TRAFODION-1738]Using git comman...
GitHub user kevinxu021 opened a pull request: https://github.com/apache/incubator-trafodion/pull/249 [TRAFODION-1738]Using git command instead of shell You can merge this pull request into a Git repository by running: $ git pull https://github.com/kevinxu021/incubator-trafodion a-t4-1738 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-trafodion/pull/249.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #249 commit 3023566e4b250b29fcdd82eb683aa1cf179ddde1 Author: Kevin XuDate: 2016-01-06T10:14:59Z Using git command instead of shell --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-trafodion pull request: [TRAFODION-1727]Fixes for Databa...
Github user kevinxu021 commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/244#discussion_r48940983 --- Diff: core/conn/jdbc_type2/native/SrvrCommon.cpp --- @@ -1634,6 +1634,94 @@ short do_ExecSMD( tableParam[0], inputParam[0], inputParam[1], inputParam[2], inputParam[3]); break; +case SQL_API_SQLPROCEDURES: +if ((!checkIfWildCard(catalogNm, catalogNmNoEsc) || !checkIfWildCard(schemaNm, schemaNmNoEsc) || !checkIfWildCard( +tableNm, tableNmNoEsc)) && !metadataId) +{ +executeException->exception_nr = odbc_SQLSvc_GetSQLCatalogs_ParamError_exn_; +executeException->u.ParamError.ParamDesc = SQLSVC_EXCEPTION_WILDCARD_NOT_SUPPORTED; + FUNCTION_RETURN_NUMERIC(EXECUTE_EXCEPTION,("EXECUTE_EXCEPTION")); +} + +if (strcmp(catalogNm,"") == 0) +strcpy(tableName1,SEABASE_MD_CATALOG); +else +strcpy(tableName1, catalogNm); +tableParam[0] = tableName1; +convertWildcard(metadataId, TRUE, schemaNm, expSchemaNm); +convertWildcardNoEsc(metadataId, TRUE, schemaNm, schemaNmNoEsc); +convertWildcard(metadataId, TRUE, tableNm, expTableNm); +convertWildcardNoEsc(metadataId, TRUE, tableNm, tableNmNoEsc); +inputParam[0] = schemaNmNoEsc; +inputParam[1] = expSchemaNm; +inputParam[2] = tableNmNoEsc; +inputParam[3] = expTableNm; +inputParam[4] = NULL; + +snprintf((char *)sqlString->dataValue._buffer, totalSize, +"select obj.CATALOG_NAME PROCEDURE_CAT, obj.SCHEMA_NAME PROCEDURE_SCHEM, " + "obj.OBJECT_NAME PROCEDURE_NAME, cast(NULL as varchar(10)) R1,cast(NULL as varchar(10)) R2," +"cast(NULL as varchar(10)) R3, cast(NULL as varchar(10)) REMARKS, cast(0 as smallint) PROCEDURE_TYPE, " +"obj.OBJECT_NAME SPECIFIC_NAME " +" from TRAFODION.\"_MD_\".OBJECTS obj " +" where " +" (obj.SCHEMA_NAME = '%s' or trim(obj.SCHEMA_NAME) LIKE '%s' ESCAPE '\\')" +" and obj.OBJECT_TYPE='UR' " --- End diff -- This query usually used for UI tools like DBVisualizer, SQuirreL SQL Client and so on. It might be good if you UDF could be listed as a SPJ, i think. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-trafodion pull request: [TRAFODION-1726]Support getIndex...
Github user kevinxu021 commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/243#discussion_r48939910 --- Diff: core/conn/jdbc_type2/native/SrvrCommon.cpp --- @@ -1634,6 +1635,53 @@ short do_ExecSMD( tableParam[0], inputParam[0], inputParam[1], inputParam[2], inputParam[3]); break; + case SQL_API_SQLSTATISTICS: + if ((!checkIfWildCard(catalogNm, catalogNmNoEsc) || !checkIfWildCard(schemaNm, schemaNmNoEsc) + || !checkIfWildCard(tableNm, tableNmNoEsc)) && !metadataId) + { + executeException->exception_nr = odbc_SQLSvc_GetSQLCatalogs_ParamError_exn_; + executeException->u.ParamError.ParamDesc = SQLSVC_EXCEPTION_WILDCARD_NOT_SUPPORTED; + FUNCTION_RETURN_NUMERIC(EXECUTE_EXCEPTION,("EXECUTE_EXCEPTION")); + } + + if (strcmp(catalogNm,"") == 0) + strcpy(tableName1,SEABASE_MD_CATALOG); + else + strcpy(tableName1, catalogNm); + tableParam[0] = tableName1; + convertWildcard(metadataId, TRUE, schemaNm, expSchemaNm); + convertWildcardNoEsc(metadataId, TRUE, schemaNm, schemaNmNoEsc); + convertWildcard(metadataId, TRUE, tableNm, expTableNm); + convertWildcardNoEsc(metadataId, TRUE, tableNm, tableNmNoEsc); + if( inputParam[5] != NULL ) + { + sprintf(cunique, " and index.IS_UNIQUE=1"); + } + inputParam[0] = schemaNmNoEsc; + inputParam[1] = expSchemaNm; + inputParam[2] = tableNmNoEsc; + inputParam[3] = expTableNm; + inputParam[4] = NULL; + snprintf((char *)sqlString->dataValue._buffer, totalSize, + "select " + "obj.CATALOG_NAME TABLE_CAT, obj.SCHEMA_NAME TABLE_SCHEM, obj.OBJECT_NAME TABLE_NAME," + "cast((case when index.IS_UNIQUE=0 then 1 else 0 end) as smallint) NON_UNIQUE, " + "cast(NULL as varchar(32)) INDEX_QUALIFIER, idxobj.OBJECT_NAME INDEX_NAME, " + "cast(-2 as smallint) TYPE, cols.COLUMN_NUMBER ORDINAL_POSITION, " + "substr(cols.COLUMN_NAME,0,CHAR_LENGTH(cols.COLUMN_NAME)) COLUMN_NAME, " + "cast((case when keys.ORDERING=0 then 'A' else 'D' end) as varchar(4)) ASC_OR_DESC," + "cast(-2 as int) CARDINALITY, cast(-2 as int) PAGES, cast(NULL as varchar(10)) FILTER_CONDITION " + "from TRAFODION.\"_MD_\".OBJECTS obj " + "left join TRAFODION.\"_MD_\".INDEXES index on obj.object_uid=index.BASE_TABLE_UID " + "left join TRAFODION.\"_MD_\".OBJECTS idxobj on index.index_uid=idxobj.object_UID " + "left join TRAFODION.\"_MD_\".COLUMNS cols on cols.column_name<>'SYSKEY' and idxobj.object_uid=cols.object_uid " + "left join TRAFODION.\"_MD_\".KEYS keys on cols.object_uid=keys.object_uid and cols.COLUMN_NAME=keys.COLUMN_NAME and keys.column_name<>'SYSKEY' " + "where 1=1 %s" + " and (obj.SCHEMA_NAME = '%s' or trim(obj.SCHEMA_NAME) LIKE '%s' ESCAPE '\\')" + " and (obj.OBJECT_NAME = '%s' or trim(obj.OBJECT_NAME) LIKE '%s' ESCAPE '\\')" + " FOR READ UNCOMMITTED ACCESS order by INDEX_NAME, ORDINAL_POSITION;", --- End diff -- i don't think it's reasonable because ORDINAL_POSITION is the order the indexes which should be the first level. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-trafodion pull request: Support for extracting lob to bu...
Github user sandhyasun commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/248#discussion_r48979502 --- Diff: core/sql/executor/ExExeUtilLoad.cpp --- @@ -2890,7 +2890,12 @@ short ExExeUtilLobExtractTcb::work() } - step_ = RETRIEVE_LOB_LENGTH_; + if (lobTdb().getToType() == ComTdbExeUtilLobExtract::TO_BUFFER_) + step_ = EXTRACT_LOB_DATA_; + else + if ((lobTdb().getToType() == ComTdbExeUtilLobExtract::RETRIEVE_LENGTH_) || (lobTdb().getToType() == ComTdbExeUtilLobExtract::TO_FILE_)) + step_ = RETRIEVE_LOB_LENGTH_; + --- End diff -- Added a block to handle an invalid "toType" to get out of any invalid state . --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-trafodion pull request: Support for extracting lob to bu...
Github user sandhyasun commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/248#discussion_r48979535 --- Diff: core/sql/nskgmake/clitest/Makefile~ --- @@ -0,0 +1,35 @@ +### --- End diff -- Not sure how this got committed by mistake. Removed it. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-trafodion pull request: Support for extracting lob to bu...
Github user sandhyasun commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/248#discussion_r48979457 --- Diff: core/sql/clitest/blobtest.cpp --- @@ -0,0 +1,255 @@ +/** +// @@@ START COPYRIGHT @@@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// @@@ END COPYRIGHT @@@ +**/ +/* -*-C++-*- + +* +* File: Helper functions for use by bin/clitest.cpp +* Description: Test driver useing exe util cli interface +* +* +* +* + +*/ +#include "blobtest.h" + +Int32 extractLengthOfLobColumn(CliGlobals *cliglob, char *lobHandle, + Int64 , + char *lobColumnName, char *tableName) +{ + Int32 retcode = 0; + char * query = new char[4096]; + ExeCliInterface cliInterface((cliglob->currContext())->exHeap(), (Int32)SQLCHARSETCODE_UTF8, cliglob->currContext(),NULL); + //Use lob handle to retrieve the lob length. + char lobLengthResult[200]; + str_cpy_all(lobLengthResult," ",200); + Int32 lobLengthResultLen = 0; + str_sprintf(query,"extract loblength (lob '%s') LOCATION %Ld ",lobHandle, ); + retcode = cliInterface.executeImmediate(query,lobLengthResult,,FALSE); + + delete query; + return retcode; + +} + +Int32 extractLobHandle(CliGlobals *cliglob, char *& lobHandle, + char *lobColumnName, char *tableName) +{ + Int32 retcode = 0; + ExeCliInterface cliInterface((cliglob->currContext())->exHeap(), (Int32)SQLCHARSETCODE_UTF8, cliglob->currContext(),NULL); + char * query = new char[4096]; + Int32 lobHandleLen = 0; + str_sprintf(query,"select %s from %s",lobColumnName,tableName); + + retcode = cliInterface.executeImmediate(query,lobHandle,,FALSE); + + if (retcode) +return retcode; + lobHandle[lobHandleLen]='\0'; + delete query; + + return retcode; + +} + +Int32 extractLobToBuffer(CliGlobals *cliglob, char * lobHandle, Int64 , + char *lobColumnName, char *tableName) +{ + Int32 retcode = 0; + ExeCliInterface cliInterface((cliglob->currContext())->exHeap(), (Int32)SQLCHARSETCODE_UTF8, cliglob->currContext(),NULL); + // Extract lob data into a buffer. + char * query = new char [500]; + + char *lobFinalBuf = new char[lengthOfLob]; + char statusBuf[200] = {'\0'}; + Int32 statusBufLen = 0; + Int64 lobExtractLen = 1000; + char *lobDataBuf = new char[lobExtractLen]; + + str_sprintf(query,"extract lobtobuffer(lob '%s', LOCATION %Ld, SIZE %Ld) ", lobHandle, (Int64)lobDataBuf, ); + + + retcode = cliInterface.executeImmediatePrepare(query); + short i = 0; + while ((retcode != 100) && !(retcode<0)) +{ + retcode = cliInterface.clearExecFetchClose(NULL,NULL,statusBuf, ); + if (!retcode) + { + memcpy((char*)&(lobFinalBuf[i]),(char *)lobDataBuf,lobExtractLen); + i += lobExtractLen; + } +} + if (retcode ==100 || retcode ==0) +{ + FILE * lobFileId = fopen("lob_output_file","w"); + + int byteCount=fwrite(lobFinalBuf,sizeof(char),lengthOfLob, lobFileId); + cout << "Writing " << byteCount << " bytes from user buffer to file lob_output_file in current directory" << endl; + + fclose(lobFileId); +} + delete lobFinalBuf; + delete query; + delete lobDataBuf; + + + return retcode; + +} + + +Int32 extractLobToFileInChunks(CliGlobals *cliglob, char * lobHandle, char *filename,Int64 , + char *lobColumnName, char *tableName)
[GitHub] incubator-trafodion pull request: Support for extracting lob to bu...
Github user sandhyasun commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/248#discussion_r48979468 --- Diff: core/sql/clitest/blobtest.cpp --- @@ -0,0 +1,255 @@ +/** +// @@@ START COPYRIGHT @@@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// @@@ END COPYRIGHT @@@ +**/ +/* -*-C++-*- + +* +* File: Helper functions for use by bin/clitest.cpp +* Description: Test driver useing exe util cli interface +* +* +* +* + +*/ +#include "blobtest.h" + +Int32 extractLengthOfLobColumn(CliGlobals *cliglob, char *lobHandle, + Int64 , + char *lobColumnName, char *tableName) +{ + Int32 retcode = 0; + char * query = new char[4096]; + ExeCliInterface cliInterface((cliglob->currContext())->exHeap(), (Int32)SQLCHARSETCODE_UTF8, cliglob->currContext(),NULL); + //Use lob handle to retrieve the lob length. + char lobLengthResult[200]; + str_cpy_all(lobLengthResult," ",200); + Int32 lobLengthResultLen = 0; + str_sprintf(query,"extract loblength (lob '%s') LOCATION %Ld ",lobHandle, ); + retcode = cliInterface.executeImmediate(query,lobLengthResult,,FALSE); + + delete query; + return retcode; + +} + +Int32 extractLobHandle(CliGlobals *cliglob, char *& lobHandle, + char *lobColumnName, char *tableName) +{ + Int32 retcode = 0; + ExeCliInterface cliInterface((cliglob->currContext())->exHeap(), (Int32)SQLCHARSETCODE_UTF8, cliglob->currContext(),NULL); + char * query = new char[4096]; + Int32 lobHandleLen = 0; + str_sprintf(query,"select %s from %s",lobColumnName,tableName); + + retcode = cliInterface.executeImmediate(query,lobHandle,,FALSE); + + if (retcode) +return retcode; + lobHandle[lobHandleLen]='\0'; + delete query; + + return retcode; + +} + +Int32 extractLobToBuffer(CliGlobals *cliglob, char * lobHandle, Int64 , + char *lobColumnName, char *tableName) +{ + Int32 retcode = 0; + ExeCliInterface cliInterface((cliglob->currContext())->exHeap(), (Int32)SQLCHARSETCODE_UTF8, cliglob->currContext(),NULL); + // Extract lob data into a buffer. + char * query = new char [500]; + + char *lobFinalBuf = new char[lengthOfLob]; + char statusBuf[200] = {'\0'}; + Int32 statusBufLen = 0; + Int64 lobExtractLen = 1000; + char *lobDataBuf = new char[lobExtractLen]; + + str_sprintf(query,"extract lobtobuffer(lob '%s', LOCATION %Ld, SIZE %Ld) ", lobHandle, (Int64)lobDataBuf, ); + + + retcode = cliInterface.executeImmediatePrepare(query); + short i = 0; + while ((retcode != 100) && !(retcode<0)) +{ + retcode = cliInterface.clearExecFetchClose(NULL,NULL,statusBuf, ); + if (!retcode) + { + memcpy((char*)&(lobFinalBuf[i]),(char *)lobDataBuf,lobExtractLen); + i += lobExtractLen; + } +} + if (retcode ==100 || retcode ==0) +{ + FILE * lobFileId = fopen("lob_output_file","w"); + + int byteCount=fwrite(lobFinalBuf,sizeof(char),lengthOfLob, lobFileId); + cout << "Writing " << byteCount << " bytes from user buffer to file lob_output_file in current directory" << endl; + + fclose(lobFileId); +} + delete lobFinalBuf; + delete query; + delete lobDataBuf; + + + return retcode; + +} + + +Int32 extractLobToFileInChunks(CliGlobals *cliglob, char * lobHandle, char *filename,Int64 , + char *lobColumnName, char *tableName)
[GitHub] incubator-trafodion pull request: Support for extracting lob to bu...
Github user sandhyasun commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/248#discussion_r48979483 --- Diff: core/sql/comexe/ComTdbExeUtil.cpp --- @@ -2231,28 +2233,32 @@ ComTdbExeUtilLobExtract::ComTdbExeUtilLobExtract handle_(handle), handleLen_(handleLen), toType_((short)toType), +bufAddr_(bufAddr), +extractSizeIOAddr_(extractSizeAddr), lobStorageType_(lobStorageType), stringParam1_(stringParam1), stringParam2_(stringParam2), stringParam3_(stringParam3), lobHdfsServer_(lobHdfsServer), lobHdfsPort_(lobHdfsPort), -rowSize_(0), -bufSize_(0), +totalBufSize_(0), flags_(0) { setNodeType(ComTdb::ex_LOB_EXTRACT); if ((toType_ == ExtractToType::TO_BUFFER_) || (toType_ == ExtractToType::TO_STRING_)) { - // intparam1 contains the rowsize passed in via syntax + /*// intparam1 contains the rowsize passed in via syntax // intparam2 constains the total buf size user has allocated rowSize_ = intParam1; - bufSize_ = intParam2; + bufSize_ = intParam2; */ --- End diff -- Deleted --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-trafodion pull request: Support for extracting lob to bu...
Github user sandhyasun commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/248#discussion_r48979493 --- Diff: core/sql/executor/ExExeUtilCli.cpp --- @@ -1048,6 +1052,77 @@ Lng32 ExeCliInterface::executeImmediateExec(const char * stmtStr, return ((cliRetcode != -1) ? cliRetcode : retcode); } + +Lng32 ExeCliInterface::executeImmediateExecNoDealloc(const char * stmtStr, + char * outputBuf, + Lng32 * outputBufLen, + NABoolean nullTerminate, + Int64 * rowsAffected + ) +{ + Lng32 retcode = 0; + + retcode = exec(); + if (retcode < 0) +{ + deallocStuff(module_, stmt_, sql_src_, input_desc_, output_desc_); + return retcode; +} + + retcode = fetch(); + if (retcode < 0) +{ + deallocStuff(module_, stmt_, sql_src_, input_desc_, output_desc_); + return retcode; +} + + if ((outputBuf) && + (outputBufLen)) +{ + *outputBufLen = 0; + if (retcode != 100) + { + char * ptr; + Lng32 len; + getPtrAndLen(1, ptr, len); + + str_cpy_all(outputBuf, ptr, len); --- End diff -- executeImmediateExeNoDealloc is not needed. Had added it when I encountered a bug with cursor access and then forgot to remove . The whole method has been removed. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-trafodion pull request: Support for extracting lob to bu...
Github user sandhyasun commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/248#discussion_r48979511 --- Diff: core/sql/executor/ExExeUtilLoad.cpp --- @@ -3098,19 +3119,25 @@ short ExExeUtilLobExtractTcb::work() break; } - if (lobDataLen_ == 0) + if (lobDataOutputLen == 0) { step_ = CLOSE_CURSOR_; break; } - remainingBytes_ = (Lng32)lobDataLen_; + remainingBytes_ = (Lng32)lobDataOutputLen; currPos_ = 0; -if (lobTdb().getToType() == ComTdbExeUtilLobExtract::TO_FILE_) - step_ = INSERT_FROM_STRING_; -else - step_ = RETURN_STRING_; +/*if (lobTdb().getToType() == ComTdbExeUtilLobExtract::TO_FILE_) + step_ = INSERT_FROM_STRING_;*/ +if (lobTdb().getToType() == ComTdbExeUtilLobExtract::TO_BUFFER_) + { + str_sprintf(statusString_," Success: LOB data length returned : %d", lobDataOutputLen); + + //lobTdb().setExtractSizeIOAddr((Int64)()); + memcpy((char *)lobTdb().dataExtractSizeIOAddr(), (char *),sizeof(Int64)); + step_ = RETURN_STATUS_; + } --- End diff -- Added an "invalid state handling" block to avoid hanging in the same state --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-trafodion pull request: Support for extracting lob to bu...
Github user sandhyasun commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/248#discussion_r48979445 --- Diff: core/sql/clitest/blobtest.cpp --- @@ -0,0 +1,255 @@ +/** +// @@@ START COPYRIGHT @@@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// @@@ END COPYRIGHT @@@ +**/ +/* -*-C++-*- + +* +* File: Helper functions for use by bin/clitest.cpp +* Description: Test driver useing exe util cli interface +* +* +* +* + +*/ +#include "blobtest.h" + +Int32 extractLengthOfLobColumn(CliGlobals *cliglob, char *lobHandle, + Int64 , + char *lobColumnName, char *tableName) +{ + Int32 retcode = 0; + char * query = new char[4096]; + ExeCliInterface cliInterface((cliglob->currContext())->exHeap(), (Int32)SQLCHARSETCODE_UTF8, cliglob->currContext(),NULL); + //Use lob handle to retrieve the lob length. + char lobLengthResult[200]; + str_cpy_all(lobLengthResult," ",200); + Int32 lobLengthResultLen = 0; + str_sprintf(query,"extract loblength (lob '%s') LOCATION %Ld ",lobHandle, ); + retcode = cliInterface.executeImmediate(query,lobLengthResult,,FALSE); + + delete query; + return retcode; + +} + +Int32 extractLobHandle(CliGlobals *cliglob, char *& lobHandle, + char *lobColumnName, char *tableName) +{ + Int32 retcode = 0; + ExeCliInterface cliInterface((cliglob->currContext())->exHeap(), (Int32)SQLCHARSETCODE_UTF8, cliglob->currContext(),NULL); + char * query = new char[4096]; + Int32 lobHandleLen = 0; + str_sprintf(query,"select %s from %s",lobColumnName,tableName); + + retcode = cliInterface.executeImmediate(query,lobHandle,,FALSE); + + if (retcode) +return retcode; --- End diff -- For the syntax in the previous comment(could not add Line Note there) , it was because the comments use markup and all test within <> got chopped off. The syntax should look better now, I edited it. Fixed memory leak . --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-trafodion pull request: Support for extracting lob to bu...
Github user sandhyasun commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/248#discussion_r48979519 --- Diff: core/sql/executor/ExExeUtilLoad.cpp --- @@ -3098,19 +3119,25 @@ short ExExeUtilLobExtractTcb::work() break; } - if (lobDataLen_ == 0) + if (lobDataOutputLen == 0) { step_ = CLOSE_CURSOR_; break; } - remainingBytes_ = (Lng32)lobDataLen_; + remainingBytes_ = (Lng32)lobDataOutputLen; currPos_ = 0; -if (lobTdb().getToType() == ComTdbExeUtilLobExtract::TO_FILE_) - step_ = INSERT_FROM_STRING_; -else - step_ = RETURN_STRING_; +/*if (lobTdb().getToType() == ComTdbExeUtilLobExtract::TO_FILE_) + step_ = INSERT_FROM_STRING_;*/ --- End diff -- Done --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-trafodion pull request: fix JIRA-1739 to aggressively al...
Github user zellerh commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/250#discussion_r49024774 --- Diff: core/sql/sqlcomp/nadefaults.cpp --- @@ -5914,6 +5866,73 @@ enum DefaultConstants NADefaults::validateAndInsert(const char *attrName, } // NADefaults::validateAndInsert() +float NADefaults::computeNumESPsPerCore(NABoolean aggressive) +{ + #define DEFAULT_ESPS_PER_NODE 2 // for conservation allocation + #define DEFAULT_ESPS_PER_CORE 0.5 // for aggressive allocation + + // Make sure the gpClusterInfo points at an NAClusterLinux object. + // In osim simulation mode, the pointer can point at a NAClusterNSK + // object, for which the method numTSEsForPOS() is not defined. + NAClusterInfoLinux* gpLinux = dynamic_cast(gpClusterInfo); + assert(gpLinux); + + // cores per node + Lng32 coresPerNode = gpClusterInfo->numberOfCpusPerSMP(); + + if ( aggressive ) { + float totalMemory = gpLinux->totalMemoryAvailable(); // per Node, in KB --- End diff -- Allocating one ESP per 2 GB seems a bit arbitrary to me. So, rather than asking the user to set the AGGRESSIVE_ESP_ALLOCATION_PER_CORE to ON (which will eventually be used, I guess), should we just ask them to pick an appropriate value for MAX_ESPS_PER_CPU_PER_OP instead? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-trafodion pull request: fix JIRA-1739 to aggressively al...
Github user nonstop-qfchen commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/250#discussion_r49027797 --- Diff: core/sql/sqlcomp/nadefaults.cpp --- @@ -5914,6 +5866,73 @@ enum DefaultConstants NADefaults::validateAndInsert(const char *attrName, } // NADefaults::validateAndInsert() +float NADefaults::computeNumESPsPerCore(NABoolean aggressive) +{ + #define DEFAULT_ESPS_PER_NODE 2 // for conservation allocation + #define DEFAULT_ESPS_PER_CORE 0.5 // for aggressive allocation + + // Make sure the gpClusterInfo points at an NAClusterLinux object. + // In osim simulation mode, the pointer can point at a NAClusterNSK + // object, for which the method numTSEsForPOS() is not defined. + NAClusterInfoLinux* gpLinux = dynamic_cast(gpClusterInfo); + assert(gpLinux); + + // cores per node + Lng32 coresPerNode = gpClusterInfo->numberOfCpusPerSMP(); + + if ( aggressive ) { + float totalMemory = gpLinux->totalMemoryAvailable(); // per Node, in KB + totalMemory /= 1024; // per Node, in GB + totalMemory /= coresPerNode ; // per core, in GB + totalMemory /= 2; // per core, 2GB per ESP + return MINOF(DEFAULT_ESPS_PER_CORE, totalMemory); + } + + Lng32 numESPsPerNode = DEFAULT_ESPS_PER_NODE; + + // number of POS TSE + Lng32 numTSEsPerCluster = gpLinux->numTSEsForPOS(); + + // cluster nodes + Lng32 nodesdPerCluster = gpClusterInfo->getTotalNumberOfCPUs(); + + // TSEs per node + Lng32 TSEsPerNode = numTSEsPerCluster/nodesdPerCluster; + + + + // For Linux/nt, we conservatively allocate ESPs per node as follows + // - 1 ESP per 2 cpu cores if cores are equal or less than TSEs + // - 1 ESP per TSE if number of cores is more than double the TSEs + // - 1 ESP per 2 TSEs if cores are more than TSEs but less than double the TSEs + // - 1 ESP per node. Only possible on NT or workstations + // - number of cores less than TSEs and there are 1 or 2 cpur cores per node + // - number of TSEs is less than cpu cores and there 1 or 2 TSEs per node. + //This case is probable if virtual nodes are used + + // TSEsPerNode is 0 for arkcmps started by the seapilot universal comsumers + // in this case we only consider cpu cores + if ( coresPerNode <= TSEsPerNode || TSEsPerNode == 0 ) + { + if (coresPerNode > 1) + numESPsPerNode = DEFAULT_ESPS_PER_NODE; + } + else if (coresPerNode > (TSEsPerNode*2)) + { +numESPsPerNode = TSEsPerNode; + } + else if (TSEsPerNode > 1) + { +numESPsPerNode = TSEsPerNode/2; + } + else // not really needed since numESPsPerNode is set to 1 from above + { +numESPsPerNode = DEFAULT_ESPS_PER_NODE; + } + + return (float)(numESPsPerNode)/(float)(coresPerNode); --- End diff -- yes. the code is inherited from the work in HP and computes # of ESps very conservatively. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-trafodion pull request: fix JIRA-1739 to aggressively al...
Github user zellerh commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/250#discussion_r49023626 --- Diff: core/sql/sqlcomp/nadefaults.cpp --- @@ -5914,6 +5866,73 @@ enum DefaultConstants NADefaults::validateAndInsert(const char *attrName, } // NADefaults::validateAndInsert() +float NADefaults::computeNumESPsPerCore(NABoolean aggressive) +{ + #define DEFAULT_ESPS_PER_NODE 2 // for conservation allocation + #define DEFAULT_ESPS_PER_CORE 0.5 // for aggressive allocation + + // Make sure the gpClusterInfo points at an NAClusterLinux object. + // In osim simulation mode, the pointer can point at a NAClusterNSK + // object, for which the method numTSEsForPOS() is not defined. + NAClusterInfoLinux* gpLinux = dynamic_cast(gpClusterInfo); + assert(gpLinux); + + // cores per node + Lng32 coresPerNode = gpClusterInfo->numberOfCpusPerSMP(); + + if ( aggressive ) { + float totalMemory = gpLinux->totalMemoryAvailable(); // per Node, in KB + totalMemory /= 1024; // per Node, in GB --- End diff -- For conversion KB to GB we would need to divide by 1024*1024? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-trafodion pull request: fix JIRA-1739 to aggressively al...
Github user nonstop-qfchen commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/250#discussion_r49027967 --- Diff: core/sql/sqlcomp/nadefaults.cpp --- @@ -5914,6 +5866,73 @@ enum DefaultConstants NADefaults::validateAndInsert(const char *attrName, } // NADefaults::validateAndInsert() +float NADefaults::computeNumESPsPerCore(NABoolean aggressive) +{ + #define DEFAULT_ESPS_PER_NODE 2 // for conservation allocation + #define DEFAULT_ESPS_PER_CORE 0.5 // for aggressive allocation + + // Make sure the gpClusterInfo points at an NAClusterLinux object. + // In osim simulation mode, the pointer can point at a NAClusterNSK + // object, for which the method numTSEsForPOS() is not defined. + NAClusterInfoLinux* gpLinux = dynamic_cast(gpClusterInfo); + assert(gpLinux); + + // cores per node + Lng32 coresPerNode = gpClusterInfo->numberOfCpusPerSMP(); + + if ( aggressive ) { + float totalMemory = gpLinux->totalMemoryAvailable(); // per Node, in KB --- End diff -- once the performance of the change is done, we will permanently turn on the feature. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-trafodion pull request: [TRAFODION-1680] Dcs needs to pr...
GitHub user hegdean opened a pull request: https://github.com/apache/incubator-trafodion/pull/251 [TRAFODION-1680] Dcs needs to provide support for HA on AWS Documentation and installer changes You can merge this pull request into a Git repository by running: $ git pull https://github.com/hegdean/incubator-trafodion wrkbrnch Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-trafodion/pull/251.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #251 commit 1cde2505bef3b26428537c064790db8157a2b9ae Author: Anuradha HegdeDate: 2016-01-05T17:46:09Z Documentation and installer change for Floating IP commit d5e3e843e010443f530c9010658c957f2b554fd3 Author: Anuradha Hegde Date: 2016-01-05T21:35:28Z Applied review comments commit c2ce702e22f63b05ca59fb609803e0339e7c5de7 Author: Anuradha Hegde Date: 2016-01-06T23:53:44Z Fixed issues seen during testing commit 4e30bf08e0d88106f5b6ccf29652d65ec8b966c9 Author: Anuradha Hegde Date: 2016-01-07T00:42:04Z fixed issued --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-trafodion pull request: fix JIRA-1739 to aggressively al...
Github user zellerh commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/250#discussion_r49035086 --- Diff: core/sql/sqlcomp/nadefaults.cpp --- @@ -5914,6 +5866,73 @@ enum DefaultConstants NADefaults::validateAndInsert(const char *attrName, } // NADefaults::validateAndInsert() +float NADefaults::computeNumESPsPerCore(NABoolean aggressive) +{ + #define DEFAULT_ESPS_PER_NODE 2 // for conservation allocation + #define DEFAULT_ESPS_PER_CORE 0.5 // for aggressive allocation + + // Make sure the gpClusterInfo points at an NAClusterLinux object. + // In osim simulation mode, the pointer can point at a NAClusterNSK + // object, for which the method numTSEsForPOS() is not defined. + NAClusterInfoLinux* gpLinux = dynamic_cast(gpClusterInfo); + assert(gpLinux); + + // cores per node + Lng32 coresPerNode = gpClusterInfo->numberOfCpusPerSMP(); + + if ( aggressive ) { + float totalMemory = gpLinux->totalMemoryAvailable(); // per Node, in KB + totalMemory /= 1024; // per Node, in GB + totalMemory /= coresPerNode ; // per core, in GB + totalMemory /= 2; // per core, 2GB per ESP + return MINOF(DEFAULT_ESPS_PER_CORE, totalMemory); + } + + Lng32 numESPsPerNode = DEFAULT_ESPS_PER_NODE; + + // number of POS TSE + Lng32 numTSEsPerCluster = gpLinux->numTSEsForPOS(); --- End diff -- My vote is for getting rid of the code, it's confusing. As you say, it's probably not very useful anyway. Why don't we just use MAX_ESPS_PER_CPU_PER_OP (default value of 0.5) for the non-aggressive method? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-trafodion pull request: fix JIRA-1739 to aggressively al...
Github user zellerh commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/250#discussion_r49034958 --- Diff: core/sql/sqlcomp/nadefaults.cpp --- @@ -5914,6 +5866,73 @@ enum DefaultConstants NADefaults::validateAndInsert(const char *attrName, } // NADefaults::validateAndInsert() +float NADefaults::computeNumESPsPerCore(NABoolean aggressive) +{ + #define DEFAULT_ESPS_PER_NODE 2 // for conservation allocation + #define DEFAULT_ESPS_PER_CORE 0.5 // for aggressive allocation + + // Make sure the gpClusterInfo points at an NAClusterLinux object. + // In osim simulation mode, the pointer can point at a NAClusterNSK + // object, for which the method numTSEsForPOS() is not defined. + NAClusterInfoLinux* gpLinux = dynamic_cast(gpClusterInfo); + assert(gpLinux); + + // cores per node + Lng32 coresPerNode = gpClusterInfo->numberOfCpusPerSMP(); + + if ( aggressive ) { + float totalMemory = gpLinux->totalMemoryAvailable(); // per Node, in KB --- End diff -- My comment is more that right now it's hard-coded to non-aggressive as far as I can see. Don't you want to have a CQD to turn it on and off - since you added a CQD. But, as far as I can see, the new CQD does nothing right now? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-trafodion pull request: [TRAFODION-1727]Fixes for Databa...
Github user selvaganesang commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/244#discussion_r49034626 --- Diff: core/conn/jdbc_type2/native/SrvrCommon.cpp --- @@ -1634,6 +1634,92 @@ short do_ExecSMD( tableParam[0], inputParam[0], inputParam[1], inputParam[2], inputParam[3]); break; +case SQL_API_SQLPROCEDURES: +if ((!checkIfWildCard(catalogNm, catalogNmNoEsc) || !checkIfWildCard(schemaNm, schemaNmNoEsc) || !checkIfWildCard( +tableNm, tableNmNoEsc)) && !metadataId) +{ +executeException->exception_nr = odbc_SQLSvc_GetSQLCatalogs_ParamError_exn_; +executeException->u.ParamError.ParamDesc = SQLSVC_EXCEPTION_WILDCARD_NOT_SUPPORTED; + FUNCTION_RETURN_NUMERIC(EXECUTE_EXCEPTION,("EXECUTE_EXCEPTION")); +} + +if (strcmp(catalogNm,"") == 0) +strcpy(tableName1,SEABASE_MD_CATALOG); --- End diff -- Should this be changed to the default catalog in the connection when the catalogNm is NULL? Default to SEABASE instead of SEABASE_MD_CATALOG when it is not set. Ditto for all other APIs. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-trafodion pull request: fix JIRA-1739 to aggressively al...
Github user zellerh commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/250#discussion_r49024086 --- Diff: core/sql/sqlcomp/nadefaults.cpp --- @@ -5914,6 +5866,73 @@ enum DefaultConstants NADefaults::validateAndInsert(const char *attrName, } // NADefaults::validateAndInsert() +float NADefaults::computeNumESPsPerCore(NABoolean aggressive) +{ + #define DEFAULT_ESPS_PER_NODE 2 // for conservation allocation + #define DEFAULT_ESPS_PER_CORE 0.5 // for aggressive allocation + + // Make sure the gpClusterInfo points at an NAClusterLinux object. + // In osim simulation mode, the pointer can point at a NAClusterNSK + // object, for which the method numTSEsForPOS() is not defined. + NAClusterInfoLinux* gpLinux = dynamic_cast(gpClusterInfo); + assert(gpLinux); + + // cores per node + Lng32 coresPerNode = gpClusterInfo->numberOfCpusPerSMP(); + + if ( aggressive ) { + float totalMemory = gpLinux->totalMemoryAvailable(); // per Node, in KB + totalMemory /= 1024; // per Node, in GB + totalMemory /= coresPerNode ; // per core, in GB + totalMemory /= 2; // per core, 2GB per ESP + return MINOF(DEFAULT_ESPS_PER_CORE, totalMemory); + } + + Lng32 numESPsPerNode = DEFAULT_ESPS_PER_NODE; + + // number of POS TSE + Lng32 numTSEsPerCluster = gpLinux->numTSEsForPOS(); + + // cluster nodes + Lng32 nodesdPerCluster = gpClusterInfo->getTotalNumberOfCPUs(); + + // TSEs per node + Lng32 TSEsPerNode = numTSEsPerCluster/nodesdPerCluster; + + + + // For Linux/nt, we conservatively allocate ESPs per node as follows + // - 1 ESP per 2 cpu cores if cores are equal or less than TSEs + // - 1 ESP per TSE if number of cores is more than double the TSEs + // - 1 ESP per 2 TSEs if cores are more than TSEs but less than double the TSEs + // - 1 ESP per node. Only possible on NT or workstations + // - number of cores less than TSEs and there are 1 or 2 cpur cores per node + // - number of TSEs is less than cpu cores and there 1 or 2 TSEs per node. + //This case is probable if virtual nodes are used + + // TSEsPerNode is 0 for arkcmps started by the seapilot universal comsumers + // in this case we only consider cpu cores + if ( coresPerNode <= TSEsPerNode || TSEsPerNode == 0 ) + { + if (coresPerNode > 1) + numESPsPerNode = DEFAULT_ESPS_PER_NODE; --- End diff -- It's already mentioned below in a comment on line 5928, this line also does nothing. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-trafodion pull request: [TRAFODION-1737]Fixed jar confic...
Github user asfgit closed the pull request at: https://github.com/apache/incubator-trafodion/pull/246 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-trafodion pull request: TRAFODION-1736 REST server repor...
Github user asfgit closed the pull request at: https://github.com/apache/incubator-trafodion/pull/247 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-trafodion pull request: [TRAFODION-1738]Using git comman...
Github user asfgit closed the pull request at: https://github.com/apache/incubator-trafodion/pull/249 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-trafodion pull request: [TRAFODION-1726]Support getIndex...
Github user arvind-narain commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/243#discussion_r49011034 --- Diff: dcs/src/main/java/org/trafodion/dcs/servermt/serverHandler/ServerApiGetCatalogs.java --- @@ -353,7 +353,7 @@ else if (columnType == ServerConstants.SQL_ROWVER){ case ServerConstants.SQL_API_SQLSTATISTICS: if(LOG.isDebugEnabled()) LOG.debug(serverWorkerName + ". getIndexInfo (catalogNm :" + catalogNm + ", schemaNm :" + schemaNm + ", tableNm :" + tableNm + ", uniqueness :" + ((uniqueness == 1)? true : false) + ", true)"); -rs = dbmd.getIndexInfo(catalogNm, schemaNm, tableNm, (uniqueness == 1)? true : false, true); +rs = dbmd.getIndexInfo(catalogNm, schemaNm, tableNm, (uniqueness == ServerConstants.SQL_INDEX_ALL)? true : false, true); --- End diff -- Thanks for the updates. Here shouldn't this be SQL_INDEX_UNIQUE (0 - like your previous change). You could update line 355 also. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---