本文整理汇总了Java中org.apache.pig.impl.logicalLayer.schema.Schema.FieldSchema.equals方法的典型用法代码示例。如果您正苦于以下问题:Java FieldSchema.equals方法的具体用法?Java FieldSchema.equals怎么用?Java FieldSchema.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.pig.impl.logicalLayer.schema.Schema.FieldSchema
的用法示例。
在下文中一共展示了FieldSchema.equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fitPossible
import org.apache.pig.impl.logicalLayer.schema.Schema.FieldSchema; //导入方法依赖的package包/类
/**
* Computes a modified version of manhattan distance between
* the two schemas: s1 & s2. Here the value on the same axis
* are preferred over values that change axis as this means
* that the number of casts required will be lesser on the same
* axis.
*
* However, this function ceases to be a metric as the triangle
* inequality does not hold.
*
* Each schema is an s1.size() dimensional vector.
* The ordering for each axis is as defined by castLookup.
* Unallowed casts are returned a dist of INFINITY.
* @param s1
* @param s2
* @return
*/
private long fitPossible(Schema s1, Schema s2) {
if(s1==null || s2==null) return INF;
List<FieldSchema> sFields = s1.getFields();
List<FieldSchema> fsFields = s2.getFields();
if(sFields.size()!=fsFields.size())
return INF;
long score = 0;
int castCnt=0;
for(int i=0;i<sFields.size();i++){
FieldSchema sFS = sFields.get(i);
if(sFS == null){
return INF;
}
// if we have a byte array do not include it
// in the computation of the score - bytearray
// fields will be looked at separately outside
// of this function
if (sFS.type == DataType.BYTEARRAY)
continue;
FieldSchema fsFS = fsFields.get(i);
if(DataType.isSchemaType(sFS.type)){
if(!FieldSchema.equals(sFS, fsFS, false, true))
return INF;
}
if(FieldSchema.equals(sFS, fsFS, true, true)) continue;
if(!castLookup.containsKey(sFS.type))
return INF;
if(!(castLookup.get(sFS.type).contains(fsFS.type)))
return INF;
score += (castLookup.get(sFS.type)).indexOf(fsFS.type) + 1;
++castCnt;
}
return score * castCnt;
}
示例2: fitPossible
import org.apache.pig.impl.logicalLayer.schema.Schema.FieldSchema; //导入方法依赖的package包/类
/**
* Computes a modified version of manhattan distance between
* the two schemas: s1 & s2. Here the value on the same axis
* are preferred over values that change axis as this means
* that the number of casts required will be lesser on the same
* axis.
*
* However, this function ceases to be a metric as the triangle
* inequality does not hold.
*
* Each schema is an s1.size() dimensional vector.
* The ordering for each axis is as defined by castLookup.
* Unallowed casts are returned a dist of INFINITY.
* @param s1
* @param s2
* @param s2Type
* @return
*/
private long fitPossible(Schema s1, Schema s2, SchemaType s2Type) {
if(s1==null || s2==null) return INF;
List<FieldSchema> sFields = s1.getFields();
List<FieldSchema> fsFields = s2.getFields();
if((s2Type == SchemaType.NORMAL) && (sFields.size()!=fsFields.size()))
return INF;
if((s2Type == SchemaType.VARARG) && (sFields.size() < fsFields.size()))
return INF;
long score = 0;
int castCnt=0;
for(int i=0;i<sFields.size();i++){
FieldSchema sFS = sFields.get(i);
if(sFS == null){
return INF;
}
// if we have a byte array do not include it
// in the computation of the score - bytearray
// fields will be looked at separately outside
// of this function
if (sFS.type == DataType.BYTEARRAY)
continue;
//if we get to the vararg field (if defined) : take it repeatedly
FieldSchema fsFS = ((s2Type == SchemaType.VARARG) && i >= s2.size()) ?
fsFields.get(s2.size() - 1) : fsFields.get(i);
if(DataType.isSchemaType(sFS.type)){
if(!FieldSchema.equals(sFS, fsFS, false, true))
return INF;
}
if(FieldSchema.equals(sFS, fsFS, true, true)) continue;
if(!castLookup.containsKey(sFS.type))
return INF;
if(!(castLookup.get(sFS.type).contains(fsFS.type)))
return INF;
score += (castLookup.get(sFS.type)).indexOf(fsFS.type) + 1;
++castCnt;
}
return score * castCnt;
}