@Override
 public RelDataType deriveRowType() {
   final List<RelDataTypeField> fieldList = table.getRowType().getFieldList();
   final RelDataTypeFactory.FieldInfoBuilder builder = getCluster().getTypeFactory().builder();
   for (int i = 0; i < table.getRowType().getFieldCount(); i++) {
     builder.add(fieldList.get(i));
   }
   return builder.build();
 }
 protected RelDataType validateImpl() {
   final RelDataTypeFactory.FieldInfoBuilder builder = validator.getTypeFactory().builder();
   for (SqlMoniker moniker : validator.catalogReader.getAllSchemaObjectNames(names)) {
     final List<String> names1 = moniker.getFullyQualifiedNames();
     final SqlValidatorTable table = validator.catalogReader.getTable(names1);
     builder.add(Util.last(names1), table.getRowType());
   }
   return builder.build();
 }
 public RelDataType inferReturnType(SqlOperatorBinding opBinding) {
   RelDataType type = opBinding.getOperandType(0);
   if (type.isStruct()) {
     type = type.getFieldList().get(0).getType();
   }
   assert type instanceof ArraySqlType || type instanceof MultisetSqlType;
   if (withOrdinality) {
     final RelDataTypeFactory.FieldInfoBuilder builder = opBinding.getTypeFactory().builder();
     if (type.getComponentType().isStruct()) {
       builder.addAll(type.getComponentType().getFieldList());
     } else {
       builder.add(SqlUtil.deriveAliasFromOrdinal(0), type.getComponentType());
     }
     return builder.add(ORDINALITY_COLUMN_NAME, SqlTypeName.INTEGER).build();
   } else {
     return type.getComponentType();
   }
 }