You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
Reformat all code to coding standard
This commit is contained in:
@ -40,7 +40,8 @@ using namespace messageqcpp;
|
||||
#include "dmlpackageprocessor.h"
|
||||
using namespace dmlpackageprocessor;
|
||||
|
||||
namespace {
|
||||
namespace
|
||||
{
|
||||
|
||||
const streamsize blkSz = 8192;
|
||||
|
||||
@ -50,118 +51,125 @@ void usage()
|
||||
|
||||
u_int64_t fixDate(ByteStream& bs, ostream& out)
|
||||
{
|
||||
ByteStream fixed;
|
||||
ByteStream::quadbyte o;
|
||||
u_int64_t cnt = 0;
|
||||
ByteStream fixed;
|
||||
ByteStream::quadbyte o;
|
||||
u_int64_t cnt = 0;
|
||||
#if 0
|
||||
DMLPackageProcessor::Date minDate;
|
||||
DMLPackageProcessor::Date maxDate;
|
||||
minDate.year = 1992;
|
||||
minDate.month = 1;
|
||||
minDate.day = 2;
|
||||
maxDate.year = 1998;
|
||||
maxDate.month = 12;
|
||||
maxDate.day = 25;
|
||||
ByteStream::quadbyte mxd;
|
||||
ByteStream::quadbyte mnd;
|
||||
mxd = *(reinterpret_cast<ByteStream::quadbyte*>(&maxDate));
|
||||
mnd = *(reinterpret_cast<ByteStream::quadbyte*>(&minDate));
|
||||
DMLPackageProcessor::Date minDate;
|
||||
DMLPackageProcessor::Date maxDate;
|
||||
minDate.year = 1992;
|
||||
minDate.month = 1;
|
||||
minDate.day = 2;
|
||||
maxDate.year = 1998;
|
||||
maxDate.month = 12;
|
||||
maxDate.day = 25;
|
||||
ByteStream::quadbyte mxd;
|
||||
ByteStream::quadbyte mnd;
|
||||
mxd = *(reinterpret_cast<ByteStream::quadbyte*>(&maxDate));
|
||||
mnd = *(reinterpret_cast<ByteStream::quadbyte*>(&minDate));
|
||||
#endif
|
||||
DMLPackageProcessor::Date fixDate;
|
||||
fixDate.spare = 0;
|
||||
ByteStream::quadbyte f;
|
||||
while (bs.length() > 0)
|
||||
{
|
||||
bs >> o;
|
||||
if (o >= 0xfffffffe)
|
||||
{
|
||||
fixed << o;
|
||||
continue;
|
||||
}
|
||||
f = o & 0xffff;
|
||||
fixDate.year = f;
|
||||
o >>= 16;
|
||||
f = o & 0xf;
|
||||
fixDate.month = f;
|
||||
o >>= 4;
|
||||
f = o & 0x3f;
|
||||
fixDate.day = f;
|
||||
//o >>= 6;
|
||||
o = *(reinterpret_cast<ByteStream::quadbyte*>(&fixDate));
|
||||
fixed << o;
|
||||
DMLPackageProcessor::Date fixDate;
|
||||
fixDate.spare = 0;
|
||||
ByteStream::quadbyte f;
|
||||
|
||||
while (bs.length() > 0)
|
||||
{
|
||||
bs >> o;
|
||||
|
||||
if (o >= 0xfffffffe)
|
||||
{
|
||||
fixed << o;
|
||||
continue;
|
||||
}
|
||||
|
||||
f = o & 0xffff;
|
||||
fixDate.year = f;
|
||||
o >>= 16;
|
||||
f = o & 0xf;
|
||||
fixDate.month = f;
|
||||
o >>= 4;
|
||||
f = o & 0x3f;
|
||||
fixDate.day = f;
|
||||
//o >>= 6;
|
||||
o = *(reinterpret_cast<ByteStream::quadbyte*>(&fixDate));
|
||||
fixed << o;
|
||||
#if 0
|
||||
cout << DMLPackageProcessor::dateToString(o) << endl;
|
||||
idbassert(o >= mnd && o <= mxd);
|
||||
cnt++;
|
||||
cout << DMLPackageProcessor::dateToString(o) << endl;
|
||||
idbassert(o >= mnd && o <= mxd);
|
||||
cnt++;
|
||||
#endif
|
||||
}
|
||||
out << fixed;
|
||||
return cnt;
|
||||
}
|
||||
|
||||
out << fixed;
|
||||
return cnt;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int c;
|
||||
int c;
|
||||
|
||||
opterr = 0;
|
||||
opterr = 0;
|
||||
|
||||
while ((c = getopt(argc, argv, "h")) != EOF)
|
||||
switch (c)
|
||||
{
|
||||
case 'h':
|
||||
usage();
|
||||
return 0;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
while ((c = getopt(argc, argv, "h")) != EOF)
|
||||
switch (c)
|
||||
{
|
||||
case 'h':
|
||||
usage();
|
||||
return 0;
|
||||
break;
|
||||
|
||||
if ((argc - optind) < 1)
|
||||
{
|
||||
usage();
|
||||
return 1;
|
||||
}
|
||||
default:
|
||||
usage();
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
|
||||
ByteStream bs;
|
||||
if ((argc - optind) < 1)
|
||||
{
|
||||
usage();
|
||||
return 1;
|
||||
}
|
||||
|
||||
ifstream ifs(argv[optind + 0]);
|
||||
ByteStream::byte inbuf[blkSz];
|
||||
streampos fLen;
|
||||
u_int64_t blkNo = 0;
|
||||
ByteStream bs;
|
||||
|
||||
ifs.seekg(0, ios_base::end);
|
||||
fLen = ifs.tellg();
|
||||
ifs.seekg(0, ios_base::beg);
|
||||
ifstream ifs(argv[optind + 0]);
|
||||
ByteStream::byte inbuf[blkSz];
|
||||
streampos fLen;
|
||||
u_int64_t blkNo = 0;
|
||||
|
||||
idbassert((fLen % blkSz) == 0);
|
||||
u_int64_t numBlks = fLen / blkSz;
|
||||
cout << numBlks << " blocks to fix..." << endl;
|
||||
ifs.seekg(0, ios_base::end);
|
||||
fLen = ifs.tellg();
|
||||
ifs.seekg(0, ios_base::beg);
|
||||
|
||||
ofstream ofs("fixdate.cdf");
|
||||
idbassert((fLen % blkSz) == 0);
|
||||
u_int64_t numBlks = fLen / blkSz;
|
||||
cout << numBlks << " blocks to fix..." << endl;
|
||||
|
||||
cout << "pct done: " << setw(3);
|
||||
ofstream ofs("fixdate.cdf");
|
||||
|
||||
for(;;)
|
||||
{
|
||||
cout << "pct done: " << setw(3);
|
||||
|
||||
ifs.read(reinterpret_cast<char*>(inbuf), blkSz);
|
||||
if (ifs.eof()) break;
|
||||
bs.load(inbuf, blkSz);
|
||||
for (;;)
|
||||
{
|
||||
|
||||
fixDate(bs, ofs);
|
||||
cout << "\b\b\b" << setw(3) << (u_int64_t)(blkNo * 100 / numBlks);
|
||||
//cout << setw(3) << (u_int64_t)(blkNo * 100 / numBlks) << endl;
|
||||
ifs.read(reinterpret_cast<char*>(inbuf), blkSz);
|
||||
|
||||
blkNo++;
|
||||
}
|
||||
if (ifs.eof()) break;
|
||||
|
||||
cout << "\b\b\b" << setw(3) << 100 << endl;
|
||||
//cout << setw(3) << 100 << endl;
|
||||
bs.load(inbuf, blkSz);
|
||||
|
||||
return 0;
|
||||
fixDate(bs, ofs);
|
||||
cout << "\b\b\b" << setw(3) << (u_int64_t)(blkNo * 100 / numBlks);
|
||||
//cout << setw(3) << (u_int64_t)(blkNo * 100 / numBlks) << endl;
|
||||
|
||||
blkNo++;
|
||||
}
|
||||
|
||||
cout << "\b\b\b" << setw(3) << 100 << endl;
|
||||
//cout << setw(3) << 100 << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user