private Expression fieldExpression(ParameterExpression row_, int i, PhysType physType, JavaRowFormat format) { final Expression e = format.field(row_, i, null, physType.getJavaFieldType(i)); final RelDataType relFieldType = physType.getRowType().getFieldList().get(i).getType(); switch (relFieldType.getSqlTypeName()) { case ARRAY: case MULTISET: // We can't represent a multiset or array as a List<Employee>, because // the consumer does not know the element type. // The standard element type is List. // We need to convert to a List<List>. final JavaTypeFactory typeFactory = (JavaTypeFactory) getCluster().getTypeFactory(); final PhysType elementPhysType = PhysTypeImpl.of( typeFactory, relFieldType.getComponentType(), JavaRowFormat.CUSTOM); final MethodCallExpression e2 = Expressions.call(BuiltInMethod.AS_ENUMERABLE2.method, e); final RelDataType dummyType = this.rowType; final Expression e3 = elementPhysType.convertTo(e2, PhysTypeImpl.of(typeFactory, dummyType, JavaRowFormat.LIST)); return Expressions.call(e3, BuiltInMethod.ENUMERABLE_TO_LIST.method); default: return e; } }
private Expression fieldExpression(ParameterExpression row_, int i, PhysType physType, JavaRowFormat format) { final Expression e = format.field(row_, i, null, physType.getJavaFieldType(i)); final RelDataType relFieldType = physType.getRowType().getFieldList().get(i).getType(); switch (relFieldType.getSqlTypeName()) { case ARRAY: case MULTISET: // We can't represent a multiset or array as a List<Employee>, because // the consumer does not know the element type. // The standard element type is List. // We need to convert to a List<List>. final JavaTypeFactory typeFactory = (JavaTypeFactory) getCluster().getTypeFactory(); final PhysType elementPhysType = PhysTypeImpl.of( typeFactory, relFieldType.getComponentType(), JavaRowFormat.CUSTOM); final MethodCallExpression e2 = Expressions.call(BuiltInMethod.AS_ENUMERABLE2.method, e); final RelDataType dummyType = this.rowType; final Expression e3 = elementPhysType.convertTo(e2, PhysTypeImpl.of(typeFactory, dummyType, JavaRowFormat.LIST)); return Expressions.call(e3, BuiltInMethod.ENUMERABLE_TO_LIST.method); default: return e; } }
null, Expressions.call( inputPhysType.convertTo(childExp, physType), BuiltInMethod.DISTINCT.method, Expressions.<Expression>list()
null, Expressions.call( inputPhysType.convertTo(childExp, physType), BuiltInMethod.DISTINCT.method, Expressions.<Expression>list()