@Generates private static <K, V> ImmutableMultimap<K, V> generateImmutableMultimap(K key, V value) { return ImmutableMultimap.of(key, value); }
@Override protected Optional<DecorrelationResult> visitPlan(PlanNode node, Void context) { return Optional.of(new DecorrelationResult( node, ImmutableSet.of(), ImmutableList.of(), ImmutableMultimap.of(), false)); }
public JoinGraph( List<PlanNode> nodes, Multimap<PlanNodeId, Edge> edges, PlanNodeId rootId, List<Expression> filters, Optional<Map<Symbol, Expression>> assignments) { this.nodes = nodes; this.edges = edges; this.rootId = rootId; this.filters = filters; this.assignments = assignments; }
public void testEquals() { new EqualsTester() .addEqualityGroup(ImmutableMultimap.of(), ImmutableMultimap.of()) .addEqualityGroup(ImmutableMultimap.of(1, "a"), ImmutableMultimap.of(1, "a")) .addEqualityGroup( ImmutableMultimap.of(1, "a", 2, "b"), ImmutableMultimap.of(2, "b", 1, "a")) .testEquals(); } }
public synchronized Optional<RemoteTask> scheduleTask(Node node, int partition, OptionalInt totalPartitions) { requireNonNull(node, "node is null"); if (stateMachine.getState().isDone()) { return Optional.empty(); } checkState(!splitsScheduled.get(), "scheduleTask can not be called once splits have been scheduled"); return Optional.of(scheduleTask(node, new TaskId(stateMachine.getStageId(), partition), ImmutableMultimap.of(), totalPartitions)); }
@Override protected Map<String, Collection<Integer>> makeEmptyMap() { return ImmutableMultimap.<String, Integer>of().asMap(); }
private static PrincipalPrivileges buildInitialPrivilegeSet(String tableOwner) { return new PrincipalPrivileges( ImmutableMultimap.<String, HivePrivilegeInfo>builder() .put(tableOwner, new HivePrivilegeInfo(HivePrivilege.SELECT, true)) .put(tableOwner, new HivePrivilegeInfo(HivePrivilege.INSERT, true)) .put(tableOwner, new HivePrivilegeInfo(HivePrivilege.UPDATE, true)) .put(tableOwner, new HivePrivilegeInfo(HivePrivilege.DELETE, true)) .build(), ImmutableMultimap.of()); }
@Test public void testTableRoundTrip() { Table table = ThriftMetastoreUtil.fromMetastoreApiTable(TEST_TABLE, TEST_SCHEMA); PrincipalPrivileges privileges = new PrincipalPrivileges(ImmutableMultimap.of(), ImmutableMultimap.of()); org.apache.hadoop.hive.metastore.api.Table metastoreApiTable = ThriftMetastoreUtil.toMetastoreApiTable(table, privileges); assertEquals(metastoreApiTable, TEST_TABLE); }
public void testUnhashableSingletonValue() { SampleElements<UnhashableObject> unhashables = new Unhashables(); Multimap<Integer, UnhashableObject> multimap = ImmutableMultimap.of(0, unhashables.e0()); assertEquals(1, multimap.get(0).size()); assertTrue(multimap.get(0).contains(unhashables.e0())); }
public void testInvertFrom() { ImmutableMultimap<Integer, String> empty = ImmutableMultimap.of(); // typical usage example - sad that ArrayListMultimap.create() won't work Multimap<String, Integer> multimap = Multimaps.invertFrom(empty, ArrayListMultimap.<String, Integer>create()); assertTrue(multimap.isEmpty()); ImmutableMultimap<Integer, String> single = new ImmutableMultimap.Builder<Integer, String>().put(1, "one").put(2, "two").build(); // copy into existing multimap assertSame(multimap, Multimaps.invertFrom(single, multimap)); ImmutableMultimap<String, Integer> expected = new ImmutableMultimap.Builder<String, Integer>().put("one", 1).put("two", 2).build(); assertEquals(expected, multimap); }
public void testUnhashableMixedValues() { SampleElements<UnhashableObject> unhashables = new Unhashables(); Multimap<Integer, Object> multimap = ImmutableMultimap.<Integer, Object>of( 0, unhashables.e0(), 2, "hey you", 0, unhashables.e1()); assertEquals(2, multimap.get(0).size()); assertTrue(multimap.get(0).contains(unhashables.e0())); assertTrue(multimap.get(0).contains(unhashables.e1())); assertTrue(multimap.get(2).contains("hey you")); }
final void check() { runTester() .assertNonNullValues( Gender.MALE, Integer.valueOf(0), 0, "", "", ImmutableList.of(), ImmutableList.of(), ImmutableMap.of(), ImmutableMap.of(), ImmutableSet.of(), ImmutableSet.of(), ImmutableSortedSet.of(), ImmutableSortedSet.of(), ImmutableMultiset.of(), ImmutableMultiset.of(), ImmutableMultimap.of(), ImmutableMultimap.of(), ImmutableTable.of(), ImmutableTable.of()); } }
private PrincipalPrivileges testingPrincipalPrivilege(String tableOwner) { return new PrincipalPrivileges( ImmutableMultimap.<String, HivePrivilegeInfo>builder() .put(tableOwner, new HivePrivilegeInfo(HivePrivilege.SELECT, true)) .put(tableOwner, new HivePrivilegeInfo(HivePrivilege.INSERT, true)) .put(tableOwner, new HivePrivilegeInfo(HivePrivilege.UPDATE, true)) .put(tableOwner, new HivePrivilegeInfo(HivePrivilege.DELETE, true)) .build(), ImmutableMultimap.of()); }
public void testEquals() { SortedSetMultimap<Integer, String> map1 = TreeMultimap.create(ImmutableMultimap.of(1, "one")); SortedSetMultimap<Integer, String> map2 = TreeMultimap.create(ImmutableMultimap.of(2, "two")); new EqualsTester() .addEqualityGroup(map1, wrap(map1), wrap(map1)) .addEqualityGroup(map2, wrap(map2)) .testEquals(); }
public void updateTableLocation(String databaseName, String tableName, String location) { Optional<Table> table = getTable(databaseName, tableName); if (!table.isPresent()) { throw new TableNotFoundException(new SchemaTableName(databaseName, tableName)); } Table.Builder tableBuilder = Table.builder(table.get()); tableBuilder.getStorageBuilder().setLocation(location); // NOTE: this clears the permissions replaceTable(databaseName, tableName, tableBuilder.build(), new PrincipalPrivileges(ImmutableMultimap.of(), ImmutableMultimap.of())); }
@SuppressWarnings("deprecation") public void testUnmodifiableMultimapShortCircuit() { Multimap<String, Integer> mod = HashMultimap.create(); Multimap<String, Integer> unmod = Multimaps.unmodifiableMultimap(mod); assertNotSame(mod, unmod); assertSame(unmod, Multimaps.unmodifiableMultimap(unmod)); ImmutableMultimap<String, Integer> immutable = ImmutableMultimap.of("a", 1, "b", 2, "a", 3); assertSame(immutable, Multimaps.unmodifiableMultimap(immutable)); assertSame(immutable, Multimaps.unmodifiableMultimap((Multimap<String, Integer>) immutable)); }
private RemoteTask createRemoteTask(HttpRemoteTaskFactory httpRemoteTaskFactory) { return httpRemoteTaskFactory.createRemoteTask( TEST_SESSION, new TaskId("test", 1, 2), new PrestoNode("node-id", URI.create("http://fake.invalid/"), new NodeVersion("version"), false), TaskTestUtils.PLAN_FRAGMENT, ImmutableMultimap.of(), OptionalInt.empty(), createInitialEmptyOutputBuffers(OutputBuffers.BufferType.BROADCAST), new NodeTaskMap.PartitionedSplitCountTracker(i -> {}), true); }
@GwtIncompatible // SerializableTester public void testTreeMultimapNonGeneric() { TreeMultimap<LegacyComparable, LegacyComparable> multimap = TreeMultimap.create(); assertEquals(ImmutableMultimap.of(), multimap); multimap.put(new LegacyComparable("foo"), new LegacyComparable("f")); multimap.put(new LegacyComparable("foo"), new LegacyComparable("o")); multimap.put(new LegacyComparable("foo"), new LegacyComparable("o")); multimap.put(new LegacyComparable("bar"), new LegacyComparable("b")); multimap.put(new LegacyComparable("bar"), new LegacyComparable("a")); multimap.put(new LegacyComparable("bar"), new LegacyComparable("r")); assertThat(multimap.keySet()) .containsExactly(new LegacyComparable("bar"), new LegacyComparable("foo")) .inOrder(); assertThat(multimap.values()) .containsExactly( new LegacyComparable("a"), new LegacyComparable("b"), new LegacyComparable("r"), new LegacyComparable("f"), new LegacyComparable("o")) .inOrder(); assertEquals(Ordering.natural(), multimap.keyComparator()); assertEquals(Ordering.natural(), multimap.valueComparator()); SerializableTester.reserializeAndAssert(multimap); }
@GwtIncompatible // SerializableTester public void testTreeMultimapDerived() { TreeMultimap<DerivedComparable, DerivedComparable> multimap = TreeMultimap.create(); assertEquals(ImmutableMultimap.of(), multimap); multimap.put(new DerivedComparable("foo"), new DerivedComparable("f")); multimap.put(new DerivedComparable("foo"), new DerivedComparable("o")); multimap.put(new DerivedComparable("foo"), new DerivedComparable("o")); multimap.put(new DerivedComparable("bar"), new DerivedComparable("b")); multimap.put(new DerivedComparable("bar"), new DerivedComparable("a")); multimap.put(new DerivedComparable("bar"), new DerivedComparable("r")); assertThat(multimap.keySet()) .containsExactly(new DerivedComparable("bar"), new DerivedComparable("foo")) .inOrder(); assertThat(multimap.values()) .containsExactly( new DerivedComparable("a"), new DerivedComparable("b"), new DerivedComparable("r"), new DerivedComparable("f"), new DerivedComparable("o")) .inOrder(); assertEquals(Ordering.natural(), multimap.keyComparator()); assertEquals(Ordering.natural(), multimap.valueComparator()); SerializableTester.reserializeAndAssert(multimap); }