Commit e3440d8c authored by yiwenshao's avatar yiwenshao

fix bug in simple load

parent ba549a50
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
[onions for num] [onions for num]
oDET: DET oDET: DET
oOPE: OPE oOPE: OPE
#oAGG: HOM oAGG: HOM
oASHE: ASHE #oASHE: ASHE
[end] [end]
......
...@@ -8,7 +8,7 @@ useDET:true ...@@ -8,7 +8,7 @@ useDET:true
useSalt:true useSalt:true
#NA,MIN,MIDEAN,FULL #NA,MIN,MIDEAN,FULL
BS_STR:MIN BS_STR:MIN
BS_IA:MIN BS_IA:NA
BS_IH:MIN BS_IH:MIN
#true or false #true or false
USE_ASHE:true USE_ASHE:true
......
...@@ -91,17 +91,16 @@ load_columns(std::vector<FieldMetaTrans> &fmts,std::string db,std::string table) ...@@ -91,17 +91,16 @@ load_columns(std::vector<FieldMetaTrans> &fmts,std::string db,std::string table)
constGlobalConstants.loadCount); constGlobalConstants.loadCount);
} }
gfb.annoOnionNameToFileVector[item.getChoosenOnionName()[i]]=std::move(column); gfb.annoOnionNameToFileVector[item.getChoosenOnionName()[i]]=std::move(column);
} gfb.annoOnionNameToType[item.getChoosenOnionName()[i]]= item.getChoosenFieldTypes()[i];
}
if(item.getHasSalt()) { if(item.getHasSalt()) {
std::vector<std::string> column; std::vector<std::string> column;
std::string filename = prefix + item.getSaltName(); std::string filename = prefix + item.getSaltName();
loadFileNoEscapeLimitCount(filename,column,constGlobalConstants.loadCount); loadFileNoEscapeLimitCount(filename,column,constGlobalConstants.loadCount);
gfb.annoOnionNameToFileVector[item.getSaltName()] = std::move(column); gfb.annoOnionNameToFileVector[item.getSaltName()] = std::move(column);
gfb.annoOnionNameToType[item.getSaltName()]=item.getSaltType();
} }
} }
for(unsigned int i=0;i<gfb.field_names.size();i++){
gfb.annoOnionNameToType[gfb.field_names[i]] = gfb.field_types[i];
}
} }
/*should choose the right decryption onion*/ /*should choose the right decryption onion*/
...@@ -163,8 +162,6 @@ static ResType load_files_new(std::string db, std::string table){ ...@@ -163,8 +162,6 @@ static ResType load_files_new(std::string db, std::string table){
} }
mf.show(); mf.show();
load_columns(fmts,db,table); load_columns(fmts,db,table);
vector<string> field_names; vector<string> field_names;
vector<int> field_types; vector<int> field_types;
vector<int> field_lengths; vector<int> field_lengths;
...@@ -172,7 +169,6 @@ static ResType load_files_new(std::string db, std::string table){ ...@@ -172,7 +169,6 @@ static ResType load_files_new(std::string db, std::string table){
UNUSED(rm); UNUSED(rm);
create_embedded_thd(0); create_embedded_thd(0);
rawMySQLReturnValue resraw; rawMySQLReturnValue resraw;
vector<vector<string>> res_field; vector<vector<string>> res_field;
for(auto item:field_names){ for(auto item:field_names){
res_field.push_back(gfb.annoOnionNameToFileVector[item]); res_field.push_back(gfb.annoOnionNameToFileVector[item]);
...@@ -262,7 +258,6 @@ void local_wrapper(const Item &i, const FieldMeta &fm, Analysis &a, ...@@ -262,7 +258,6 @@ void local_wrapper(const Item &i, const FieldMeta &fm, Analysis &a,
l.push_back(new Item_int(static_cast<ulonglong>(salt))); l.push_back(new Item_int(static_cast<ulonglong>(salt)));
} }
} }
for (auto it : l) { for (auto it : l) {
append_list->push_back(it); append_list->push_back(it);
} }
......
...@@ -59,34 +59,6 @@ std::string getSelectQuery(SchemaInfo &schema, std::vector<FieldMetaTrans> &tfds ...@@ -59,34 +59,6 @@ std::string getSelectQuery(SchemaInfo &schema, std::vector<FieldMetaTrans> &tfds
return res; return res;
} }
static void write_meta(std::vector<FieldMetaTrans> &res,string db,string table){
TableMetaTrans mf(db,table,res);
mf.set_db_table(db,table);
mf.serialize();
}
static
void write_raw_data_to_files(MySQLColumnData& resraw,std::vector<FieldMetaTrans> &res ,string db,string table){
//write metafiles
write_meta(res,db,table);
//write datafiles
std::string prefix = std::string("data/") +db+"/"+table+"/";
std::vector<std::string> filenames;
for(auto item:resraw.fieldNames){
item=prefix+item;
filenames.push_back(item);
}
int len = resraw.fieldNames.size();
for(int i=0;i<len;i++){
if(IS_NUM(resraw.fieldTypes[i])){
writeColumndataNum(resraw.columnData[i],filenames[i]);
}else{
writeColumndataEscapeString(resraw.columnData[i],filenames[i],resraw.maxLengths[i]);
}
}
}
static void static void
write_meta_new(std::vector<FieldMetaTrans> &res,string db,string table){ write_meta_new(std::vector<FieldMetaTrans> &res,string db,string table){
std::string filename = std::string("data/") +db+"/"+table+"/metadata.data"; std::string filename = std::string("data/") +db+"/"+table+"/metadata.data";
...@@ -178,8 +150,6 @@ static void store(std::string db, std::string table){ ...@@ -178,8 +150,6 @@ static void store(std::string db, std::string table){
/* /*
write_raw_data_to_files(resraw,res,db,table); write_raw_data_to_files(resraw,res,db,table);
*/ */
(void)executeAndGetColumnData;
(void)write_raw_data_to_files;
} }
......
...@@ -126,6 +126,11 @@ globalConstants initGlobalConstants(){ ...@@ -126,6 +126,11 @@ globalConstants initGlobalConstants(){
/* the following values need not be determined /* the following values need not be determined
at runtime.*/ at runtime.*/
res.logFile="LOG.TXT"; res.logFile="LOG.TXT";
if(res.BS_IA!=0&&res.BS_IH!=0){
POINT
assert(0);
}
infile.close(); infile.close();
return res; return res;
} }
......
...@@ -168,8 +168,9 @@ ResType rawMySQLReturnValue_to_ResType(bool isNULL,rawMySQLReturnValue *inRow,in ...@@ -168,8 +168,9 @@ ResType rawMySQLReturnValue_to_ResType(bool isNULL,rawMySQLReturnValue *inRow,in
for(auto inRows:inRow->rowValues) { for(auto inRows:inRow->rowValues) {
std::vector<Item *> curTempRow = itemNullVector(types.size()); std::vector<Item *> curTempRow = itemNullVector(types.size());
for(int i=0;i< (int)(inRows.size());i++){ for(int i=0;i< (int)(inRows.size());i++){
if(inRows[i]!="NULL") if(inRows[i]!="NULL"&&inRows[i]!="\"NULL\"")
curTempRow[i] = (MySQLFieldTypeToItem(types[i],inRows[i]));//why unsinged processing is not needed here? curTempRow[i] = (MySQLFieldTypeToItem(types[i],inRows[i]));
//why unsinged processing is not needed here?
} }
rows.push_back(curTempRow); rows.push_back(curTempRow);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment