template<class ArrayT>
Definition at line 179 of file ReadRaw.h. References Endian(), Impala::Util::IOBuffer::GetPosition(), ILOG_ERROR, and ILOG_VAR. Referenced by ReadFile(), and ReadRaw(). 00180 { 00181 typedef typename ArrayT::StorType StorT; 00182 00183 ILOG_VAR(Impala.Core.Array.ReadRaw); 00184 Int64 version; 00185 Int64 binary; 00186 Int64 elemSize; 00187 Int64 width; 00188 Int64 height; 00189 Int64 nrA; 00190 String compressor; 00191 Int64 linesPerCompressedBlock; 00192 Util::IOBuffer::PositionType startPos = buffer->GetPosition(); 00193 if (! ReadRawHeader<ArrayT>(buffer, &version, &binary, &elemSize, &width, 00194 &height, &nrA, compressor, 00195 &linesPerCompressedBlock)) 00196 { 00197 return; 00198 } 00199 00200 if (dst == 0) 00201 dst = ArrayCreate<ArrayT>(width, height); 00202 StorT* dstPtr = dst->CPB(0, 0); 00203 if (binary) 00204 { 00205 Int64 lineSize = sizeof(StorT) * width * elemSize; 00206 buffer->SetPosition(startPos + 200); 00207 for (Int64 n=0 ; n<nrA ; n++) 00208 { 00209 if (linesPerCompressedBlock > 0) 00210 { 00211 int y = 0; 00212 while (y < height) 00213 { 00214 int end = y + linesPerCompressedBlock; 00215 if (end > height) 00216 end = height; 00217 int dY = end - y; 00218 dstPtr = dst->CPB(0, y); 00219 size_t nrBytes = lineSize * dY; 00220 size_t nrRead = 0; 00221 if(compressor == "bzip") 00222 { 00223 nrRead = buffer->ReadBzip(dstPtr, nrBytes); 00224 } 00225 else if(compressor == "zlib") 00226 { 00227 nrRead = buffer->ReadZlib(dstPtr, nrBytes); 00228 } 00229 else 00230 { 00231 ILOG_ERROR("Unknown compressor: " << compressor); 00232 } 00233 if (nrRead != nrBytes) 00234 { 00235 ILOG_ERROR("read " << nrRead << " bytes instead of " 00236 << nrBytes); 00237 } 00238 y += dY; 00239 } 00240 } 00241 else 00242 { 00243 size_t nrBytes = lineSize * height; 00244 size_t nrRead = buffer->Read(dstPtr, nrBytes); 00245 if (nrRead != nrBytes) 00246 { 00247 ILOG_ERROR("read " << nrRead << " bytes instead of " 00248 << nrBytes); 00249 } 00250 } 00251 } 00252 Endian(dst, dst); 00253 } 00254 else 00255 { 00256 for (Int64 n=0 ; n<nrA ; n++) 00257 { 00258 for (Int64 i=0 ; i<height ; i++) 00259 { 00260 for (Int64 j=0 ; j<width ; j++) 00261 { 00262 for (Int64 k=0 ; k<elemSize ; k++) 00263 { 00264 buffer->NativeTypeRead(dstPtr); 00265 dstPtr++; 00266 } 00267 } 00268 } 00269 } 00270 buffer->ReadLine(); 00271 } 00272 }
Here is the call graph for this function:
|