orc-dev mailing list archives

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

    https://github.com/apache/orc/pull/19#discussion_r54128437
  
    --- 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 --
    
    gcc and clang are both fine with it at -Wall.


---
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