public int getCardinality() {
    int cardinality = 1;
    for (FieldPartitioner fieldPartitioner : fieldPartitioners) {
      if (fieldPartitioner.getCardinality() == FieldPartitioner.UNKNOWN_CARDINALITY) {
        return FieldPartitioner.UNKNOWN_CARDINALITY;
      }
      cardinality *= fieldPartitioner.getCardinality();
    }
    return cardinality;
  }
public int getCardinality ( ) { int cardinality = 1 ; for ( FieldPartitioner fieldPartitioner : fieldPartitioners ) { if ( fieldPartitioner . getCardinality ( ) == FieldPartitioner . UNKNOWN_CARDINALITY ) { return FieldPartitioner . UNKNOWN_CARDINALITY ; } cardinality *= fieldPartitioner . getCardinality ( ) ; } return cardinality ; }
<p>
Return the cardinality produced by the contained field partitioners.
</p>
<p>
This can be used to aid in calculating resource usage during certain
operations. For example, when writing data to a partitioned dataset, you
can use this method to estimate (or discover exactly, depending on the
partition functions) how many leaf partitions exist.
</p>
<p>
<strong>Warning:</strong> This method is allowed to lie and should be
treated only as a hint. Some partition functions are fixed (for example,
hash modulo number of buckets), while others are open-ended (for
example, discrete value) and depend on the input data.
</p>

@return The estimated (or possibly concrete) number of leaf partitions.