Package mil.nga.giat.geowave.index

Examples of mil.nga.giat.geowave.index.ByteArrayId


      throws IOException {
    super.readFields(input);
    final int dataIdLength = input.readInt();
    final byte[] dataIdBytes = new byte[dataIdLength];
    input.readFully(dataIdBytes);
    dataId = new ByteArrayId(
        dataIdBytes);
  }
View Full Code Here


  public TdriveIngestPlugin() {

    tdrivepointType = TdriveUtils.createTdrivePointDataType();

    pointKey = new ByteArrayId(
        StringUtils.stringToBinary(TdriveUtils.TDRIVE_POINT_FEATURE));
    tdrivepointBuilder = new SimpleFeatureBuilder(
        tdrivepointType);
    supportedIndices = new Index[] {
      IndexType.SPATIAL_VECTOR.createDefaultIndex(),
View Full Code Here

    // to judge an overlap of range data.
    Map<ByteArrayId, DimensionRangePair> fieldsRangeData = new HashMap<ByteArrayId, DimensionRangePair>(
        dimensions.length);

    for (int d = 0; d < dimensions.length; d++) {
      final ByteArrayId fieldId = dimensions[d].getFieldId();
      DimensionRangePair fieldData = fieldsRangeData.get(fieldId);
      if (fieldData == null) {
        fieldsRangeData.put(
            fieldId,
            new DimensionRangePair(
View Full Code Here

        boxRangeData);
    final int size = untrimmedResult.size();
    if (size > 2) {
      Iterator<ByteArrayId> it = untrimmedResult.iterator();
      while (it.hasNext()) {
        ByteArrayId insertionId = it.next();
        MultiDimensionalNumericData md = correctForNormalizationError(index.getIndexStrategy().getRangeForId(
            insertionId));
        // used to check the result of the index strategy
        if (LOGGER.isDebugEnabled() && checkCoverage(
            boxRangeData,
View Full Code Here

        cardinalityPerDimension,
        query.getDimensionCount());
    return new RangeDecomposition(
        new ByteArrayRange[] {
          new ByteArrayRange(
              new ByteArrayId(
                  minZorder),
              new ByteArrayId(
                  maxZorder))
        });
  }
View Full Code Here

        0,
        rowIds.size());

    accumuloOptions.setCreateTable(true);

    final ByteArrayId rowId1 = mockDataStore.ingest(
        adapter,
        index,
        new TestGeometry(
            factory.createPoint(new Coordinate(
                25,
                32)),
            "test_pt_1")).get(
        0);

    // as we have chosen not to persist the index, we will not see an index
    // entry in the index store
    assertEquals(
        false,
        indexStore.indexExists(index.getId()));

    final TestGeometry geom1 = mockDataStore.getEntry(
        index,
        rowId1);

    // even though we didn't persist the index, the test point was still
    // stored
    assertEquals(
        "test_pt_1",
        geom1.id);

    accumuloOptions.setPersistIndex(true);

    final ByteArrayId rowId2 = mockDataStore.ingest(
        adapter,
        index,
        new TestGeometry(
            factory.createPoint(new Coordinate(
                25,
View Full Code Here

    final String tableName = StringUtils.stringFromBinary(index.getId().getBytes());
    final byte[] adapterId = adapter.getAdapterId().getBytes();

    accumuloOptions.setUseLocalityGroups(false);

    final ByteArrayId rowId1 = mockDataStore.ingest(
        adapter,
        index,
        new TestGeometry(
            factory.createPoint(new Coordinate(
                25,
                32)),
            "test_pt_1")).get(
        0);

    try {
      // as we are not using locality groups, we expect that this will
      // return false
      assertEquals(
          false,
          accumuloOperations.localityGroupExists(
              tableName,
              adapterId));
    }
    catch (final AccumuloException | TableNotFoundException e) {
      LOGGER.error(
          "Locality Group check failed",
          e);
    }

    final TestGeometry geom1 = mockDataStore.getEntry(
        index,
        rowId1);

    // of course, the point is actually stored in this case
    assertEquals(
        "test_pt_1",
        geom1.id);

    accumuloOptions.setUseLocalityGroups(true);

    final ByteArrayId rowId2 = mockDataStore.ingest(
        adapter,
        index,
        new TestGeometry(
            factory.createPoint(new Coordinate(
                25,
View Full Code Here

    final Index index = IndexType.SPATIAL_VECTOR.createDefaultIndex();
    final WritableDataAdapter<TestGeometry> adapter = new TestGeometryAdapter();

    accumuloOptions.setPersistAdapter(false);

    final ByteArrayId rowId1 = mockDataStore.ingest(
        adapter,
        index,
        new TestGeometry(
            factory.createPoint(new Coordinate(
                25,
                32)),
            "test_pt_1")).get(
        0);

    TestGeometry geom1 = mockDataStore.getEntry(
        index,
        rowId1);

    // without specifying the adapter, this method returns null
    assertEquals(
        null,
        geom1);

    final CloseableIterator<TestGeometry> geomItr = mockDataStore.query(
        adapter,
        null);

    geom1 = geomItr.next();

    try {
      geomItr.close();
    }
    catch (final IOException e) {
      LOGGER.error(
          "Iterator close error",
          e);
    }

    // specifying the adapter, this method returns the entry
    assertEquals(
        "test_pt_1",
        geom1.id);

    // the adapter should not exist in the metadata table
    assertEquals(
        false,
        adapterStore.adapterExists(adapter.getAdapterId()));

    accumuloOptions.setPersistAdapter(true);

    final ByteArrayId rowId2 = mockDataStore.ingest(
        adapter,
        index,
        new TestGeometry(
            factory.createPoint(new Coordinate(
                25,
View Full Code Here

  public void testAlternateIndexOption() {

    final Index index = IndexType.SPATIAL_VECTOR.createDefaultIndex();
    final WritableDataAdapter<TestGeometry> adapter = new TestGeometryAdapter();

    final ByteArrayId adapterId = adapter.getAdapterId();

    accumuloOptions.setUseAltIndex(false);

    final ByteArrayId rowId0 = mockDataStore.ingest(
        adapter,
        index,
        new TestGeometry(
            factory.createPoint(new Coordinate(
                25,
                32)),
            "test_pt_0")).get(
        0);

    TestGeometry geom0 = mockDataStore.getEntry(
        index,
        new ByteArrayId(
            "test_pt_0"),
        adapterId);

    // this should return our data correctly
    assertEquals(
        "test_pt_0",
        geom0.id);

    // delete entry by data id & adapter id
    mockDataStore.deleteEntry(
        index,
        new ByteArrayId(
            "test_pt_0"),
        adapterId);

    geom0 = mockDataStore.getEntry(
        index,
        new ByteArrayId(
            "test_pt_0"),
        adapterId);

    // this should return null as the entry was deleted
    assertEquals(
        null,
        geom0);

    accumuloOptions.setUseAltIndex(true);

    accumuloOperations.deleteAll();

    mockDataStore.ingest(
        adapter,
        index,
        new TestGeometry(
            factory.createPoint(new Coordinate(
                25,
                32)),
            "test_pt_1")).get(
        0);

    final TestGeometry geom1 = mockDataStore.getEntry(
        index,
        new ByteArrayId(
            "test_pt_1"),
        adapterId);

    // this should return our data correctly
    assertEquals(
        "test_pt_1",
        geom1.id);

    final ArrayList<TestGeometry> geomList = new ArrayList<TestGeometry>();
    geomList.add(new TestGeometry(
        factory.createPoint(new Coordinate(
            25,
            32)),
        "test_pt_2"));

    mockDataStore.ingest(
        adapter,
        index,
        geomList.iterator());

    final TestGeometry geom2 = mockDataStore.getEntry(
        index,
        new ByteArrayId(
            "test_pt_2"),
        adapterId);

    // this should return our data correctly
    assertEquals(
        "test_pt_2",
        geom2.id);

    final AccumuloIndexWriter indexWriter = new AccumuloIndexWriter(
        index,
        accumuloOperations,
        accumuloOptions,
        mockDataStore);

    indexWriter.write(
        adapter,
        new TestGeometry(
            factory.createPoint(new Coordinate(
                25,
                32)),
            "test_pt_3"));

    indexWriter.close();

    final TestGeometry geom3 = mockDataStore.getEntry(
        index,
        new ByteArrayId(
            "test_pt_3"),
        adapterId);

    // this should return our data correctly
    assertEquals(
View Full Code Here

    final WritableDataAdapter<TestGeometry> adapter0 = new TestGeometryAdapter();
    final WritableDataAdapter<TestGeometry> adapter1 = new AnotherAdapter();

    accumuloOptions.setUseAltIndex(true);

    final ByteArrayId rowId0 = mockDataStore.ingest(
        adapter0,
        index,
        new TestGeometry(
            factory.createPoint(new Coordinate(
                25,
                32)),
            "test_pt_0")).get(
        0);

    TestGeometry geom0 = mockDataStore.getEntry(
        index,
        new ByteArrayId(
            "test_pt_0"),
            adapter0.getAdapterId());
   
    final ByteArrayId rowId1 = mockDataStore.ingest(
        adapter1,
        index,
        new TestGeometry(
            factory.createPoint(new Coordinate(
                25,
                32)),
            "test_pt_1")).get(
        0);

    TestGeometry geom1 = mockDataStore.getEntry(
        index,
        new ByteArrayId(
            "test_pt_1"),
            adapter1.getAdapterId());

    // this should return our data correctly
    assertEquals(
        "test_pt_1",
        geom1.id);

    // delete entry by data id & adapter id
    mockDataStore.deleteEntries(adapter0, index);

    geom0 = mockDataStore.getEntry(
        index,
        new ByteArrayId(
            "test_pt_0"),
        adapter0.getAdapterId());

    // this should return null as the entry was deleted
    assertEquals(
        null,
        geom0);
   
    geom1 = mockDataStore.getEntry(
        index,
        new ByteArrayId(
            "test_pt_1"),
        adapter1.getAdapterId());

    // this should return null as the entry was deleted
    assertEquals(
View Full Code Here

TOP

Related Classes of mil.nga.giat.geowave.index.ByteArrayId

Copyright © 2018 www.massapicom. 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.