Changeset 1779 for branches/mergetest/src/STSelector.cpp
- Timestamp:
- 07/29/10 19:13:46 (14 years ago)
- Location:
- branches/mergetest
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/mergetest
- Property svn:mergeinfo changed
-
branches/mergetest/src/STSelector.cpp
r1542 r1779 87 87 } 88 88 89 void STSelector::setTypes( const std::vector< int >& types ) 90 { 91 setint("SRCTYPE", types); 92 } 93 89 94 void STSelector::setint(const std::string& key, const std::vector< int >& val) 90 95 { … … 116 121 } 117 122 123 void STSelector::setRows( const std::vector< int >& rows ) 124 { 125 rowselection_ = rows; 126 } 127 128 // Table STSelector::apply( const Table& tab ) 129 // { 130 // if ( empty() ) { 131 // return sort(tab); 132 // } 133 // TableExprNode query; 134 // intidmap::const_iterator it; 135 // for (it = intselections_.begin(); it != intselections_.end(); ++it) { 136 // TableExprNode theset(Vector<Int>( (*it).second )); 137 // if ( query.isNull() ) { 138 // query = tab.col((*it).first).in(theset); 139 // } else { 140 // query = tab.col((*it).first).in(theset) && query; 141 // } 142 // } 143 // stringidmap::const_iterator it1; 144 // for (it1 = stringselections_.begin(); it1 != stringselections_.end(); ++it1) { 145 // TableExprNode theset(mathutil::toVectorString( (*it1).second )); 146 // if ( query.isNull() ) { 147 // query = tab.col((*it1).first).in(theset); 148 // } else { 149 // query = tab.col((*it1).first).in(theset) && query; 150 // } 151 // } 152 // // add taql query 153 // if ( taql_.size() > 0 ) { 154 // Table tmpt = tab; 155 // std::string pytaql = "USING STYLE PYTHON " + taql_; 156 157 // if ( !query.isNull() ) { // taql and selection 158 // tmpt = tableCommand(pytaql, tab(query)); 159 // } else { // taql only 160 // tmpt = tableCommand(pytaql, tab); 161 // } 162 // return sort(tmpt); 163 // } else { 164 // if ( query.isNull() ) { 165 // return sort(tab); 166 // } else { 167 // return sort(tab(query)); 168 // } 169 // } 170 // } 118 171 Table STSelector::apply( const Table& tab ) 119 172 { 120 173 if ( empty() ) { 121 174 return sort(tab); 175 } 176 Table basetab = tab; 177 // Important!! Be sure to apply row selection first. 178 if (rowselection_.size() > 0){ 179 //Vector<Int> intrownrs(rowselection_); 180 Vector<uInt> rownrs( rowselection_.size() ); 181 convertArray(rownrs, Vector<Int> ( rowselection_ )); 182 basetab = tab( rownrs ); 183 ///TableExprNode theset(Vector<Int>( rowselection_ )); 184 ///query = tab.nodeRownr().in(theset); 122 185 } 123 186 TableExprNode query; … … 126 189 TableExprNode theset(Vector<Int>( (*it).second )); 127 190 if ( query.isNull() ) { 128 query = tab.col((*it).first).in(theset); 191 //query = tab.col((*it).first).in(theset); 192 query = basetab.col((*it).first).in(theset); 129 193 } else { 130 query = tab.col((*it).first).in(theset) && query; 194 //query = tab.col((*it).first).in(theset) && query; 195 query = basetab.col((*it).first).in(theset) && query; 131 196 } 132 197 } … … 135 200 TableExprNode theset(mathutil::toVectorString( (*it1).second )); 136 201 if ( query.isNull() ) { 137 query = tab.col((*it1).first).in(theset); 202 //query = tab.col((*it1).first).in(theset); 203 query = basetab.col((*it1).first).in(theset); 138 204 } else { 139 query = tab.col((*it1).first).in(theset) && query; 205 //query = tab.col((*it1).first).in(theset) && query; 206 query = basetab.col((*it1).first).in(theset) && query; 140 207 } 141 208 } 142 209 // add taql query 143 210 if ( taql_.size() > 0 ) { 144 Table tmpt = tab; 211 //Table tmpt = tab; 212 Table tmpt = basetab; 145 213 std::string pytaql = "USING STYLE PYTHON " + taql_; 146 214 147 215 if ( !query.isNull() ) { // taql and selection 148 tmpt = tableCommand(pytaql, tab(query)); 216 //tmpt = tableCommand(pytaql, tab(query)); 217 tmpt = tableCommand(pytaql, basetab(query)); 149 218 } else { // taql only 150 tmpt = tableCommand(pytaql, tab); 219 //tmpt = tableCommand(pytaql, tab); 220 tmpt = tableCommand(pytaql, basetab); 151 221 } 152 222 return sort(tmpt); 153 223 } else { 154 224 if ( query.isNull() ) { 155 return sort(tab); 225 //return sort(tab); 226 return sort(basetab); 156 227 } else { 157 return sort(tab(query)); 228 //return sort(tab(query)); 229 return sort(basetab(query)); 158 230 } 159 231 } … … 191 263 { 192 264 return getint("CYCLENO"); 265 } 266 267 std::vector< int > asap::STSelector::getTypes( ) const 268 { 269 return getint("SRCTYPE") ; 193 270 } 194 271 … … 227 304 bool asap::STSelector::empty( ) const 228 305 { 229 return (intselections_.empty() && taql_.size() == 0 ); 306 //return (intselections_.empty() && taql_.size() == 0 ); 307 return (intselections_.empty() && taql_.size() == 0 && rowselection_.size() == 0); 230 308 } 231 309
Note:
See TracChangeset
for help on using the changeset viewer.