private static boolean isConstExpr(RexNode node) { return !node.getType().isStruct() && HiveCalciteUtil.getInputRefs(node).size() == 0 && HiveCalciteUtil.isDeterministic(node); }
private static boolean isColumnExpr(RexNode node) { return !node.getType().isStruct() && HiveCalciteUtil.getInputRefs(node).size() > 0 && HiveCalciteUtil.isDeterministic(node); }
private RexNode convert(final ExprNodeFieldDesc fieldDesc) throws SemanticException { RexNode rexNode = convert(fieldDesc.getDesc()); if (rexNode.getType().isStruct()) { // regular case of accessing nested field in a column return cluster.getRexBuilder().makeFieldAccess(rexNode, fieldDesc.getFieldName(), true); } else { // This may happen for schema-less tables, where columns are dynamically // supplied by serdes. throw new CalciteSemanticException("Unexpected rexnode : " + rexNode.getClass().getCanonicalName(), UnsupportedFeature.Schema_less_table); } }
private RexNode convert(final ExprNodeFieldDesc fieldDesc) throws SemanticException { RexNode rexNode = convert(fieldDesc.getDesc()); if (rexNode.getType().isStruct()) { // regular case of accessing nested field in a column return cluster.getRexBuilder().makeFieldAccess(rexNode, fieldDesc.getFieldName(), true); } else { // This may happen for schema-less tables, where columns are dynamically // supplied by serdes. throw new CalciteSemanticException("Unexpected rexnode : " + rexNode.getClass().getCanonicalName(), UnsupportedFeature.Schema_less_table); } }
public static TypeInfo convert(RelDataType rType) { if (rType.isStruct()) { return convertStructType(rType); } else if (rType.getComponentType() != null) { return convertListType(rType); } else if (rType.getKeyType() != null) { return convertMapType(rType); } else { return convertPrimitiveType(rType); } }
public static TypeInfo convert(RelDataType rType) { if (rType.isStruct()) { return convertStructType(rType); } else if (rType.getComponentType() != null) { return convertListType(rType); } else if (rType.getKeyType() != null) { return convertMapType(rType); } else { return convertPrimitiveType(rType); } }
selectItem, select, targetRowType.isStruct() && targetRowType.getFieldCount() >= i ? targetRowType.getFieldList().get(i).getType()
} else if (node instanceof SqlNodeList) { SqlNodeList nodeList = (SqlNodeList) node; if (inferredType.isStruct()) { if (inferredType.getFieldCount() != nodeList.size()) { for (SqlNode child : nodeList) { RelDataType type; if (inferredType.isStruct()) { type = inferredType.getFieldList().get(i).getType(); ++i;
if (conformance.isInsertSubsetColumnsAllowed() && targetRowType.isStruct() && rowConstructor.operandCount() < targetRowType.getFieldCount()) { targetRowType = targetRowType.getFieldList() .subList(0, rowConstructor.operandCount())); } else if (targetRowType.isStruct() && rowConstructor.operandCount() != targetRowType.getFieldCount()) { return; rowConstructor); if (targetRowType.isStruct()) { for (Pair<SqlNode, RelDataTypeField> pair : Pair.zip(rowConstructor.getOperandList(),
scope, includeSystemVars); } else if (rowType.isStruct()) { for (RelDataTypeField field : rowType.getFieldList()) { String columnName = field.getName();
public static boolean containsStarColumn(RelDataType type) { if (! type.isStruct()) { return false; } List<String> fieldNames = type.getFieldNames(); for (String s : fieldNames) { if (s.startsWith(STAR_COLUMN)) { return true; } } return false; }
/** Returns whether a type is flat. It is not flat if it is a record type that * has one or more fields that are themselves record types. */ public static boolean isFlat(RelDataType type) { if (type.isStruct()) { for (RelDataTypeField field : type.getFieldList()) { if (field.getType().isStruct()) { return false; } } } return true; }
public RelDataType leastRestrictive(List<RelDataType> types) { assert types != null; assert types.size() >= 1; RelDataType type0 = types.get(0); if (type0.isStruct()) { return leastRestrictiveStructuredType(types); } return null; }
public SqlValidatorNamespace lookupChild(String name) { if (rowType.isStruct()) { return validator.lookupFieldNamespace( rowType, name); } return null; }
/** Returns whether a type is flat. It is not flat if it is a record type that * has one or more fields that are themselves record types. */ public static boolean isFlat(RelDataType type) { if (type.isStruct()) { for (RelDataTypeField field : type.getFieldList()) { if (field.getType().isStruct()) { return false; } } } return true; }
DelegateStructType(RelDataType delegate, StructKind structKind) { assert delegate.isStruct(); this.delegate = delegate; this.structKind = structKind; }
private static RelDataType makeStruct( RelDataTypeFactory typeFactory, RelDataType type) { if (type.isStruct()) { return type; } return typeFactory.builder().add("$0", type).build(); }
private static RelDataType makeStruct( RelDataTypeFactory typeFactory, RelDataType type) { if (type.isStruct()) { return type; } return typeFactory.builder().add("$0", type).build(); }
public static BatchSchema fromCalciteRowType(final RelDataType relDataType){ Preconditions.checkArgument(relDataType.isStruct()); SchemaBuilder builder = BatchSchema.newBuilder(); for (Map.Entry<String,RelDataType> field : relDataType.getFieldList()) { MinorType minorType = TypeInferenceUtils.getMinorTypeFromCalciteType(field.getValue()); if (minorType != null) { Field f = MajorTypeHelper.getFieldForNameAndMajorType(field.getKey(), Types.optional(minorType)); builder.addField(f); } } return builder.build(); }
private RelDataType toStruct(RelDataType type) { if (type.isStruct()) { return type; } return typeFactory.builder() .add(SqlUtil.deriveAliasFromOrdinal(0), type) .build(); }