@Override public RexNode visitFieldAccess(RexFieldAccess fieldAccess) { if (cm.mapFieldAccessToCorRef.containsKey(fieldAccess)) { // if it is a corVar, change it to be input ref. CorRef corVar = cm.mapFieldAccessToCorRef.get(fieldAccess); // corVar offset should point to the leftInput of currentRel, // which is the Correlator. RexNode newRexNode = new RexInputRef(corVar.field, fieldAccess.getType()); if (projectPulledAboveLeftCorrelator && (nullIndicator != null)) { // need to enforce nullability by applying an additional // cast operator over the transformed expression. newRexNode = createCaseExpression( nullIndicator, rexBuilder.constantNull(), newRexNode); } return newRexNode; } return fieldAccess; }
@Override public RexNode visitFieldAccess(RexFieldAccess fieldAccess) { if (cm.mapFieldAccessToCorRef.containsKey(fieldAccess)) { // if it is a corVar, change it to be input ref. CorRef corVar = cm.mapFieldAccessToCorRef.get(fieldAccess); // corVar offset should point to the leftInput of currentRel, // which is the Correlator. RexNode newRexNode = new RexInputRef(corVar.field, fieldAccess.getType()); if (projectPulledAboveLeftCorrelator && (nullIndicator != null)) { // need to enforce nullability by applying an additional // cast operator over the transformed expression. newRexNode = createCaseExpression( nullIndicator, rexBuilder.constantNull(), newRexNode); } return newRexNode; } return fieldAccess; }
@Override public RexNode visitFieldAccess(RexFieldAccess fieldAccess) { if (cm.mapFieldAccessToCorRef.containsKey(fieldAccess)) { // if it is a corVar, change it to be input ref. CorRef corVar = cm.mapFieldAccessToCorRef.get(fieldAccess); // corVar offset should point to the leftInput of currentRel, // which is the Correlate. RexNode newRexNode = new RexInputRef(corVar.field, fieldAccess.getType()); if (projectPulledAboveLeftCorrelator && (nullIndicator != null)) { // need to enforce nullability by applying an additional // cast operator over the transformed expression. newRexNode = createCaseExpression( nullIndicator, rexBuilder.constantNull(), newRexNode); } return newRexNode; } return fieldAccess; }
@Override public RexNode visitFieldAccess(RexFieldAccess fieldAccess) { if (cm.mapFieldAccessToCorRef.containsKey(fieldAccess)) { // if it is a corVar, change it to be input ref. CorRef corVar = cm.mapFieldAccessToCorRef.get(fieldAccess); // corVar offset should point to the leftInput of currentRel, // which is the Correlate. RexNode newRexNode = new RexInputRef(corVar.field, fieldAccess.getType()); if (projectPulledAboveLeftCorrelator && (nullIndicator != null)) { // need to enforce nullability by applying an additional // cast operator over the transformed expression. newRexNode = createCaseExpression( nullIndicator, rexBuilder.constantNull(), newRexNode); } return newRexNode; } return fieldAccess; }
@Override public RexNode visitFieldAccess(RexFieldAccess fieldAccess) { if (cm.mapFieldAccessToCorRef.containsKey(fieldAccess)) { // if it is a corVar, change it to be input ref. CorRef corVar = cm.mapFieldAccessToCorRef.get(fieldAccess); // corVar offset should point to the leftInput of currentRel, // which is the Correlate. RexNode newRexNode = new RexInputRef(corVar.field, fieldAccess.getType()); if (projectPulledAboveLeftCorrelator && (nullIndicator != null)) { // need to enforce nullability by applying an additional // cast operator over the transformed expression. newRexNode = createCaseExpression( nullIndicator, rexBuilder.constantNull(), newRexNode); } return newRexNode; } return fieldAccess; }
@Override public String visitFieldAccess(RexFieldAccess fieldAccess) { StringBuilder sb = new StringBuilder(); sb.append("v"); RelDataType type = fieldAccess.getType(); switch (type.getSqlTypeName()) { case BOOLEAN: sb.append("Bool"); break; case INTEGER: sb.append("Int"); break; case VARCHAR: sb.append("Varchar"); break; } if (!type.isNullable()) { sb.append("NotNull"); } sb.append("("); sb.append(fieldAccess.getField().getIndex() % 10); sb.append(")"); return sb.toString(); } }
@Override public String visitFieldAccess(RexFieldAccess fieldAccess) { StringBuilder sb = new StringBuilder(); sb.append("v"); RelDataType type = fieldAccess.getType(); switch (type.getSqlTypeName()) { case BOOLEAN: sb.append("Bool"); break; case INTEGER: sb.append("Int"); break; case VARCHAR: sb.append("Varchar"); break; } if (!type.isNullable()) { sb.append("NotNull"); } sb.append("("); sb.append(fieldAccess.getField().getIndex() % 10); sb.append(")"); return sb.toString(); } }
@Override public Boolean visitFieldAccess(RexFieldAccess fieldAccess) { super.visitFieldAccess(fieldAccess); final RelDataType refType = fieldAccess.getReferenceExpr().getType(); assert refType.isStruct(); final RelDataTypeField field = fieldAccess.getField(); final int index = field.getIndex(); if ((index < 0) || (index > refType.getFieldList().size())) { ++failCount; return litmus.fail(null); } final RelDataTypeField typeField = refType.getFieldList().get(index); if (!RelOptUtil.eq( "type1", typeField.getType(), "type2", fieldAccess.getType(), litmus)) { ++failCount; return litmus.fail(null); } return litmus.succeed(); }
@Override public Boolean visitFieldAccess(RexFieldAccess fieldAccess) { super.visitFieldAccess(fieldAccess); final RelDataType refType = fieldAccess.getReferenceExpr().getType(); assert refType.isStruct(); final RelDataTypeField field = fieldAccess.getField(); final int index = field.getIndex(); if ((index < 0) || (index > refType.getFieldList().size())) { ++failCount; return litmus.fail(null); } final RelDataTypeField typeField = refType.getFieldList().get(index); if (!RelOptUtil.eq( "type1", typeField.getType(), "type2", fieldAccess.getType(), litmus)) { ++failCount; return litmus.fail(null); } return litmus.succeed(); }
RexNode rxName = builder.makeLiteral(fieldName, typeFactory.createType(String.class), true); RexCall accessCall = (RexCall) builder.makeCall( fieldAccess.getType(), SqlStdOperatorTable.STRUCT_ACCESS, ImmutableList.of(target, rxIndex, rxName));