Examples of DataSchema


Examples of com.linkedin.data.schema.DataSchema

      return false;
    }

    try
    {
      final DataSchema prevSchema = RestSpecCodec.textToSchema(prevType, _prevSchemaResolver);
      final DataSchema currSchema = RestSpecCodec.textToSchema(currType, _currSchemaResolver);

      CompatibilityResult compatibilityResult = CompatibilityChecker.checkCompatibility(prevSchema,
                                                                                        currSchema,
                                                                                        defaultOptions);
View Full Code Here

Examples of io.druid.segment.indexing.DataSchema

    if (ingestionSchema != null) {
      this.ingestionSchema = ingestionSchema;
    } else { // Backwards Compatible
      this.ingestionSchema = new IndexIngestionSpec(
          new DataSchema(
              dataSource,
              firehoseFactory.getParser(),
              aggregators,
              granularitySpec.withQueryGranularity(indexGranularity == null ? QueryGranularity.NONE : indexGranularity)
          ),
View Full Code Here

Examples of io.druid.segment.indexing.DataSchema

  public void testSerde() throws Exception
  {
    ObjectMapper jsonMapper = new DefaultObjectMapper();

    FireDepartment schema = new FireDepartment(
        new DataSchema(
            "foo",
            new StringInputRowParser(
                new JSONParseSpec(
                    new TimestampSpec(
                        "timestamp",
View Full Code Here

Examples of io.druid.segment.indexing.DataSchema

    if (fireDepartment != null) {
      this.spec = fireDepartment;
    } else {
      this.spec = new FireDepartment(
          new DataSchema(
              spec.getDataSource(),
              firehoseFactory == null ? null : firehoseFactory.getParser(),
              spec.getAggregators(),
              new UniformGranularitySpec(segmentGranularity, spec.getIndexGranularity(), null, segmentGranularity)
          ),
View Full Code Here

Examples of io.druid.segment.indexing.DataSchema

          throw Throwables.propagate(e);
        }
      }
    };

    DataSchema dataSchema = spec.getDataSchema();
    RealtimeIOConfig realtimeIOConfig = spec.getIOConfig();
    RealtimeTuningConfig tuningConfig = spec.getTuningConfig()
                                              .withBasePersistDirectory(new File(toolbox.getTaskWorkDir(), "persist"))
                                              .withVersioningPolicy(versioningPolicy);

    final FireDepartment fireDepartment = new FireDepartment(
        dataSchema,
        realtimeIOConfig,
        tuningConfig,
        null,
        null,
        null,
        null
    );
    final RealtimeMetricsMonitor metricsMonitor = new RealtimeMetricsMonitor(ImmutableList.of(fireDepartment));
    this.queryRunnerFactoryConglomerate = toolbox.getQueryRunnerFactoryConglomerate();

    // NOTE: This pusher selects path based purely on global configuration and the DataSegment, which means
    // NOTE: that redundant realtime tasks will upload to the same location. This can cause index.zip and
    // NOTE: descriptor.json to mismatch, or it can cause historical nodes to load different instances of the
    // NOTE: "same" segment.
    final RealtimePlumberSchool plumberSchool = new RealtimePlumberSchool(
        toolbox.getEmitter(),
        toolbox.getQueryRunnerFactoryConglomerate(),
        toolbox.getSegmentPusher(),
        lockingSegmentAnnouncer,
        segmentPublisher,
        toolbox.getNewSegmentServerView(),
        toolbox.getQueryExecutorService(),
        null,
        null,
        null,
        null,
        null,
        null,
        0
    );

    this.plumber = plumberSchool.findPlumber(dataSchema, tuningConfig, fireDepartment.getMetrics());

    try {
      plumber.startJob();

      // Set up metrics emission
      toolbox.getMonitorScheduler().addMonitor(metricsMonitor);

      // Time to read data!
      long nextFlush = new DateTime().plus(intermediatePersistPeriod).getMillis();
      while (firehose.hasMore()) {
        final InputRow inputRow;
        try {
          inputRow = firehose.nextRow();
          if (inputRow == null) {
            continue;
          }

          int currCount = plumber.add(inputRow);
          if (currCount == -1) {
            fireDepartment.getMetrics().incrementThrownAway();
            log.debug("Throwing away event[%s]", inputRow);

            if (System.currentTimeMillis() > nextFlush) {
              plumber.persist(firehose.commit());
              nextFlush = new DateTime().plus(intermediatePersistPeriod).getMillis();
            }

            continue;
          }

          fireDepartment.getMetrics().incrementProcessed();
          if (currCount >= tuningConfig.getMaxRowsInMemory() || System.currentTimeMillis() > nextFlush) {
            plumber.persist(firehose.commit());
            nextFlush = new DateTime().plus(intermediatePersistPeriod).getMillis();
          }
        }
        catch (ParseException e) {
          log.warn(e, "unparseable line");
          fireDepartment.getMetrics().incrementUnparseable();
        }
      }
    }
    catch (Throwable e) {
      normalExit = false;
      log.makeAlert(e, "Exception aborted realtime processing[%s]", dataSchema.getDataSource())
         .emit();
      throw e;
    }
    finally {
      if (normalExit) {
View Full Code Here

Examples of io.druid.segment.indexing.DataSchema

public class SinkTest
{
  @Test
  public void testSwap() throws Exception
  {
    final DataSchema schema = new DataSchema(
        "test",
        null,
        new AggregatorFactory[]{new CountAggregatorFactory("rows")},
        new UniformGranularitySpec(Granularity.HOUR, QueryGranularity.MINUTE, null, Granularity.HOUR)
    );
View Full Code Here

Examples of io.druid.segment.indexing.DataSchema

  {
    final List<InputRow> rows = Arrays.asList(
        makeRow(new DateTime("9000-01-01").getMillis()), makeRow(new DateTime().getMillis())
    );

    schema = new DataSchema(
        "test",
        null,
        new AggregatorFactory[]{new CountAggregatorFactory("rows")},
        new UniformGranularitySpec(Granularity.HOUR, QueryGranularity.NONE, null, Granularity.HOUR)
    );
View Full Code Here

Examples of io.druid.segment.indexing.DataSchema

  {

    final File tmpDir = Files.createTempDir();
    tmpDir.deleteOnExit();

     schema = new DataSchema(
        "test",
        new InputRowParser()
        {
          @Override
          public InputRow parse(Object input)
View Full Code Here

Examples of io.druid.segment.indexing.DataSchema

  @LifecycleStart
  public void start() throws IOException
  {
    for (final FireDepartment fireDepartment : fireDepartments) {
      DataSchema schema = fireDepartment.getDataSchema();

      final FireChief chief = new FireChief(fireDepartment);
      chiefs.put(schema.getDataSource(), chief);

      chief.setName(String.format("chief-%s", schema.getDataSource()));
      chief.setDaemon(true);
      chief.init();
      chief.start();
    }
  }
View Full Code Here

Examples of io.druid.segment.indexing.DataSchema

      Preconditions.checkNotNull(schema, "schema");
      Preconditions.checkNotNull(config, "config");
      Preconditions.checkNotNull(firehoseFactory, "firehoseFactory");
      Preconditions.checkNotNull(plumberSchool, "plumberSchool");

      this.dataSchema = new DataSchema(
          schema.getDataSource(),
          firehoseFactory.getParser(),
          schema.getAggregators(),
          new UniformGranularitySpec(
              plumberSchool.getSegmentGranularity(),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.