/** Variant of {@link #trimFields(RelNode, BitSet, Set)} for {@link TableModificationRel}. */ public TrimResult trimFields( TableModificationRel modifier, BitSet fieldsUsed, Set<RelDataTypeField> extraFields) { // Ignore what consumer wants. We always project all columns. Util.discard(fieldsUsed); final RelDataType rowType = modifier.getRowType(); final int fieldCount = rowType.getFieldCount(); RelNode input = modifier.getChild(); // We want all fields from the child. final int inputFieldCount = input.getRowType().getFieldCount(); BitSet inputFieldsUsed = Util.bitSetBetween(0, inputFieldCount); // Create input with trimmed columns. final Set<RelDataTypeField> inputExtraFields = Collections.emptySet(); TrimResult trimResult = trimChild(modifier, input, inputFieldsUsed, inputExtraFields); RelNode newInput = trimResult.left; final Mapping inputMapping = trimResult.right; if (!inputMapping.isIdentity()) { // We asked for all fields. Can't believe that the child decided // to permute them! throw Util.newInternal("Expected identity mapping, got " + inputMapping); } TableModificationRel newModifier = modifier; if (newInput != input) { newModifier = modifier.copy(modifier.getTraitSet(), Collections.singletonList(newInput)); } assert newModifier.getClass() == modifier.getClass(); // Always project all fields. Mapping mapping = Mappings.createIdentity(fieldCount); return new TrimResult(newModifier, mapping); }
/** * Trims the fields of an input relational expression. * * @param rel Relational expression * @param input Input relational expression, whose fields to trim * @param fieldsUsed Bitmap of fields needed by the consumer * @return New relational expression and its field mapping */ protected TrimResult trimChild( RelNode rel, RelNode input, BitSet fieldsUsed, Set<RelDataTypeField> extraFields) { Util.discard(rel); if (input.getClass().getName().endsWith("MedMdrClassExtentRel")) { // MedMdrJoinRule cannot handle Join of Project of // MedMdrClassExtentRel, only naked MedMdrClassExtentRel. // So, disable trimming. fieldsUsed = Util.bitSetBetween(0, input.getRowType().getFieldCount()); } return dispatchTrimFields(input, fieldsUsed, extraFields); }
/** * Records the fact that instances of <code>rel</code> are available via <code>bind</code> (which * may be eager or lazy). */ private void bind(RelNode rel, Bind bind) { tracer.log(Level.FINE, "Bind " + rel.toString() + " to " + bind); JavaFrame frame = (JavaFrame) mapRel2Frame.get(rel); frame.bind = bind; boolean stupid = SaffronProperties.instance().stupid.get(); if (stupid) { // trigger the declaration of the variable, even though it // may not be used Util.discard(bind.getVariable()); } }
SubExprExistsException(RexNode expr) { Util.discard(expr); }
/** * Creates a RelFieldTrimmer. * * @param validator Validator */ public RelFieldTrimmer(SqlValidator validator) { Util.discard(validator); // may be useful one day this.trimFieldsDispatcher = ReflectUtil.createMethodDispatcher( TrimResult.class, this, "trimFields", RelNode.class, BitSet.class, Set.class); }
/** * Visit method, per {@link org.eigenbase.util.ReflectiveVisitor}. * * <p>This method is invoked reflectively, so there may not be any apparent calls to it. The class * (or derived classes) may contain overloads of this method with more specific types for the * {@code rel} parameter. * * <p>Returns a pair: the relational expression created, and the mapping between the original * fields and the fields of the newly created relational expression. * * @param rel Relational expression * @param fieldsUsed Fields needed by the consumer * @return relational expression and mapping */ public TrimResult trimFields(RelNode rel, BitSet fieldsUsed, Set<RelDataTypeField> extraFields) { // We don't know how to trim this kind of relational expression, so give // it back intact. Util.discard(fieldsUsed); return new TrimResult(rel, Mappings.createIdentity(rel.getRowType().getFieldCount())); }
public String getSignatureTemplate(final int operandsCount) { Util.discard(operandsCount); return "{1} {0} {2} AND {3}"; }