test_class.declarator: NODE_COUNT = 10
test_class.modifier: private static final
test_class.original_string: private static final int NODE_COUNT = 10;
test_class.type: int
test_class.var_name: NODE_COUNT
test_class.declarator: ignite
test_class.modifier: private
test_class.original_string: private Ignite ignite;
test_class.type: Ignite
test_class.var_name: ignite
test_class.file: modules/ml/src/test/java/org/apache/ignite/ml/dataset/impl/cache/CacheBasedDatasetBuilderTest.java
test_class.identifier: CacheBasedDatasetBuilderTest
test_class.superclass: extends GridCommonAbstractTest
test_case.body: @Test
      public void testBuild() {
          IgniteCache<Integer, String> upstreamCache = createTestCache(100, 10);
          CacheBasedDatasetBuilder<Integer, String> builder = new CacheBasedDatasetBuilder<>(ignite, upstreamCache);
  
          CacheBasedDataset<Integer, String, Long, AutoCloseable> dataset = builder.build(
              TestUtils.testEnvBuilder(),
              (env, upstream, upstreamSize) -> upstreamSize,
              (env, upstream, upstreamSize, ctx) -> null,
              TestUtils.testEnvBuilder().buildForTrainer()
          );
  
          Affinity<Integer> upstreamAffinity = ignite.affinity(upstreamCache.getName());
          Affinity<Integer> datasetAffinity = ignite.affinity(dataset.getDatasetCache().getName());
  
          int upstreamPartitions = upstreamAffinity.partitions();
          int datasetPartitions = datasetAffinity.partitions();
  
          assertEquals(upstreamPartitions, datasetPartitions);
  
          for (int part = 0; part < upstreamPartitions; part++) {
              Collection<ClusterNode> upstreamPartNodes = upstreamAffinity.mapPartitionToPrimaryAndBackups(part);
              Collection<ClusterNode> datasetPartNodes = datasetAffinity.mapPartitionToPrimaryAndBackups(part);
  
              assertEqualsCollections(upstreamPartNodes, datasetPartNodes);
          }
      }
test_case.class_method_signature: CacheBasedDatasetBuilderTest.testBuild()
test_case.full_signature: @Test public void testBuild()
test_case.identifier: testBuild
test_case.invocations: createTestCache build testEnvBuilder buildForTrainer testEnvBuilder affinity getName affinity getName getDatasetCache partitions partitions assertEquals mapPartitionToPrimaryAndBackups mapPartitionToPrimaryAndBackups assertEqualsCollections
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testBuild()
focal_class.declarator: DEFAULT_NUMBER_OF_RETRIES = 15 * 60
focal_class.modifier: public static final
focal_class.original_string: public static final int DEFAULT_NUMBER_OF_RETRIES = 15 * 60;
focal_class.type: int
focal_class.var_name: DEFAULT_NUMBER_OF_RETRIES
focal_class.declarator: RETRY_INTERVAL = 1000
focal_class.modifier: private static final
focal_class.original_string: private static final int RETRY_INTERVAL = 1000;
focal_class.type: int
focal_class.var_name: RETRY_INTERVAL
focal_class.declarator: DATASET_CACHE_TEMPLATE = "%s_DATASET_%s"
focal_class.modifier: private static final
focal_class.original_string: private static final String DATASET_CACHE_TEMPLATE = "%s_DATASET_%s";
focal_class.type: String
focal_class.var_name: DATASET_CACHE_TEMPLATE
focal_class.declarator: ignite
focal_class.modifier: private final
focal_class.original_string: private final Ignite ignite;
focal_class.type: Ignite
focal_class.var_name: ignite
focal_class.declarator: upstreamCache
focal_class.modifier: private final
focal_class.original_string: private final IgniteCache<K, V> upstreamCache;
focal_class.type: IgniteCache<K, V>
focal_class.var_name: upstreamCache
focal_class.declarator: filter
focal_class.modifier: private final
focal_class.original_string: private final IgniteBiPredicate<K, V> filter;
focal_class.type: IgniteBiPredicate<K, V>
focal_class.var_name: filter
focal_class.declarator: transformerBuilder
focal_class.modifier: private final
focal_class.original_string: private final UpstreamTransformerBuilder transformerBuilder;
focal_class.type: UpstreamTransformerBuilder
focal_class.var_name: transformerBuilder
focal_class.declarator: upstreamKeepBinary
focal_class.modifier: private final
focal_class.original_string: private final boolean upstreamKeepBinary;
focal_class.type: boolean
focal_class.var_name: upstreamKeepBinary
focal_class.declarator: retries
focal_class.modifier: private final
focal_class.original_string: private final int retries;
focal_class.type: int
focal_class.var_name: retries
focal_class.file: modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/cache/CacheBasedDatasetBuilder.java
focal_class.identifier: CacheBasedDatasetBuilder
focal_class.interfaces: implements DatasetBuilder<K, V>
focal_class.class_method_signature: CacheBasedDatasetBuilder.CacheBasedDatasetBuilder(Ignite ignite, IgniteCache<K, V> upstreamCache)
focal_class.full_signature: public  CacheBasedDatasetBuilder(Ignite ignite, IgniteCache<K, V> upstreamCache)
focal_class.identifier: CacheBasedDatasetBuilder
focal_class.modifiers: public
focal_class.parameters: (Ignite ignite, IgniteCache<K, V> upstreamCache)
focal_class.signature:  CacheBasedDatasetBuilder(Ignite ignite, IgniteCache<K, V> upstreamCache)
focal_class.class_method_signature: CacheBasedDatasetBuilder.CacheBasedDatasetBuilder(Ignite ignite, IgniteCache<K, V> upstreamCache, IgniteBiPredicate<K, V> filter)
focal_class.full_signature: public  CacheBasedDatasetBuilder(Ignite ignite, IgniteCache<K, V> upstreamCache, IgniteBiPredicate<K, V> filter)
focal_class.identifier: CacheBasedDatasetBuilder
focal_class.modifiers: public
focal_class.parameters: (Ignite ignite, IgniteCache<K, V> upstreamCache, IgniteBiPredicate<K, V> filter)
focal_class.signature:  CacheBasedDatasetBuilder(Ignite ignite, IgniteCache<K, V> upstreamCache, IgniteBiPredicate<K, V> filter)
focal_class.class_method_signature: CacheBasedDatasetBuilder.CacheBasedDatasetBuilder(Ignite ignite,
          IgniteCache<K, V> upstreamCache,
          IgniteBiPredicate<K, V> filter,
          UpstreamTransformerBuilder transformerBuilder)
focal_class.full_signature: public  CacheBasedDatasetBuilder(Ignite ignite,
          IgniteCache<K, V> upstreamCache,
          IgniteBiPredicate<K, V> filter,
          UpstreamTransformerBuilder transformerBuilder)
focal_class.identifier: CacheBasedDatasetBuilder
focal_class.modifiers: public
focal_class.parameters: (Ignite ignite,
          IgniteCache<K, V> upstreamCache,
          IgniteBiPredicate<K, V> filter,
          UpstreamTransformerBuilder transformerBuilder)
focal_class.signature:  CacheBasedDatasetBuilder(Ignite ignite,
          IgniteCache<K, V> upstreamCache,
          IgniteBiPredicate<K, V> filter,
          UpstreamTransformerBuilder transformerBuilder)
focal_class.class_method_signature: CacheBasedDatasetBuilder.CacheBasedDatasetBuilder(Ignite ignite,
          IgniteCache<K, V> upstreamCache,
          IgniteBiPredicate<K, V> filter,
          UpstreamTransformerBuilder transformerBuilder,
          Boolean isKeepBinary,
          int retries)
focal_class.full_signature: public  CacheBasedDatasetBuilder(Ignite ignite,
          IgniteCache<K, V> upstreamCache,
          IgniteBiPredicate<K, V> filter,
          UpstreamTransformerBuilder transformerBuilder,
          Boolean isKeepBinary,
          int retries)
focal_class.identifier: CacheBasedDatasetBuilder
focal_class.modifiers: public
focal_class.parameters: (Ignite ignite,
          IgniteCache<K, V> upstreamCache,
          IgniteBiPredicate<K, V> filter,
          UpstreamTransformerBuilder transformerBuilder,
          Boolean isKeepBinary,
          int retries)
focal_class.signature:  CacheBasedDatasetBuilder(Ignite ignite,
          IgniteCache<K, V> upstreamCache,
          IgniteBiPredicate<K, V> filter,
          UpstreamTransformerBuilder transformerBuilder,
          Boolean isKeepBinary,
          int retries)
focal_class.class_method_signature: CacheBasedDatasetBuilder.build(
          LearningEnvironmentBuilder envBuilder,
          PartitionContextBuilder<K, V, C> partCtxBuilder,
          PartitionDataBuilder<K, V, C, D> partDataBuilder,
          LearningEnvironment localLearningEnv)
focal_class.full_signature: @SuppressWarnings("unchecked") @Override public CacheBasedDataset<K, V, C, D> build(
          LearningEnvironmentBuilder envBuilder,
          PartitionContextBuilder<K, V, C> partCtxBuilder,
          PartitionDataBuilder<K, V, C, D> partDataBuilder,
          LearningEnvironment localLearningEnv)
focal_class.identifier: build
focal_class.modifiers: @SuppressWarnings("unchecked") @Override public
focal_class.parameters: (
          LearningEnvironmentBuilder envBuilder,
          PartitionContextBuilder<K, V, C> partCtxBuilder,
          PartitionDataBuilder<K, V, C, D> partDataBuilder,
          LearningEnvironment localLearningEnv)
focal_class.return: CacheBasedDataset<K, V, C, D>
focal_class.signature: CacheBasedDataset<K, V, C, D> build(
          LearningEnvironmentBuilder envBuilder,
          PartitionContextBuilder<K, V, C> partCtxBuilder,
          PartitionDataBuilder<K, V, C, D> partDataBuilder,
          LearningEnvironment localLearningEnv)
focal_class.class_method_signature: CacheBasedDatasetBuilder.withUpstreamTransformer(UpstreamTransformerBuilder builder)
focal_class.full_signature: @Override public DatasetBuilder<K, V> withUpstreamTransformer(UpstreamTransformerBuilder builder)
focal_class.identifier: withUpstreamTransformer
focal_class.modifiers: @Override public
focal_class.parameters: (UpstreamTransformerBuilder builder)
focal_class.return: DatasetBuilder<K, V>
focal_class.signature: DatasetBuilder<K, V> withUpstreamTransformer(UpstreamTransformerBuilder builder)
focal_class.class_method_signature: CacheBasedDatasetBuilder.withFilter(IgniteBiPredicate<K, V> filterToAdd)
focal_class.full_signature: @Override public DatasetBuilder<K, V> withFilter(IgniteBiPredicate<K, V> filterToAdd)
focal_class.identifier: withFilter
focal_class.modifiers: @Override public
focal_class.parameters: (IgniteBiPredicate<K, V> filterToAdd)
focal_class.return: DatasetBuilder<K, V>
focal_class.signature: DatasetBuilder<K, V> withFilter(IgniteBiPredicate<K, V> filterToAdd)
focal_class.class_method_signature: CacheBasedDatasetBuilder.withKeepBinary(boolean isKeepBinary)
focal_class.full_signature: public CacheBasedDatasetBuilder<K, V> withKeepBinary(boolean isKeepBinary)
focal_class.identifier: withKeepBinary
focal_class.modifiers: public
focal_class.parameters: (boolean isKeepBinary)
focal_class.return: CacheBasedDatasetBuilder<K, V>
focal_class.signature: CacheBasedDatasetBuilder<K, V> withKeepBinary(boolean isKeepBinary)
focal_class.class_method_signature: CacheBasedDatasetBuilder.withRetriesNumber(int retries)
focal_class.full_signature: public CacheBasedDatasetBuilder<K, V> withRetriesNumber(int retries)
focal_class.identifier: withRetriesNumber
focal_class.modifiers: public
focal_class.parameters: (int retries)
focal_class.return: CacheBasedDatasetBuilder<K, V>
focal_class.signature: CacheBasedDatasetBuilder<K, V> withRetriesNumber(int retries)
focal_method.body: @SuppressWarnings("unchecked")
      @Override public <C extends Serializable, D extends AutoCloseable> CacheBasedDataset<K, V, C, D> build(
          LearningEnvironmentBuilder envBuilder,
          PartitionContextBuilder<K, V, C> partCtxBuilder,
          PartitionDataBuilder<K, V, C, D> partDataBuilder,
          LearningEnvironment localLearningEnv) {
  
          UUID datasetId = UUID.randomUUID();
  
          // Retrieves affinity function of the upstream Ignite Cache.
          CacheConfiguration<K, V> upstreamCacheConfiguration = upstreamCache.getConfiguration(CacheConfiguration.class);
          AffinityFunction upstreamCacheAffinity = upstreamCacheConfiguration.getAffinity();
  
          // Creates dataset cache configuration with affinity function that mimics to affinity function of the upstream
          // cache.
          CacheConfiguration<Integer, C> datasetCacheConfiguration = new CacheConfiguration<>();
          datasetCacheConfiguration.setName(String.format(DATASET_CACHE_TEMPLATE, upstreamCache.getName(), datasetId));
          datasetCacheConfiguration.setAffinity(new DatasetAffinityFunctionWrapper(upstreamCacheAffinity));
  
          IgniteCache<Integer, C> datasetCache = ignite.createCache(datasetCacheConfiguration);
  
          ComputeUtils.initContext(
              ignite,
              upstreamCache.getName(),
              transformerBuilder,
              filter,
              datasetCache.getName(),
              partCtxBuilder,
              envBuilder,
              retries,
              RETRY_INTERVAL,
              upstreamKeepBinary,
              localLearningEnv.deployingContext()
          );
  
          return new CacheBasedDataset<>(ignite, upstreamCache, filter, transformerBuilder, datasetCache, envBuilder, partDataBuilder, datasetId, upstreamKeepBinary, localLearningEnv, retries);
      }
focal_method.class_method_signature: CacheBasedDatasetBuilder.build(
          LearningEnvironmentBuilder envBuilder,
          PartitionContextBuilder<K, V, C> partCtxBuilder,
          PartitionDataBuilder<K, V, C, D> partDataBuilder,
          LearningEnvironment localLearningEnv)
focal_method.full_signature: @SuppressWarnings("unchecked") @Override public CacheBasedDataset<K, V, C, D> build(
          LearningEnvironmentBuilder envBuilder,
          PartitionContextBuilder<K, V, C> partCtxBuilder,
          PartitionDataBuilder<K, V, C, D> partDataBuilder,
          LearningEnvironment localLearningEnv)
focal_method.identifier: build
focal_method.invocations: randomUUID getConfiguration getAffinity setName format getName setAffinity createCache initContext getName getName deployingContext
focal_method.modifiers: @SuppressWarnings("unchecked") @Override public
focal_method.parameters: (
          LearningEnvironmentBuilder envBuilder,
          PartitionContextBuilder<K, V, C> partCtxBuilder,
          PartitionDataBuilder<K, V, C, D> partDataBuilder,
          LearningEnvironment localLearningEnv)
focal_method.return: CacheBasedDataset<K, V, C, D>
focal_method.signature: CacheBasedDataset<K, V, C, D> build(
          LearningEnvironmentBuilder envBuilder,
          PartitionContextBuilder<K, V, C> partCtxBuilder,
          PartitionDataBuilder<K, V, C, D> partDataBuilder,
          LearningEnvironment localLearningEnv)