test_class.file: core/src/test/java/org/datasyslab/geospark/utils/RDDSampleUtilsTest.java
test_class.identifier: RDDSampleUtilsTest
test_case.body: @Test
      public void testGetSampleNumbers()
      {
          assertEquals(10, RDDSampleUtils.getSampleNumbers(2, 10, -1));
          assertEquals(100, RDDSampleUtils.getSampleNumbers(2, 100, -1));
          assertEquals(10, RDDSampleUtils.getSampleNumbers(5, 1000, -1));
          assertEquals(100, RDDSampleUtils.getSampleNumbers(5, 10000, -1));
          assertEquals(100, RDDSampleUtils.getSampleNumbers(5, 10001, -1));
          assertEquals(1000, RDDSampleUtils.getSampleNumbers(5, 100011, -1));
          assertEquals(99, RDDSampleUtils.getSampleNumbers(6, 100011, 99));
          assertEquals(999, RDDSampleUtils.getSampleNumbers(20, 999, -1));
          assertEquals(40, RDDSampleUtils.getSampleNumbers(20, 1000, -1));
      }
test_case.class_method_signature: RDDSampleUtilsTest.testGetSampleNumbers()
test_case.full_signature: @Test public void testGetSampleNumbers()
test_case.identifier: testGetSampleNumbers
test_case.invocations: assertEquals getSampleNumbers assertEquals getSampleNumbers assertEquals getSampleNumbers assertEquals getSampleNumbers assertEquals getSampleNumbers assertEquals getSampleNumbers assertEquals getSampleNumbers assertEquals getSampleNumbers assertEquals getSampleNumbers
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetSampleNumbers()
focal_class.file: core/src/main/java/org/datasyslab/geospark/utils/RDDSampleUtils.java
focal_class.identifier: RDDSampleUtils
focal_class.class_method_signature: RDDSampleUtils.getSampleNumbers(int numPartitions, long totalNumberOfRecords, int givenSampleNumbers)
focal_class.full_signature: public static int getSampleNumbers(int numPartitions, long totalNumberOfRecords, int givenSampleNumbers)
focal_class.identifier: getSampleNumbers
focal_class.modifiers: public static
focal_class.parameters: (int numPartitions, long totalNumberOfRecords, int givenSampleNumbers)
focal_class.return: int
focal_class.signature: int getSampleNumbers(int numPartitions, long totalNumberOfRecords, int givenSampleNumbers)
focal_method.body: public static int getSampleNumbers(int numPartitions, long totalNumberOfRecords, int givenSampleNumbers)
      {
          if (givenSampleNumbers > 0) {
              if (givenSampleNumbers > totalNumberOfRecords) {
                  throw new IllegalArgumentException("[GeoSpark] Number of samples " + givenSampleNumbers + " cannot be larger than total records num " + totalNumberOfRecords);
              }
              return givenSampleNumbers;
          }
  
          // Make sure that number of records >= 2 * number of partitions
          if (totalNumberOfRecords < 2 * numPartitions) {
              throw new IllegalArgumentException("[GeoSpark] Number of partitions " + numPartitions + " cannot be larger than half of total records num " + totalNumberOfRecords);
          }
  
          if (totalNumberOfRecords < 1000) {
              return (int) totalNumberOfRecords;
          }
  
          final int minSampleCnt = numPartitions * 2;
          return (int) Math.max(minSampleCnt, Math.min(totalNumberOfRecords / 100, Integer.MAX_VALUE));
      }
focal_method.class_method_signature: RDDSampleUtils.getSampleNumbers(int numPartitions, long totalNumberOfRecords, int givenSampleNumbers)
focal_method.full_signature: public static int getSampleNumbers(int numPartitions, long totalNumberOfRecords, int givenSampleNumbers)
focal_method.identifier: getSampleNumbers
focal_method.invocations: max min
focal_method.modifiers: public static
focal_method.parameters: (int numPartitions, long totalNumberOfRecords, int givenSampleNumbers)
focal_method.return: int
focal_method.signature: int getSampleNumbers(int numPartitions, long totalNumberOfRecords, int givenSampleNumbers)