public static long getNumRows(HiveConf conf, List<ColumnInfo> schema, Table table, PrunedPartitionList partitionList, 
      AtomicInteger noColsMissingStats) {

    List<Partish> inputs = new ArrayList<>();
    if (table.isPartitioned()) {
      for (Partition part : partitionList.getNotDeniedPartns()) {
        inputs.add(Partish.buildFor(table, part));
      }
    } else {
      inputs.add(Partish.buildFor(table));
    }

    Factory basicStatsFactory = new BasicStats.Factory();

    if (HiveConf.getBoolVar(conf, ConfVars.HIVE_STATS_ESTIMATE_STATS)) {
      basicStatsFactory.addEnhancer(new BasicStats.DataSizeEstimator(conf));
      basicStatsFactory.addEnhancer(new BasicStats.RowNumEstimator(estimateRowSizeFromSchema(conf, schema)));
    }
    
    for (Partish pi : inputs) {
      BasicStats bStats = new BasicStats(pi);
      long nr = bStats.getNumRows();
      // FIXME: this point will be lost after the factory; check that it's really a warning....cleanup/etc
      if (nr <= 0) {
        // log warning if row count is missing
        noColsMissingStats.getAndIncrement();
      }
    }
    List<BasicStats> results = basicStatsFactory.buildAll(conf, inputs);
    BasicStats aggregateStat = BasicStats.buildFrom(results);

    aggregateStat.apply(new BasicStats.SetMinRowNumber());
    return aggregateStat.getNumRows();
  }
Returns number of rows if it exists. Otherwise it estimates number of rows
based on estimated data size for both partition and non-partitioned table
RelOptHiveTable's getRowCount uses this.
ql/src/java/org/apache/hadoop/hive/ql/stats/StatsUtils.java