if (DynamicRecordType.isDynamicStarColName(Util.last(fqId.names)) && !DynamicRecordType.isDynamicStarColName(Util.last(id.names))) { SqlNode[] inputs = new SqlNode[2]; inputs[0] = fqId;
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } RelDataTypeDrillImpl other = (RelDataTypeDrillImpl) obj; if (holder == null) { if (other.holder != null) { return false; } } else if (!holder.equals(other.holder)) { return false; } return true; }
public RelDataTypeField getField(RelDataTypeFactory typeFactory, String fieldName) { /* First check if this field name exists in our field list */ for (RelDataTypeField f : fields) { if (fieldName.equalsIgnoreCase(f.getName())) { return f; } } /* This field does not exist in our field list add it */ final SqlTypeName typeName = DynamicRecordType.isDynamicStarColName(fieldName) ? SqlTypeName.DYNAMIC_STAR : SqlTypeName.ANY; // This field does not exist in our field list add it RelDataTypeField newField = new RelDataTypeFieldImpl( fieldName, fields.size(), typeFactory.createTypeWithNullability(typeFactory.createSqlType(typeName), true)); /* Add the name to our list of field names */ fields.add(newField); return newField; } }
/** Returns whether {@code rowType} contains more than one star column. * Having more than one star columns implies ambiguous column. */ private boolean hasAmbiguousUnresolvedStar(RelDataType rowType, RelDataTypeField field, String columnName) { if (field.isDynamicStar() && !DynamicRecordType.isDynamicStarColName(columnName)) { int count = 0; for (RelDataTypeField possibleStar : rowType.getFieldList()) { if (possibleStar.isDynamicStar()) { if (++count > 1) { return true; } } } } return false; }
/** Returns whether {@code rowType} contains more than one star column. * Having more than one star columns implies ambiguous column. */ private boolean hasAmbiguousUnresolvedStar(RelDataType rowType, RelDataTypeField field, String columnName) { if (field.isDynamicStar() && !DynamicRecordType.isDynamicStarColName(columnName)) { int count = 0; for (RelDataTypeField possibleStar : rowType.getFieldList()) { if (possibleStar.isDynamicStar()) { if (++count > 1) { return true; } } } } return false; }
protected SqlNode expandDynamicStar(SqlIdentifier id, SqlIdentifier fqId) { if (DynamicRecordType.isDynamicStarColName(Util.last(fqId.names)) && !DynamicRecordType.isDynamicStarColName(Util.last(id.names))) { // Convert a column ref into ITEM(*, 'col_name') // for a dynamic star field in dynTable's rowType. SqlNode[] inputs = new SqlNode[2]; inputs[0] = fqId; inputs[1] = SqlLiteral.createCharString( Util.last(id.names), id.getParserPosition()); return new SqlBasicCall( SqlStdOperatorTable.ITEM, inputs, id.getParserPosition()); } return fqId; } }
protected SqlNode expandDynamicStar(SqlIdentifier id, SqlIdentifier fqId) { if (DynamicRecordType.isDynamicStarColName(Util.last(fqId.names)) && !DynamicRecordType.isDynamicStarColName(Util.last(id.names))) { // Convert a column ref into ITEM(*, 'col_name') // for a dynamic star field in dynTable's rowType. SqlNode[] inputs = new SqlNode[2]; inputs[0] = fqId; inputs[1] = SqlLiteral.createCharString( Util.last(id.names), id.getParserPosition()); return new SqlBasicCall( SqlStdOperatorTable.ITEM, inputs, id.getParserPosition()); } return fqId; } }
final SqlTypeName typeName = DynamicRecordType.isDynamicStarColName(fieldName) ? SqlTypeName.DYNAMIC_STAR : SqlTypeName.ANY;
final SqlTypeName typeName = DynamicRecordType.isDynamicStarColName(fieldName) ? SqlTypeName.DYNAMIC_STAR : SqlTypeName.ANY;
public SqlMonotonicity getMonotonicity(SqlValidatorScope scope) { // for "star" column, whether it's static or dynamic return not_monotonic directly. if (Util.last(names).equals("") || DynamicRecordType.isDynamicStarColName(Util.last(names))) { return SqlMonotonicity.NOT_MONOTONIC; } // First check for builtin functions which don't have parentheses, // like "LOCALTIME". final SqlValidator validator = scope.getValidator(); SqlCall call = SqlUtil.makeCall( validator.getOperatorTable(), this); if (call != null) { return call.getMonotonicity(scope); } final SqlQualified qualified = scope.fullyQualify(this); final SqlIdentifier fqId = qualified.identifier; return qualified.namespace.resolve().getMonotonicity(Util.last(fqId.names)); } }
public SqlMonotonicity getMonotonicity(SqlValidatorScope scope) { // for "star" column, whether it's static or dynamic return not_monotonic directly. if (Util.last(names).equals("") || DynamicRecordType.isDynamicStarColName(Util.last(names))) { return SqlMonotonicity.NOT_MONOTONIC; } // First check for builtin functions which don't have parentheses, // like "LOCALTIME". final SqlValidator validator = scope.getValidator(); SqlCall call = SqlUtil.makeCall( validator.getOperatorTable(), this); if (call != null) { return call.getMonotonicity(scope); } final SqlQualified qualified = scope.fullyQualify(this); final SqlIdentifier fqId = qualified.identifier; return qualified.namespace.resolve().getMonotonicity(Util.last(fqId.names)); } }