You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-01 06:46:55 +03:00
MCOL-1197 Make -c work in cpimport
It turns out -c wasn't actually connected to anything and now with have BLOB/TEXT it is pretty useful. If -c is set to < 1MB then 1MB is used, otherwise it will use the selected buffer size.
This commit is contained in:
@ -77,6 +77,7 @@ class WECmdArgs
|
|||||||
char getDelimChar() { return fColDelim; }
|
char getDelimChar() { return fColDelim; }
|
||||||
ImportDataMode getImportDataMode() const { return fImportDataMode; }
|
ImportDataMode getImportDataMode() const { return fImportDataMode; }
|
||||||
bool getConsoleLog() { return fConsoleLog; }
|
bool getConsoleLog() { return fConsoleLog; }
|
||||||
|
int getReadBufSize() { return fReadBufSize; }
|
||||||
|
|
||||||
bool isCpimportInvokeMode(){return (fBlockMode3)? false : fCpiInvoke;}
|
bool isCpimportInvokeMode(){return (fBlockMode3)? false : fCpiInvoke;}
|
||||||
bool isQuiteMode() const { return fQuiteMode; }
|
bool isQuiteMode() const { return fQuiteMode; }
|
||||||
|
@ -87,6 +87,15 @@ WEFileReadThread::WEFileReadThread(WESDHandler& aSdh):fSdh(aSdh),
|
|||||||
{
|
{
|
||||||
//TODO batch qty to get from config
|
//TODO batch qty to get from config
|
||||||
fBatchQty = 10000;
|
fBatchQty = 10000;
|
||||||
|
if (fSdh.getReadBufSize() < DEFAULTBUFFSIZE)
|
||||||
|
{
|
||||||
|
fBuffSize = DEFAULTBUFFSIZE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fBuffSize = fSdh.getReadBufSize();
|
||||||
|
}
|
||||||
|
fBuff = new char [fBuffSize];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,6 +115,7 @@ WEFileReadThread::~WEFileReadThread()
|
|||||||
delete fpThread;
|
delete fpThread;
|
||||||
}
|
}
|
||||||
fpThread=0;
|
fpThread=0;
|
||||||
|
delete []fBuff;
|
||||||
//cout << "WEFileReadThread destructor called" << endl;
|
//cout << "WEFileReadThread destructor called" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,16 +340,16 @@ unsigned int WEFileReadThread::readDataFile(messageqcpp::SBS& Sbs)
|
|||||||
if(fEnclEsc)
|
if(fEnclEsc)
|
||||||
{
|
{
|
||||||
//pStart = aBuff;
|
//pStart = aBuff;
|
||||||
aLen = getNextRow(fInFile, fBuff, sizeof(fBuff)-1);
|
aLen = getNextRow(fInFile, fBuff, fBuffSize-1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fInFile.getline(fBuff, sizeof(fBuff)-1);
|
fInFile.getline(fBuff, fBuffSize-1);
|
||||||
aLen=fInFile.gcount();
|
aLen=fInFile.gcount();
|
||||||
}
|
}
|
||||||
////aLen chars incl \n, Therefore aLen-1; '<<' oper won't go past it
|
////aLen chars incl \n, Therefore aLen-1; '<<' oper won't go past it
|
||||||
//cout << "Data Length " << aLen <<endl;
|
//cout << "Data Length " << aLen <<endl;
|
||||||
if((aLen < (sizeof(fBuff)-2)) && (aLen>0))
|
if((aLen < (fBuffSize-2)) && (aLen>0))
|
||||||
{
|
{
|
||||||
fBuff[aLen-1] = '\n';
|
fBuff[aLen-1] = '\n';
|
||||||
fBuff[aLen]=0;
|
fBuff[aLen]=0;
|
||||||
@ -348,7 +358,7 @@ unsigned int WEFileReadThread::readDataFile(messageqcpp::SBS& Sbs)
|
|||||||
aIdx++;
|
aIdx++;
|
||||||
if(fSdh.getDebugLvl()>2) cout << "File data line = " << aIdx <<endl;
|
if(fSdh.getDebugLvl()>2) cout << "File data line = " << aIdx <<endl;
|
||||||
}
|
}
|
||||||
else if(aLen>=sizeof(fBuff)-2) //Didn't hit delim; BIG ROW
|
else if(aLen>=fBuffSize-2) //Didn't hit delim; BIG ROW
|
||||||
{
|
{
|
||||||
cout <<"Bad Row data " << endl;
|
cout <<"Bad Row data " << endl;
|
||||||
cout << fBuff << endl;
|
cout << fBuff << endl;
|
||||||
|
@ -98,7 +98,7 @@ public:
|
|||||||
void add2InputDataFileList(std::string& FileName);
|
void add2InputDataFileList(std::string& FileName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum { MAXBUFFSIZE=1024*1024 };
|
enum { DEFAULTBUFFSIZE=1024*1024 };
|
||||||
|
|
||||||
// don't allow anyone else to set
|
// don't allow anyone else to set
|
||||||
void setTgtPmId(unsigned int fTgtPmId) { this->fTgtPmId = fTgtPmId; }
|
void setTgtPmId(unsigned int fTgtPmId) { this->fTgtPmId = fTgtPmId; }
|
||||||
@ -120,7 +120,8 @@ private:
|
|||||||
char fEncl; // Encl char
|
char fEncl; // Encl char
|
||||||
char fEsc; // Esc char
|
char fEsc; // Esc char
|
||||||
char fDelim; // Column Delimit char
|
char fDelim; // Column Delimit char
|
||||||
char fBuff[MAXBUFFSIZE]; // main data buffer
|
char* fBuff; // main data buffer
|
||||||
|
int fBuffSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace WriteEngine */
|
} /* namespace WriteEngine */
|
||||||
|
@ -2301,6 +2301,13 @@ char WESDHandler::getEscChar()
|
|||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
int WESDHandler::getReadBufSize()
|
||||||
|
{
|
||||||
|
return fRef.fCmdArgs.getReadBufSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
char WESDHandler::getDelimChar()
|
char WESDHandler::getDelimChar()
|
||||||
{
|
{
|
||||||
return fRef.fCmdArgs.getDelimChar();
|
return fRef.fCmdArgs.getDelimChar();
|
||||||
|
@ -149,6 +149,7 @@ public:
|
|||||||
char getEscChar();
|
char getEscChar();
|
||||||
char getDelimChar();
|
char getDelimChar();
|
||||||
bool getConsoleLog();
|
bool getConsoleLog();
|
||||||
|
int getReadBufSize();
|
||||||
ImportDataMode getImportDataMode() const;
|
ImportDataMode getImportDataMode() const;
|
||||||
void sysLog(const logging::Message::Args& msgArgs,
|
void sysLog(const logging::Message::Args& msgArgs,
|
||||||
logging::LOG_TYPE logType, logging::Message::MessageID msgId);
|
logging::LOG_TYPE logType, logging::Message::MessageID msgId);
|
||||||
|
Reference in New Issue
Block a user