test_class.declarator: formatAnalysis
test_class.modifier: @Autowired
test_class.original_string: @Autowired
      FormatAnalysis formatAnalysis;
test_class.type: FormatAnalysis
test_class.var_name: formatAnalysis
test_class.declarator: schemaAnalysis
test_class.modifier: @Autowired
test_class.original_string: @Autowired
      SchemaAnalysis schemaAnalysis;
test_class.type: SchemaAnalysis
test_class.var_name: schemaAnalysis
test_class.declarator: contentAnalysis
test_class.modifier: @Autowired
test_class.original_string: @Autowired
      ContentAnalysis contentAnalysis;
test_class.type: ContentAnalysis
test_class.var_name: contentAnalysis
test_class.declarator: random = new Random()
test_class.modifier: private
test_class.original_string: private Random random = new Random();
test_class.type: Random
test_class.var_name: random
test_class.file: dataprep-dataset/src/test/java/org/talend/dataprep/dataset/service/analysis/synchronous/SchemaAnalysisTest.java
test_class.identifier: SchemaAnalysisTest
test_class.superclass: extends DataSetBaseTest
test_case.body: @Test
      public void testNoDataSetFound() {
          schemaAnalysis.analyze("1234");
          assertThat(dataSetMetadataRepository.get("1234"), nullValue());
      }
test_case.class_method_signature: SchemaAnalysisTest.testNoDataSetFound()
test_case.full_signature: @Test public void testNoDataSetFound()
test_case.identifier: testNoDataSetFound
test_case.invocations: analyze assertThat get nullValue
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testNoDataSetFound()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(SchemaAnalysis.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(SchemaAnalysis.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: repository
focal_class.modifier: @Autowired
focal_class.original_string: @Autowired
      DataSetMetadataRepository repository;
focal_class.type: DataSetMetadataRepository
focal_class.var_name: repository
focal_class.declarator: store
focal_class.modifier: @Autowired
focal_class.original_string: @Autowired
      ContentStoreRouter store;
focal_class.type: ContentStoreRouter
focal_class.var_name: store
focal_class.declarator: adapter
focal_class.modifier: @Autowired
focal_class.original_string: @Autowired
      StatisticsAdapter adapter;
focal_class.type: StatisticsAdapter
focal_class.var_name: adapter
focal_class.declarator: analyzerService
focal_class.modifier: @Autowired
focal_class.original_string: @Autowired
      AnalyzerService analyzerService;
focal_class.type: AnalyzerService
focal_class.var_name: analyzerService
focal_class.file: dataprep-dataset/src/main/java/org/talend/dataprep/dataset/service/analysis/synchronous/SchemaAnalysis.java
focal_class.identifier: SchemaAnalysis
focal_class.interfaces: implements SynchronousDataSetAnalyzer
focal_class.class_method_signature: SchemaAnalysis.analyze(String dataSetId)
focal_class.full_signature: @Override public void analyze(String dataSetId)
focal_class.identifier: analyze
focal_class.modifiers: @Override public
focal_class.parameters: (String dataSetId)
focal_class.return: void
focal_class.signature: void analyze(String dataSetId)
focal_class.class_method_signature: SchemaAnalysis.order()
focal_class.full_signature: @Override public int order()
focal_class.identifier: order
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int order()
focal_method.body: @Override
      public void analyze(String dataSetId) {
          if (StringUtils.isEmpty(dataSetId)) {
              throw new IllegalArgumentException("Data set id cannot be null or empty.");
          }
          DistributedLock datasetLock = repository.createDatasetMetadataLock(dataSetId);
          datasetLock.lock();
          try {
              DataSetMetadata metadata = repository.get(dataSetId);
              if (metadata == null) {
                  LOGGER.info("Unable to analyze schema of data set #{}: seems to be removed.", dataSetId);
                  return;
              }
              // Schema analysis
              try (Stream<DataSetRow> stream = store.stream(metadata)) {
                  LOGGER.info("Analyzing schema in dataset #{}...", dataSetId);
                  // Configure analyzers
                  final List<ColumnMetadata> columns = metadata.getRowMetadata().getColumns();
                  try (Analyzer<Analyzers.Result> analyzer = analyzerService.schemaAnalysis(columns)) {
                      // Determine schema for the content.
                      stream.limit(100).map(row -> row.toArray(DataSetRow.SKIP_TDP_ID)).forEach(analyzer::analyze);
  
                      // Find the best suitable type
                      adapter.adapt(columns, analyzer.getResult());
                      LOGGER.info("Analyzed schema in dataset #{}.", dataSetId);
                      metadata.getLifecycle().schemaAnalyzed(true);
  
                      DataSetMetadata savedDataSetMetadata = repository.get(dataSetId);
                      // in order to check that the dataset was not deleted during analysis
                      if (savedDataSetMetadata != null) {
                          repository.save(metadata);
                      } else {
                          LOGGER.info("Data set #{} no longer exists.", dataSetId); //$NON-NLS-1$
                      }
                  }
              } catch (Exception e) {
                  LOGGER.error("Unable to analyse schema for dataset " + dataSetId + ".", e);
                  TDPException.rethrowOrWrap(e, UNABLE_TO_ANALYZE_COLUMN_TYPES);
              }
          } finally {
              datasetLock.unlock();
          }
      }
focal_method.class_method_signature: SchemaAnalysis.analyze(String dataSetId)
focal_method.full_signature: @Override public void analyze(String dataSetId)
focal_method.identifier: analyze
focal_method.invocations: isEmpty createDatasetMetadataLock lock get info stream info getColumns getRowMetadata schemaAnalysis forEach map limit toArray adapt getResult info schemaAnalyzed getLifecycle get save info error rethrowOrWrap unlock
focal_method.modifiers: @Override public
focal_method.parameters: (String dataSetId)
focal_method.return: void
focal_method.signature: void analyze(String dataSetId)