예제 #1
0
 public void testCopyOfEmptyMap() {
   ImmutableBiMap<String, Integer> copy =
       ImmutableBiMap.copyOf(Collections.<String, Integer>emptyMap());
   assertEquals(Collections.<String, Integer>emptyMap(), copy);
   assertSame(copy, ImmutableBiMap.copyOf(copy));
   assertSame(ImmutableBiMap.of(), copy);
 }
예제 #2
0
    public void testCopyOf() {
      Map<String, Integer> original = new LinkedHashMap<String, Integer>();
      original.put("one", 1);
      original.put("two", 2);
      original.put("three", 3);

      ImmutableBiMap<String, Integer> copy = ImmutableBiMap.copyOf(original);
      assertMapEquals(copy, "one", 1, "two", 2, "three", 3);
      assertSame(copy, ImmutableBiMap.copyOf(copy));
    }
예제 #3
0
 public void testValues() {
   ImmutableBiMap<String, Integer> bimap =
       ImmutableBiMap.copyOf(ImmutableMap.of("one", 1, "two", 2, "three", 3, "four", 4));
   Set<Integer> values = bimap.values();
   assertEquals(Sets.newHashSet(1, 2, 3, 4), values);
   ASSERT.that(values).hasContentsInOrder(1, 2, 3, 4);
 }
예제 #4
0
 public void testValues() {
   ImmutableBiMap<String, Integer> bimap =
       ImmutableBiMap.copyOf(ImmutableMap.of("one", 1, "two", 2, "three", 3, "four", 4));
   Set<Integer> values = bimap.values();
   assertEquals(Sets.newHashSet(1, 2, 3, 4), values);
   assertThat(values).containsExactly(1, 2, 3, 4).inOrder();
 }
예제 #5
0
 public void testKeySet() {
   ImmutableBiMap<String, Integer> bimap =
       ImmutableBiMap.copyOf(ImmutableMap.of("one", 1, "two", 2, "three", 3, "four", 4));
   Set<String> keys = bimap.keySet();
   assertEquals(Sets.newHashSet("one", "two", "three", "four"), keys);
   ASSERT.that(keys).hasContentsInOrder("one", "two", "three", "four");
 }
예제 #6
0
 public void testKeySet() {
   ImmutableBiMap<String, Integer> bimap =
       ImmutableBiMap.copyOf(ImmutableMap.of("one", 1, "two", 2, "three", 3, "four", 4));
   Set<String> keys = bimap.keySet();
   assertEquals(Sets.newHashSet("one", "two", "three", "four"), keys);
   assertThat(keys).containsExactly("one", "two", "three", "four").inOrder();
 }
  @Override
  public Expression visitTableScan(TableScanNode node, Void context) {
    if (!node.getGeneratedPartitions().isPresent()) {
      return BooleanLiteral.TRUE_LITERAL;
    }

    // The effective predicate can be computed from the intersection of the aggregate partition
    // TupleDomain summary (generated from Partitions)
    // and the TupleDomain that was initially used to generate those Partitions. We do this because
    // we need to select the more restrictive of the two.
    // Note: the TupleDomain used to generate the partitions may contain columns/predicates that are
    // unknown to the partition TupleDomain summary,
    // but those are guaranteed to be part of a FilterNode directly above this table scan, so it's
    // ok to include.
    TupleDomain tupleDomain =
        node.getPartitionsDomainSummary()
            .intersect(node.getGeneratedPartitions().get().getTupleDomainInput());

    // A TupleDomain that has too many disjunctions will produce an Expression that will be very
    // expensive to evaluate at runtime.
    // For the time being, we will just summarize the TupleDomain by the span over each of its
    // columns (which is ok since we only need to generate
    // an effective predicate here).
    // In the future, we can do further optimizations here that will simplify the TupleDomain, but
    // still improve the specificity compared to just a simple span (e.g. range clustering).
    tupleDomain = spanTupleDomain(tupleDomain);

    Expression partitionPredicate =
        DomainTranslator.toPredicate(
            tupleDomain, ImmutableBiMap.copyOf(node.getAssignments()).inverse());
    return pullExpressionThroughSymbols(partitionPredicate, node.getOutputSymbols());
  }
예제 #8
0
 public void testFromHashMap() {
   Map<String, Integer> hashMap = Maps.newLinkedHashMap();
   hashMap.put("one", 1);
   hashMap.put("two", 2);
   ImmutableBiMap<String, Integer> bimap =
       ImmutableBiMap.copyOf(ImmutableMap.of("one", 1, "two", 2));
   assertMapEquals(bimap, "one", 1, "two", 2);
   assertMapEquals(bimap.inverse(), 1, "one", 2, "two");
 }
예제 #9
0
 public void testForcePut() {
   ImmutableBiMap<String, Integer> bimap =
       ImmutableBiMap.copyOf(ImmutableMap.of("one", 1, "two", 2));
   try {
     bimap.forcePut("three", 3);
     fail();
   } catch (UnsupportedOperationException expected) {
   }
 }
예제 #10
0
 @GwtIncompatible // SerializableTester
 public void testInverseSerialization() {
   ImmutableBiMap<String, Integer> bimap =
       ImmutableBiMap.copyOf(ImmutableMap.of(1, "one", 2, "two")).inverse();
   ImmutableBiMap<String, Integer> copy = SerializableTester.reserializeAndAssert(bimap);
   assertEquals(Integer.valueOf(1), copy.get("one"));
   assertEquals("one", copy.inverse().get(1));
   assertSame(copy, copy.inverse().inverse());
 }
예제 #11
0
 public BiMap<ModContainer, Object> getModObjectList() {
   if (modObjectList == null) {
     FMLLog.severe(
         "Detected an attempt by a mod %s to perform game activity during mod construction. This is a serious programming error.",
         activeContainer);
     return buildModObjectList();
   }
   return ImmutableBiMap.copyOf(modObjectList);
 }
예제 #12
0
 public void testFromImmutableMap() {
   ImmutableBiMap<String, Integer> bimap =
       ImmutableBiMap.copyOf(
           new ImmutableMap.Builder<String, Integer>()
               .put("one", 1)
               .put("two", 2)
               .put("three", 3)
               .put("four", 4)
               .put("five", 5)
               .build());
   assertMapEquals(bimap, "one", 1, "two", 2, "three", 3, "four", 4, "five", 5);
   assertMapEquals(bimap.inverse(), 1, "one", 2, "two", 3, "three", 4, "four", 5, "five");
 }
예제 #13
0
    @Override
    public ActualProperties visitTableScan(
        TableScanNode node, List<ActualProperties> inputProperties) {
      checkArgument(node.getLayout().isPresent(), "table layout has not yet been chosen");

      TableLayout layout = metadata.getLayout(session, node.getLayout().get());
      Map<ColumnHandle, Symbol> assignments =
          ImmutableBiMap.copyOf(node.getAssignments()).inverse();

      ActualProperties.Builder properties = ActualProperties.builder();

      // Globally constant assignments
      Map<ColumnHandle, NullableValue> globalConstants = new HashMap<>();
      extractFixedValues(node.getCurrentConstraint())
          .orElse(ImmutableMap.of())
          .entrySet()
          .stream()
          .filter(entry -> !entry.getValue().isNull())
          .forEach(entry -> globalConstants.put(entry.getKey(), entry.getValue()));

      Map<Symbol, NullableValue> symbolConstants =
          globalConstants
              .entrySet()
              .stream()
              .filter(entry -> assignments.containsKey(entry.getKey()))
              .collect(toMap(entry -> assignments.get(entry.getKey()), Map.Entry::getValue));
      properties.constants(symbolConstants);

      // Partitioning properties
      properties.global(deriveGlobalProperties(layout, assignments, globalConstants));

      // Append the global constants onto the local properties to maximize their translation
      // potential
      List<LocalProperty<ColumnHandle>> constantAppendedLocalProperties =
          ImmutableList.<LocalProperty<ColumnHandle>>builder()
              .addAll(
                  globalConstants
                      .keySet()
                      .stream()
                      .map(column -> new ConstantProperty<>(column))
                      .iterator())
              .addAll(layout.getLocalProperties())
              .build();
      properties.local(
          LocalProperties.translate(
              constantAppendedLocalProperties,
              column -> Optional.ofNullable(assignments.get(column))));

      return properties.build();
    }
예제 #14
0
  public RuleNames(Grammar grammar, boolean installAdapter) {
    this.contextGrammar = grammar;
    Adapter adapter = new Adapter(this);
    if (installAdapter) {
      installAdapterIfMissing(adapter, grammar);
    }
    List<AbstractRule> allRules = GrammarUtil.allRules(grammar);
    ImmutableListMultimap.Builder<String, AbstractRule> simpleNameToRulesBuilder =
        ImmutableListMultimap.builder();
    ImmutableMap.Builder<String, AbstractRule> qualifiedNameToRuleBuilder = ImmutableMap.builder();
    ImmutableBiMap.Builder<String, AbstractRule> uniqueNameToRuleBuilder = ImmutableBiMap.builder();
    ImmutableBiMap.Builder<String, AbstractRule> antlrNameToRuleBuilder = ImmutableBiMap.builder();

    Map<String, AbstractRule> names = Maps.newHashMap();
    Set<String> usedAntlrNames = Sets.newHashSet();
    Set<String> usedUniqueNames = Sets.newHashSet();
    for (AbstractRule rule : allRules) {
      String name = rule.getName();
      simpleNameToRulesBuilder.put(name, rule);
      String qualifiedName = getQualifiedName(rule);
      qualifiedNameToRuleBuilder.put(qualifiedName, rule);
      String uniqueName = name;
      String antlrRuleName;
      if (names.containsKey(name)) {
        name = qualifiedName;
        uniqueName = getInheritedUniqueName(rule, usedUniqueNames);
        antlrRuleName = getInheritedAntlrRuleName(rule, usedAntlrNames);
      } else {
        antlrRuleName = getDefaultAntlrRuleName(rule);
      }
      names.put(name, rule);
      if (!usedUniqueNames.add(uniqueName)) {
        throw new IllegalStateException(uniqueName);
      }
      uniqueNameToRuleBuilder.put(uniqueName, rule);
      if (!usedAntlrNames.add(antlrRuleName)) {
        throw new IllegalStateException(antlrRuleName);
      }
      antlrNameToRuleBuilder.put(antlrRuleName, rule);
      if (installAdapter) {
        installAdapterIfMissing(adapter, rule);
      }
    }
    simpleNameToRules = simpleNameToRulesBuilder.build();
    qualifiedNameToRule = qualifiedNameToRuleBuilder.build();
    nameToRule = ImmutableBiMap.copyOf(names);
    uniqueNameToRule = uniqueNameToRuleBuilder.build();
    antlrNameToRule = antlrNameToRuleBuilder.build();
    this.allRules = ImmutableList.copyOf(allRules);
  }
예제 #15
0
    public void testDuplicateValues() {
      ImmutableMap<String, Integer> map =
          new ImmutableMap.Builder<String, Integer>()
              .put("one", 1)
              .put("two", 2)
              .put("uno", 1)
              .put("dos", 2)
              .build();

      try {
        ImmutableBiMap.copyOf(map);
        fail();
      } catch (IllegalArgumentException expected) {
        assertThat(expected.getMessage()).contains("1");
      }
    }
예제 #16
0
    private PlanNode planTableScan(TableScanNode node, Expression predicate) {
      DomainTranslator.ExtractionResult decomposedPredicate =
          DomainTranslator.fromPredicate(metadata, session, predicate, symbolAllocator.getTypes());

      TupleDomain<ColumnHandle> simplifiedConstraint =
          decomposedPredicate
              .getTupleDomain()
              .transform(node.getAssignments()::get)
              .intersect(node.getCurrentConstraint());

      List<TableLayoutResult> layouts =
          metadata.getLayouts(
              session,
              node.getTable(),
              new Constraint<>(simplifiedConstraint, bindings -> true),
              Optional.of(ImmutableSet.copyOf(node.getAssignments().values())));

      if (layouts.isEmpty()) {
        return new ValuesNode(idAllocator.getNextId(), node.getOutputSymbols(), ImmutableList.of());
      }

      TableLayoutResult layout = layouts.get(0);

      TableScanNode result =
          new TableScanNode(
              node.getId(),
              node.getTable(),
              node.getOutputSymbols(),
              node.getAssignments(),
              Optional.of(layout.getLayout().getHandle()),
              simplifiedConstraint.intersect(layout.getLayout().getPredicate()),
              Optional.ofNullable(node.getOriginalConstraint()).orElse(predicate));

      Map<ColumnHandle, Symbol> assignments =
          ImmutableBiMap.copyOf(node.getAssignments()).inverse();
      Expression resultingPredicate =
          combineConjuncts(
              decomposedPredicate.getRemainingExpression(),
              DomainTranslator.toPredicate(
                  layout.getUnenforcedConstraint().transform(assignments::get)));

      if (!BooleanLiteral.TRUE_LITERAL.equals(resultingPredicate)) {
        return new FilterNode(idAllocator.getNextId(), result, resultingPredicate);
      }

      return result;
    }
예제 #17
0
  /**
   * Get the JCR property name for an RDF predicate
   *
   * @param namespaceRegistry
   * @param predicate
   * @param namespaceMapping
   * @return
   * @throws RepositoryException
   */
  public String getPropertyNameFromPredicate(
      final NamespaceRegistry namespaceRegistry,
      final com.hp.hpl.jena.rdf.model.Property predicate,
      final Map<String, String> namespaceMapping)
      throws RepositoryException {

    final String prefix;

    final String namespace = getJcrNamespaceForRDFNamespace(predicate.getNameSpace());

    assert (namespaceRegistry != null);

    if (namespaceRegistry.isRegisteredUri(namespace)) {
      LOGGER.debug("Discovered namespace: {} in namespace registry.", namespace);
      prefix = namespaceRegistry.getPrefix(namespace);
    } else {
      LOGGER.debug("Didn't discover namespace: {} in namespace registry.", namespace);
      final ImmutableBiMap<String, String> nsMap = ImmutableBiMap.copyOf(namespaceMapping);
      if (nsMap.containsValue(namespace)) {
        LOGGER.debug("Discovered namespace: {} in namespace map: {}.", namespace, nsMap);
        prefix = nsMap.inverse().get(namespace);
        namespaceRegistry.registerNamespace(prefix, namespace);
      } else {
        prefix = namespaceRegistry.registerNamespace(namespace);
      }
    }

    final String localName = predicate.getLocalName();

    final String propertyName = prefix + ":" + localName;

    LOGGER.debug(
        "Took RDF predicate {} and translated it to JCR property {}", predicate, propertyName);

    return propertyName;
  }
예제 #18
0
 public void testCopyOfSingletonMap() {
   ImmutableBiMap<String, Integer> copy =
       ImmutableBiMap.copyOf(Collections.singletonMap("one", 1));
   assertMapEquals(copy, "one", 1);
   assertSame(copy, ImmutableBiMap.copyOf(copy));
 }
예제 #19
0
    @Override
    public PlanNode rewriteTableScan(
        TableScanNode node, Expression inheritedPredicate, PlanRewriter<Expression> planRewriter) {
      DomainTranslator.ExtractionResult extractionResult =
          DomainTranslator.fromPredicate(
              inheritedPredicate, symbolAllocator.getTypes(), node.getAssignments());
      Expression extractionRemainingExpression = extractionResult.getRemainingExpression();
      TupleDomain tupleDomain = extractionResult.getTupleDomain();

      if (node.getGeneratedPartitions().isPresent()) {
        // Add back in the TupleDomain that was used to generate the previous set of Partitions if
        // present
        // And just for kicks, throw in the domain summary too (as that can only help prune down the
        // ranges)
        // The domains should never widen between each pass.
        tupleDomain =
            tupleDomain
                .intersect(node.getGeneratedPartitions().get().getTupleDomainInput())
                .intersect(node.getPartitionsDomainSummary());
      }

      PartitionResult matchingPartitions =
          splitManager.getPartitions(node.getTable(), Optional.of(tupleDomain));
      List<Partition> partitions = matchingPartitions.getPartitions();
      TupleDomain undeterminedTupleDomain = matchingPartitions.getUndeterminedTupleDomain();

      Expression unevaluatedDomainPredicate =
          DomainTranslator.toPredicate(
              undeterminedTupleDomain, ImmutableBiMap.copyOf(node.getAssignments()).inverse());

      // Construct the post scan predicate. Add the unevaluated TupleDomain back first since those
      // are generally cheaper to evaluate than anything we can't extract
      Expression postScanPredicate =
          combineConjuncts(unevaluatedDomainPredicate, extractionRemainingExpression);

      // Do some early partition pruning
      partitions =
          ImmutableList.copyOf(
              filter(
                  partitions, not(shouldPrunePartition(postScanPredicate, node.getAssignments()))));
      GeneratedPartitions generatedPartitions = new GeneratedPartitions(tupleDomain, partitions);

      PlanNode output = node;
      if (!node.getGeneratedPartitions().equals(Optional.of(generatedPartitions))) {
        // Only overwrite the originalConstraint if it was previously null
        Expression originalConstraint =
            node.getOriginalConstraint() == null
                ? inheritedPredicate
                : node.getOriginalConstraint();
        output =
            new TableScanNode(
                node.getId(),
                node.getTable(),
                node.getOutputSymbols(),
                node.getAssignments(),
                originalConstraint,
                Optional.of(generatedPartitions));
      }
      if (!postScanPredicate.equals(BooleanLiteral.TRUE_LITERAL)) {
        output = new FilterNode(idAllocator.getNextId(), output, postScanPredicate);
      }
      return output;
    }
예제 #20
0
 Channel(ChannelBuilder builder) {
   this.name = builder.name;
   this.specs = ImmutableBiMap.copyOf(builder.specs);
   this.specIDs = ImmutableBiMap.copyOf(builder.specIDs);
 }
예제 #21
0
    private PlanNode planTableScan(TableScanNode node, Expression predicate, Context context) {
      DomainTranslator.ExtractionResult decomposedPredicate =
          DomainTranslator.fromPredicate(metadata, session, predicate, symbolAllocator.getTypes());

      TupleDomain<ColumnHandle> simplifiedConstraint =
          decomposedPredicate
              .getTupleDomain()
              .transform(node.getAssignments()::get)
              .intersect(node.getCurrentConstraint());

      checkState(node.getOutputSymbols().containsAll(context.getLookupSymbols()));

      Set<ColumnHandle> lookupColumns =
          context
              .getLookupSymbols()
              .stream()
              .map(node.getAssignments()::get)
              .collect(toImmutableSet());

      Set<ColumnHandle> outputColumns =
          node.getOutputSymbols()
              .stream()
              .map(node.getAssignments()::get)
              .collect(toImmutableSet());

      Optional<ResolvedIndex> optionalResolvedIndex =
          metadata.resolveIndex(
              session, node.getTable(), lookupColumns, outputColumns, simplifiedConstraint);
      if (!optionalResolvedIndex.isPresent()) {
        // No index available, so give up by returning something
        return node;
      }
      ResolvedIndex resolvedIndex = optionalResolvedIndex.get();

      Map<ColumnHandle, Symbol> inverseAssignments =
          ImmutableBiMap.copyOf(node.getAssignments()).inverse();

      PlanNode source =
          new IndexSourceNode(
              idAllocator.getNextId(),
              resolvedIndex.getIndexHandle(),
              node.getTable(),
              node.getLayout(),
              context.getLookupSymbols(),
              node.getOutputSymbols(),
              node.getAssignments(),
              simplifiedConstraint);

      Expression resultingPredicate =
          combineConjuncts(
              DomainTranslator.toPredicate(
                  resolvedIndex.getUnresolvedTupleDomain().transform(inverseAssignments::get)),
              decomposedPredicate.getRemainingExpression());

      if (!resultingPredicate.equals(TRUE_LITERAL)) {
        // todo it is likely we end up with redundant filters here because the predicate push down
        // has already been run... the fix is to run predicate push down again
        source = new FilterNode(idAllocator.getNextId(), source, resultingPredicate);
      }
      context.markSuccess();
      return source;
    }
예제 #22
0
 static <N, E> DirectedNetworkConnections<N, E> ofImmutable(
     Map<E, N> inEdges, Map<E, N> outEdges, int selfLoopCount) {
   return new DirectedNetworkConnections<N, E>(
       ImmutableBiMap.copyOf(inEdges), ImmutableBiMap.copyOf(outEdges), selfLoopCount);
 }
 /**
  * Map of portlet property names to attribute names, if the value is null the key will be used for
  * both the property and attribute name
  */
 @Resource(name = "portletPropertyToAttributeMappings")
 public void setPropertyMappings(Map<String, String> propertyMappings) {
   this.propertyToAttributeMappings = ImmutableBiMap.copyOf(propertyMappings);
   this.attributeToPropertyMappings = this.propertyToAttributeMappings.inverse();
 }
예제 #24
0
 public void testDoubleInverse() {
   ImmutableBiMap<String, Integer> bimap =
       ImmutableBiMap.copyOf(ImmutableMap.of("one", 1, "two", 2));
   assertSame(bimap, bimap.inverse().inverse());
 }
  private InternalTable buildPartitions(
      Session session, String catalogName, Map<String, SerializableNativeValue> filters) {
    QualifiedTableName tableName = extractQualifiedTableName(catalogName, filters);

    InternalTable.Builder table =
        InternalTable.builder(informationSchemaTableColumns(TABLE_INTERNAL_PARTITIONS));

    Optional<TableHandle> tableHandle = metadata.getTableHandle(session, tableName);
    checkArgument(tableHandle.isPresent(), "Table %s does not exist", tableName);
    Map<ColumnHandle, String> columnHandles =
        ImmutableBiMap.copyOf(metadata.getColumnHandles(session, tableHandle.get())).inverse();

    List<TableLayoutResult> layouts =
        metadata.getLayouts(
            session, tableHandle.get(), Constraint.<ColumnHandle>alwaysTrue(), Optional.empty());

    if (layouts.size() == 1) {
      TableLayout layout = Iterables.getOnlyElement(layouts).getLayout();

      layout
          .getDiscretePredicates()
          .ifPresent(
              domains -> {
                int partitionNumber = 1;
                for (TupleDomain<ColumnHandle> domain : domains) {
                  for (Entry<ColumnHandle, SerializableNativeValue> entry :
                      domain.extractNullableFixedValues().entrySet()) {
                    ColumnHandle columnHandle = entry.getKey();
                    String columnName = columnHandles.get(columnHandle);
                    String value = null;
                    if (entry.getValue().getValue() != null) {
                      ColumnMetadata columnMetadata =
                          metadata.getColumnMetadata(session, tableHandle.get(), columnHandle);
                      try {
                        FunctionInfo operator =
                            metadata
                                .getFunctionRegistry()
                                .getCoercion(columnMetadata.getType(), VARCHAR);
                        value =
                            ((Slice)
                                    operator
                                        .getMethodHandle()
                                        .invokeWithArguments(entry.getValue().getValue()))
                                .toStringUtf8();
                      } catch (OperatorNotFoundException e) {
                        value = "<UNREPRESENTABLE VALUE>";
                      } catch (Throwable throwable) {
                        throw Throwables.propagate(throwable);
                      }
                    }
                    table.add(
                        catalogName,
                        tableName.getSchemaName(),
                        tableName.getTableName(),
                        partitionNumber,
                        columnName,
                        value);
                  }
                  partitionNumber++;
                }
              });
    }
    return table.build();
  }
  private InternalTable buildPartitions(
      Session session, String catalogName, Map<String, NullableValue> filters) {
    QualifiedObjectName tableName = extractQualifiedTableName(catalogName, filters);

    InternalTable.Builder table =
        InternalTable.builder(informationSchemaTableColumns(TABLE_INTERNAL_PARTITIONS));

    Optional<TableHandle> tableHandle = metadata.getTableHandle(session, tableName);
    if (!tableHandle.isPresent()) {
      throw new TableNotFoundException(tableName.asSchemaTableName());
    }

    List<TableLayoutResult> layouts =
        metadata.getLayouts(
            session, tableHandle.get(), Constraint.<ColumnHandle>alwaysTrue(), Optional.empty());

    if (layouts.size() == 1) {
      Map<ColumnHandle, String> columnHandles =
          ImmutableBiMap.copyOf(metadata.getColumnHandles(session, tableHandle.get())).inverse();
      Map<ColumnHandle, MethodHandle> methodHandles = new HashMap<>();
      for (ColumnHandle columnHandle : columnHandles.keySet()) {
        try {
          ColumnMetadata columnMetadata =
              metadata.getColumnMetadata(session, tableHandle.get(), columnHandle);
          Signature operator =
              metadata.getFunctionRegistry().getCoercion(columnMetadata.getType(), VARCHAR);
          MethodHandle methodHandle =
              metadata
                  .getFunctionRegistry()
                  .getScalarFunctionImplementation(operator)
                  .getMethodHandle();
          methodHandles.put(columnHandle, methodHandle);
        } catch (OperatorNotFoundException exception) {
          // Do not put the columnHandle in the map.
        }
      }

      TableLayout layout = Iterables.getOnlyElement(layouts).getLayout();
      layout
          .getDiscretePredicates()
          .ifPresent(
              domains -> {
                int partitionNumber = 1;
                for (TupleDomain<ColumnHandle> domain : domains) {
                  for (Entry<ColumnHandle, NullableValue> entry :
                      TupleDomain.extractFixedValues(domain).get().entrySet()) {
                    ColumnHandle columnHandle = entry.getKey();
                    String columnName = columnHandles.get(columnHandle);
                    String value = null;
                    if (entry.getValue().getValue() != null) {
                      if (methodHandles.containsKey(columnHandle)) {
                        try {
                          value =
                              ((Slice)
                                      methodHandles
                                          .get(columnHandle)
                                          .invokeWithArguments(entry.getValue().getValue()))
                                  .toStringUtf8();
                        } catch (Throwable throwable) {
                          throw Throwables.propagate(throwable);
                        }
                      } else {
                        // OperatorNotFoundException was thrown for this columnHandle
                        value = "<UNREPRESENTABLE VALUE>";
                      }
                    }
                    table.add(
                        catalogName,
                        tableName.getSchemaName(),
                        tableName.getObjectName(),
                        partitionNumber,
                        columnName,
                        value);
                  }
                  partitionNumber++;
                }
              });
    }
    return table.build();
  }
 public void setIdMapping(Map<Class<? extends Component>, Integer> componentIdMapping) {
   this.idTable = ImmutableBiMap.copyOf(componentIdMapping);
 }