orc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asandryh <...@git.apache.org>
Subject [GitHub] orc pull request: ORC-43. FileMemory.cc throws uncaught exception.
Date Thu, 25 Feb 2016 14:34:23 GMT
Github user asandryh commented on a diff in the pull request:

    https://github.com/apache/orc/pull/19#discussion_r54102507
  
    --- Diff: tools/src/FileMemory.cc ---
    @@ -95,37 +127,11 @@ int main(int argc, char* argv[]) {
         return 1;
       }
     
    -  orc::ReaderOptions opts;
    -  if (cols.size() > 0) {
    -    opts.include(cols);
    -  }
    -  std::unique_ptr<orc::MemoryPool> pool(new TestMemoryPool());
    -  opts.setMemoryPool(*(pool.get()));
    -
    -  std::unique_ptr<orc::Reader> reader;
    -  try{
    -    reader = orc::createReader(orc::readLocalFile(std::string(filename)), opts);
    -  } catch (orc::ParseError e) {
    -    std::cout << "Error reading file " << filename << "! " <<
e.what() << "\n";
    -    return -1;
    -  }
    -
    -  std::unique_ptr<orc::ColumnVectorBatch> batch =
    -      reader->createRowBatch(batchSize);
    -  uint64_t readerMemory = reader->getMemoryUse();
    -  uint64_t batchMemory = batch->getMemoryUsage();
    -  while (reader->next(*batch)) {}
    -  uint64_t actualMemory =
    -      static_cast<TestMemoryPool*>(pool.get())->getMaxMemory();
    -  std::cout << "Reader memory estimate: " << readerMemory
    -            << "\nBatch memory estimate:  " ;
    -  if (batch->hasVariableLength()) {
    -    std::cout << "Cannot estimate because reading ARRAY or MAP columns";
    -  } else {
    -    std::cout << batchMemory
    -              << "\nTotal memory estimate:  " << readerMemory + batchMemory;
    +  try {
    +    processFile(filename, cols, batchSize);
    +    return 0;
    +  } catch (std::exception& ex) {
    +    std::cerr << "Caught exception: " << ex.what() << "\n";
    +    return 1;
       }
    -  std::cout << "\nActual max memory used: " << actualMemory << "\n";
    -
    -  return 0;
    --- End diff --
    
    Don't you get a compiler error if you remove this `return 0;` statement? It's unreachable,
but some compilers can still complain.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message