it.unimi.dsi.fastutil.longs.LongArrayList Java Examples

The following examples show how to use it.unimi.dsi.fastutil.longs.LongArrayList. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RocksDaoTest.java    From fasten with Apache License 2.0 6 votes vote down vote up
@Test
public void databaseTest3() throws IOException, RocksDBException {
    var json = new JSONObject("{" +
            "\"index\": 3," +
            "\"product\": \"test\"," +
            "\"version\": \"0.0.1\"," +
            "\"nodes\": [255, 256, 257, 258]," +
            "\"numInternalNodes\": 4," +
            "\"edges\": [[255, 256], [255, 258], [256, 257], [257, 258]]" +
            "}");
    var graph = GidGraph.getGraph(json);
    rocksDao.saveToRocksDb(graph.getIndex(), graph.getNodes(), graph.getNumInternalNodes(), graph.getEdges());
    var graphData = rocksDao.getGraphData(graph.getIndex());
    assertEquals(graph.getNumInternalNodes(), graphData.nodes().size() - graphData.externalNodes().size());
    assertEquals(graph.getNodes().size(), graphData.nodes().size());
    assertEquals(new LongOpenHashSet((graph.getNodes())), new LongOpenHashSet(graphData.nodes()));
    assertEquals(new LongArrayList(List.of(256L, 258L)), graphData.successors(255L));
    assertEquals(new LongArrayList(List.of(257L)), graphData.successors(256L));
    assertEquals(new LongArrayList(List.of(258L)), graphData.successors(257L));
    assertEquals(new LongArrayList(List.of()), graphData.predecessors(255L));
    assertEquals(new LongArrayList(List.of(255L)), graphData.predecessors(256L));
    assertEquals(new LongArrayList(List.of(256L)), graphData.predecessors(257L));
    assertEquals(new LongArrayList(List.of(255L, 257L)), graphData.predecessors(258L));
    assertEquals(graph.getEdges().size(), graphData.numArcs());
    assertEquals(new LongOpenHashSet(), graphData.externalNodes());
}
 
Example #2
Source File: SalsaSelectResults.java    From GraphJet with Apache License 2.0 6 votes vote down vote up
/**
 * Pick the top social proofs for each RHS node
 */
private Map<Byte, ConnectingUsersWithMetadata> pickTopSocialProofs(
  SmallArrayBasedLongToDoubleMap[] socialProofs,
  byte[] validSocialProofs
) {
  Map<Byte, ConnectingUsersWithMetadata> results = new HashMap<Byte, ConnectingUsersWithMetadata>();
  int length = validSocialProofs.length;

  for (int i = 0; i < length; i++) {
    SmallArrayBasedLongToDoubleMap socialProof = socialProofs[validSocialProofs[i]];
    if (socialProof != null) {
      if (socialProof.size() > 1) {
        socialProof.sort();
      }

      socialProof.trim(socialProof.size());
      results.put((byte) i, new ConnectingUsersWithMetadata(
        new LongArrayList(socialProof.keys()),
        new LongArrayList(socialProof.metadata())
      ));
    }
  }
  return results;
}
 
Example #3
Source File: SnapshotCodecV2.java    From phoenix-tephra with Apache License 2.0 6 votes vote down vote up
@Override
protected NavigableMap<Long, TransactionManager.InProgressTx> decodeInProgress(BinaryDecoder decoder)
  throws IOException {

  int size = decoder.readInt();
  NavigableMap<Long, TransactionManager.InProgressTx> inProgress = Maps.newTreeMap();
  while (size != 0) { // zero denotes end of list as per AVRO spec
    for (int remaining = size; remaining > 0; --remaining) {
      long txId = decoder.readLong();
      long expiration = decoder.readLong();
      long visibilityUpperBound = decoder.readLong();
      int txTypeIdx = decoder.readInt();
      TransactionManager.InProgressType txType;
      try {
        txType = TransactionManager.InProgressType.values()[txTypeIdx];
      } catch (ArrayIndexOutOfBoundsException e) {
        throw new IOException("Type enum ordinal value is out of range: " + txTypeIdx);
      }
      inProgress.put(txId,
                     new TransactionManager.InProgressTx(visibilityUpperBound, expiration, txType,
                         new LongArrayList()));
    }
    size = decoder.readInt();
  }
  return inProgress;
}
 
Example #4
Source File: PopularityPostFiltering.java    From StreamingRec with Apache License 2.0 6 votes vote down vote up
@Override
public LongArrayList recommendInternal(ClickData clickData) {
	//filter out items with low overall click counts
	//first, retrieve the recommendation results of the underlying algorithm
	LongArrayList rec = mainStrategy.recommendInternal(clickData);
	
	//create lists of filtered items and retained items
	LongArrayList filteredRec = new LongArrayList();
	LongArrayList filteredRecNotMatch = new LongArrayList();
	//iterate over the recommendation list of the underlying strategy
	for (int j = 0; j < rec.size(); j++) {
		long i = rec.getLong(j);
		//filter items if they do not have enough clicks
		if ((itemClickCount.containsKey(i)) && (itemClickCount.get(i) >= minClickCount)) {
			filteredRec.add(i);
		} else if (fallback) {
			//if we have a fallback, add the filtered item to the fallback list
			filteredRecNotMatch.add(i);
		}
	}
	//merge the filtered list with the fallback list (empty in case fallback==false)
	filteredRec.addAll(filteredRecNotMatch);
	//return the filtered list
	return filteredRec;
}
 
Example #5
Source File: RocksDaoTest.java    From fasten with Apache License 2.0 6 votes vote down vote up
@Test
public void databaseTest1() throws IOException, RocksDBException {
    var json = new JSONObject("{" +
            "\"index\": 1," +
            "\"product\": \"test\"," +
            "\"version\": \"0.0.1\"," +
            "\"nodes\": [0, 1, 2]," +
            "\"numInternalNodes\": 2," +
            "\"edges\": [[0, 1], [1, 2]]" +
            "}");
    var graph = GidGraph.getGraph(json);
    rocksDao.saveToRocksDb(graph.getIndex(), graph.getNodes(), graph.getNumInternalNodes(), graph.getEdges());
    var graphData = rocksDao.getGraphData(graph.getIndex());
    assertEquals(graph.getNumInternalNodes(), graphData.nodes().size() - graphData.externalNodes().size());
    assertEquals(graph.getNodes().size(), graphData.nodes().size());
    assertEquals(new LongOpenHashSet(graph.getNodes()), graphData.nodes());
    assertEquals(new LongArrayList(List.of(1L)), graphData.successors(0L));
    assertEquals(new LongArrayList(List.of(2L)), graphData.successors(1L));
    assertEquals(new LongArrayList(List.of(0L)), graphData.predecessors(1L));
    assertEquals(new LongArrayList(List.of(1L)), graphData.predecessors(2L));
    assertEquals(graph.getEdges().size(), graphData.numArcs());
    assertEquals(new LongOpenHashSet(List.of(2L)), graphData.externalNodes());
}
 
Example #6
Source File: RocksDaoTest.java    From fasten with Apache License 2.0 6 votes vote down vote up
@Test
public void databaseTest5() throws IOException, RocksDBException {
    var json = new JSONObject("{" +
            "\"index\": 2," +
            "\"product\": \"test\"," +
            "\"version\": \"0.0.1\"," +
            "\"nodes\": [9223372036854775804, 9223372036854775805, 9223372036854775806, 9223372036854775807]," +
            "\"numInternalNodes\": 3," +
            "\"edges\": [[9223372036854775804, 9223372036854775805], [9223372036854775804, 9223372036854775807], [9223372036854775805, 9223372036854775806], [9223372036854775806, 9223372036854775807]]" +
            "}");
    var graph = GidGraph.getGraph(json);
    rocksDao.saveToRocksDb(graph.getIndex(), graph.getNodes(), graph.getNumInternalNodes(), graph.getEdges());
    var graphData = rocksDao.getGraphData(graph.getIndex());
    assertEquals(graph.getNumInternalNodes(), graphData.nodes().size() - graphData.externalNodes().size());
    assertEquals(graph.getNodes().size(), graphData.nodes().size());
    assertEquals(new LongOpenHashSet(graph.getNodes()), graphData.nodes());
    assertEquals(new LongArrayList(List.of(9223372036854775805L, 9223372036854775807L)), graphData.successors(9223372036854775804L));
    assertEquals(new LongArrayList(List.of(9223372036854775806L)), graphData.successors(9223372036854775805L));
    assertEquals(new LongArrayList(List.of(9223372036854775807L)), graphData.successors(9223372036854775806L));
    assertEquals(new LongArrayList(), graphData.predecessors(9223372036854775804L));
    assertEquals(new LongArrayList(List.of(9223372036854775804L)), graphData.predecessors(9223372036854775805L));
    assertEquals(new LongArrayList(List.of(9223372036854775805L)), graphData.predecessors(9223372036854775806L));
    assertEquals(new LongArrayList(List.of(9223372036854775804L, 9223372036854775806L)), graphData.predecessors(9223372036854775807L));
    assertEquals(graph.getEdges().size(), graphData.numArcs());
    assertEquals(new LongOpenHashSet(List.of(9223372036854775807L)), graphData.externalNodes());
}
 
Example #7
Source File: CollectionUtils.java    From metanome-algorithms with Apache License 2.0 6 votes vote down vote up
public static String concat(LongArrayList longs, String separator) {
	if (longs == null)
		return "";
	
	StringBuilder buffer = new StringBuilder();
	
	for (long longValue : longs) {
		buffer.append(longValue);
		buffer.append(separator);
	}
	
	if (buffer.length() > separator.length())
		buffer.delete(buffer.length() - separator.length(), buffer.length());
	
	return buffer.toString();
}
 
Example #8
Source File: PagesIndex.java    From presto with Apache License 2.0 6 votes vote down vote up
private PagesIndex(
        OrderingCompiler orderingCompiler,
        JoinCompiler joinCompiler,
        Metadata metadata,
        List<Type> types,
        int expectedPositions,
        boolean eagerCompact)
{
    this.orderingCompiler = requireNonNull(orderingCompiler, "orderingCompiler is null");
    this.joinCompiler = requireNonNull(joinCompiler, "joinCompiler is null");
    this.metadata = requireNonNull(metadata, "metadata is null");
    this.types = ImmutableList.copyOf(requireNonNull(types, "types is null"));
    this.valueAddresses = new LongArrayList(expectedPositions);
    this.eagerCompact = eagerCompact;

    //noinspection unchecked
    channels = (ObjectArrayList<Block>[]) new ObjectArrayList[types.size()];
    for (int i = 0; i < channels.length; i++) {
        channels[i] = ObjectArrayList.wrap(new Block[1024], 0);
    }

    estimatedSize = calculateEstimatedSize();
}
 
Example #9
Source File: AvroRecordConverter.java    From parquet-mr with Apache License 2.0 6 votes vote down vote up
@Override
public void end() {
  if (elementClass == boolean.class) {
    parent.add(((BooleanArrayList) container).toBooleanArray());
  } else if (elementClass == byte.class) {
    parent.add(((ByteArrayList) container).toByteArray());
  } else if (elementClass == char.class) {
    parent.add(((CharArrayList) container).toCharArray());
  } else if (elementClass == short.class) {
    parent.add(((ShortArrayList) container).toShortArray());
  } else if (elementClass == int.class) {
    parent.add(((IntArrayList) container).toIntArray());
  } else if (elementClass == long.class) {
    parent.add(((LongArrayList) container).toLongArray());
  } else if (elementClass == float.class) {
    parent.add(((FloatArrayList) container).toFloatArray());
  } else if (elementClass == double.class) {
    parent.add(((DoubleArrayList) container).toDoubleArray());
  } else {
    parent.add(((ArrayList) container).toArray());
  }
}
 
Example #10
Source File: LongColumn.java    From tablesaw with Apache License 2.0 6 votes vote down vote up
@Override
public LongColumn lag(int n) {
  final int srcPos = n >= 0 ? 0 : 0 - n;
  final long[] dest = new long[size()];
  final int destPos = n <= 0 ? 0 : n;
  final int length = n >= 0 ? size() - n : size() + n;

  for (int i = 0; i < size(); i++) {
    dest[i] = LongColumnType.missingValueIndicator();
  }

  long[] array = data.toLongArray();

  System.arraycopy(array, srcPos, dest, destPos, length);
  return new LongColumn(name() + " lag(" + n + ")", new LongArrayList(dest));
}
 
Example #11
Source File: InstantColumn.java    From tablesaw with Apache License 2.0 6 votes vote down vote up
@Override
public InstantColumn lag(int n) {
  int srcPos = n >= 0 ? 0 : 0 - n;
  long[] dest = new long[size()];
  int destPos = n <= 0 ? 0 : n;
  int length = n >= 0 ? size() - n : size() + n;

  for (int i = 0; i < size(); i++) {
    dest[i] = InstantColumnType.missingValueIndicator();
  }

  System.arraycopy(data.toLongArray(), srcPos, dest, destPos, length);

  InstantColumn copy = emptyCopy(size());
  copy.data = new LongArrayList(dest);
  copy.setName(name() + " lag(" + n + ")");
  return copy;
}
 
Example #12
Source File: MeanF1.java    From StreamingRec with Apache License 2.0 6 votes vote down vote up
@Override
public void evaluate(Transaction transaction, LongArrayList recommendations, LongOpenHashSet userTransactions) {
	if(precision==null){
		//if the delegation objects are not yet created, create them
		precision = new PrecisionOrRecall();
		precision.setType(Type.Precision);
		precision.setK(k);
		
		recall = new PrecisionOrRecall();
		recall.setType(Type.Recall);
		recall.setK(k);
	}
	
	//delegate the work to Precision and Recall instances
	precision.evaluate(transaction, recommendations, userTransactions);
	recall.evaluate(transaction, recommendations, userTransactions);
}
 
Example #13
Source File: F1.java    From StreamingRec with Apache License 2.0 6 votes vote down vote up
@Override
public void evaluate(Transaction transaction, LongArrayList recommendations, LongOpenHashSet userTransactions) {
	if(precision==null){
		//if the delegation objects are not yet created, create them
		precision = new PrecisionOrRecall();
		precision.setType(Type.Precision);
		precision.setK(k);
		
		recall = new PrecisionOrRecall();
		recall.setType(Type.Recall);
		recall.setK(k);
	}
	
	//delegate the work to Precision and Recall instances
	precision.evaluate(transaction, recommendations, userTransactions);
	recall.evaluate(transaction, recommendations, userTransactions);
}
 
Example #14
Source File: TopSecondDegreeByCountForUserTest.java    From GraphJet with Apache License 2.0 6 votes vote down vote up
@Test
public void testTopSecondDegreeByCountForUsersWithSmallGraph2() throws Exception {
  // Test 2: Test with small maxNumResults
  LongList metadata = new LongArrayList(new long[]{0, 0, 0});
  HashMap<Byte, ConnectingUsersWithMetadata> socialProofFor3 = new HashMap<> ();
  socialProofFor3.put((byte) 1, new ConnectingUsersWithMetadata(new LongArrayList(new long[]{1, 2, 3}), metadata));

  Map<Byte, Integer> minUserPerSocialProof = new HashMap<>();
  List<UserRecommendationInfo> expectedTopResults = new ArrayList<>();

  byte[] socialProofTypes = new byte[] {0, 1, 2, 3};
  RecommendationStats expectedTopSecondDegreeByCountStats = new RecommendationStats(5, 6, 17, 2, 4, 0);

  int maxNumResults = 1;
  expectedTopResults.clear();
  expectedTopResults.add(new UserRecommendationInfo(3, 3.0, socialProofFor3));
  testTopSecondDegreeByCountHelper(
    maxNumResults,
    minUserPerSocialProof,
    socialProofTypes,
    expectedTopResults,
    expectedTopSecondDegreeByCountStats);
}
 
Example #15
Source File: BPR.java    From StreamingRec with Apache License 2.0 6 votes vote down vote up
@Override
public LongArrayList recommendInternal(ClickData clickData) {
	// Calculate rating predictions for all items we know
	Map<Long, Float> predictions = new HashMap<>();
	float pred = Float.NaN;

	// Go through all the items
	for (Long item : items) {

		// make a prediction and remember it in case the recommender
		// could make one
		pred = predictRatingBPR(clickData.click.userId, item);
		if (!Float.isNaN(pred)) {
			predictions.put(item, pred);
		}
	}

	return new LongArrayList(Util.sortByValue(predictions, false).keySet());
}
 
Example #16
Source File: LongColumn.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
public static LongColumn create(String name, int initialSize) {
  LongColumn column = new LongColumn(name, new LongArrayList(initialSize));
  for (int i = 0; i < initialSize; i++) {
    column.appendMissing();
  }
  return column;
}
 
Example #17
Source File: J7FileStatsStorage.java    From deeplearning4j with Apache License 2.0 5 votes vote down vote up
@Override
public long[] getAllUpdateTimes(String sessionID, String typeID, String workerID) {
    String sql = "SELECT Timestamp FROM " + TABLE_NAME_UPDATES + " WHERE SessionID = '" + sessionID + "'  "
            + "AND TypeID = '" + typeID + "' AND workerID = '" + workerID + "';";
    try (Statement statement = connection.createStatement()) {
        ResultSet rs = statement.executeQuery(sql);
        LongArrayList list = new LongArrayList();
        while (rs.next()) {
            list.add(rs.getLong(1));
        }
        return list.toLongArray();
    } catch (SQLException e) {
        throw new RuntimeException(e);
    }
}
 
Example #18
Source File: PageRank.java    From GraphJet with Apache License 2.0 5 votes vote down vote up
private void iterate(double dampingAmount, LongArrayList noOuts) {
  double nextPR[] = new double[(int) (maxNodeId + 1)]; // PageRank vector after the iteration.

  // First compute how much mass is trapped at the dangling nodes.
  double dangleSum = 0.0;
  LongIterator iter = noOuts.iterator();
  while (iter.hasNext()) {
    dangleSum += prVector[(int) iter.nextLong()];
  }
  dangleSum = dampingFactor * dangleSum / nodeCount;

  // Distribute PageRank mass.
  iter = nodes.iterator();
  while (iter.hasNext()) {
    long v = iter.nextLong();
    int outDegree = graph.getOutDegree(v);
    if (outDegree > 0) {
      double outWeight = dampingFactor * prVector[(int) v] / outDegree;
      EdgeIterator edges = graph.getOutEdges(v);
      while (edges.hasNext()) {
        int nbr = (int) edges.nextLong();
        nextPR[nbr] += outWeight;
      }
    }

    nextPR[(int) v] += dampingAmount + dangleSum;
  }

  normL1 = computeL1Norm(prVector, nextPR);
  prVector = nextPR;
}
 
Example #19
Source File: OrConditionFixture.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
public PositionListIndex getConditionPLI() {
  List<LongArrayList> clusters = new ArrayList<>();

  long[] cluster1 = {2, 3, 7};
  clusters.add(new LongArrayList(cluster1));
  long[] cluster2 = {4, 5};
  clusters.add(new LongArrayList(cluster2));
  long[] cluster3 = {6, 9, 10};
  clusters.add(new LongArrayList(cluster3));

  return new PositionListIndex(clusters);
}
 
Example #20
Source File: MultiThreadedPageRankTest.java    From GraphJet with Apache License 2.0 5 votes vote down vote up
@Test
public void testFailsToCreateThrowsUnsupportedOperationException() {
  long[] longArray = new long[5];
  LongArrayList longArrayList = new LongArrayList(longArray);

  try {
    new MultiThreadedPageRank(null, longArrayList, 4294967295L, (-409L), 16, 535.0, (-561));
    fail("Expecting exception: UnsupportedOperationException");
  } catch (UnsupportedOperationException e) {
    assertEquals(MultiThreadedPageRank.class.getName(), e.getStackTrace()[0].getClassName());
  }
}
 
Example #21
Source File: TopSecondDegreeByCountForUserTest.java    From GraphJet with Apache License 2.0 5 votes vote down vote up
@Test
public void testTopSecondDegreeByCountForUsersWithSmallGraph4() throws Exception {
  // Test 4: Test only allowing social proof type 3
  LongList metadata = new LongArrayList(new long[]{0});
  HashMap<Byte, ConnectingUsersWithMetadata> socialProofFor5 = new HashMap<> ();
  socialProofFor5.put((byte) 3, new ConnectingUsersWithMetadata(new LongArrayList(new long[]{1}), metadata));

  Map<Byte, Integer> minUserPerSocialProof = new HashMap<>();
  List<UserRecommendationInfo> expectedTopResults = new ArrayList<>();

  byte[] socialProofTypes = new byte[] {0, 1, 2, 3};
  RecommendationStats expectedTopSecondDegreeByCountStats = new RecommendationStats(5, 6, 17, 2, 4, 0);

  int maxNumResults = 3;
  minUserPerSocialProof = new HashMap<>();
  socialProofTypes = new byte[] {3};

  expectedTopSecondDegreeByCountStats = new RecommendationStats(5, 1, 2, 2, 2, 0);

  expectedTopResults.clear();
  expectedTopResults.add(new UserRecommendationInfo(5, 1.5, socialProofFor5));
  testTopSecondDegreeByCountHelper(
    maxNumResults,
    minUserPerSocialProof,
    socialProofTypes,
    expectedTopResults,
    expectedTopSecondDegreeByCountStats);
}
 
Example #22
Source File: ConditionalPositionListIndexFixture.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
public PositionListIndex getUniquePLIForNotConditionEmptyTest() {
  List<LongArrayList> clusters = new ArrayList<>();
  long[] cluster1 = {1, 2};
  clusters.add(new LongArrayList(cluster1));

  return new PositionListIndex(clusters);
}
 
Example #23
Source File: ConditionalPositionListIndexFixture.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
public List<LongArrayList> getExpectedNotConditions() {
  List<LongArrayList> conditions = new ArrayList<>();
  long[] condition1 = {2, 3, 5, 6};
  conditions.add(new LongArrayList(condition1));

  return conditions;
}
 
Example #24
Source File: ConditionalPositionListIndexFixture.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
public PositionListIndex getConditionPLIForNotConditionTest() {
  List<LongArrayList> clusters = new ArrayList<>();
  long[] cluster1 = {2, 3, 5, 6};
  clusters.add(new LongArrayList(cluster1));

  return new PositionListIndex(clusters);
}
 
Example #25
Source File: TimerWheelTest.java    From caffeine with Apache License 2.0 5 votes vote down vote up
private LongArrayList getTimers(Node<?, ?> sentinel) {
  LongArrayList timers = new LongArrayList();
  for (Node<?, ?> node = sentinel.getNextInVariableOrder();
      node != sentinel; node = node.getNextInVariableOrder()) {
    timers.add(node.getVariableTime());
  }
  return timers;
}
 
Example #26
Source File: ConditionalPositionListIndexFixture.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
public List<LongArrayList> getExpectedConditions() {
  List<LongArrayList> conditions = new ArrayList<>();
  long[] condition1 = {2, 3, 7};
  long[] condition2 = {6, 9, 10};
  conditions.add(new LongArrayList(condition1));
  conditions.add(new LongArrayList(condition2));

  return conditions;
}
 
Example #27
Source File: JoinFilterFunctionCompiler.java    From presto with Apache License 2.0 5 votes vote down vote up
@Override
public JoinFilterFunction create(ConnectorSession session, LongArrayList addresses, List<Page> pages)
{
    try {
        InternalJoinFilterFunction internalJoinFilterFunction = internalJoinFilterFunctionConstructor.newInstance(session);
        return isolatedJoinFilterFunctionConstructor.newInstance(internalJoinFilterFunction, addresses, pages);
    }
    catch (ReflectiveOperationException e) {
        throw new RuntimeException(e);
    }
}
 
Example #28
Source File: DetachedTxSystemClient.java    From phoenix-tephra with Apache License 2.0 5 votes vote down vote up
@Override
public Transaction checkpoint(Transaction tx) {
  long newWritePointer = getWritePointer();
  LongArrayList newCheckpointPointers = new LongArrayList(tx.getCheckpointWritePointers());
  newCheckpointPointers.add(newWritePointer);
  return new Transaction(tx, newWritePointer, newCheckpointPointers.toLongArray());
}
 
Example #29
Source File: DateTimeColumn.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
@Override
public DateTimeColumn unique() {
  LongSet ints = new LongOpenHashSet(data.size());
  for (long i : data) {
    ints.add(i);
  }
  DateTimeColumn column = emptyCopy(ints.size());
  column.setName(name() + " Unique values");
  column.data = LongArrayList.wrap(ints.toLongArray());
  return column;
}
 
Example #30
Source File: ValueInTransformFunction.java    From incubator-pinot with Apache License 2.0 5 votes vote down vote up
private static long[] filterLongs(LongSet longSet, long[] source) {
  LongList longList = new LongArrayList();
  for (long value : source) {
    if (longSet.contains(value)) {
      longList.add(value);
    }
  }
  if (longList.size() == source.length) {
    return source;
  } else {
    return longList.toLongArray();
  }
}