public static Domain createDomain(PARTITION_TYPE type, DATA_TYPE partitionColType, IEntity partitionSchema) { if (type == PARTITION_TYPE.HASH) { DATA_TYPE dataType = partitionColType; DATA_CATEGORY dataCat = Utils.getCategory(dataType); int buckets = ((BasicInt)partitionSchema).getValue(); return(new HashDomain(buckets, dataType, dataCat)); } else if (type == PARTITION_TYPE.VALUE) { DATA_TYPE dataType = partitionSchema.getDataType(); DATA_CATEGORY dataCat = Utils.getCategory(dataType); return(new ValueDomain((IVector)partitionSchema, dataType, dataCat)); } else if (type == PARTITION_TYPE.RANGE) { DATA_TYPE dataType = partitionSchema.getDataType(); DATA_CATEGORY dataCat = Utils.getCategory(dataType); return(new RangeDomain((IVector)partitionSchema, dataType, dataCat)); } else if (type == PARTITION_TYPE.LIST) { DATA_TYPE dataType = ((BasicAnyVector)partitionSchema).getEntity(0).getDataType(); DATA_CATEGORY dataCat = Utils.getCategory(dataType); return(new ListDomain((IVector)partitionSchema, dataType, dataCat)); } throw new Exception("Unsupported partition type " + type.ToString()); }
public ListDomain(IVector list, DATA_TYPE type, DATA_CATEGORY cat) { this.type = type; this.cat = cat; if (list.getDataType() != DATA_TYPE.DT_ANY) { throw new Exception("The input list must be a tuple."); } dict = new Dictionary <IScalar, int>(); BasicAnyVector values = (BasicAnyVector)list; int partitions = values.rows(); for (int i = 0; i < partitions; ++i) { IEntity cur = values.getEntity(i); if (cur.isScalar()) { dict.Add((IScalar)cur, i); } else { IVector vec = (IVector)cur; for (int j = 0; j < vec.rows(); ++j) { dict.Add(vec.get(j), i); } } } }
private void checkColumnType(int col, DATA_CATEGORY category, DATA_TYPE type) { DATA_CATEGORY expectCategory = this.columnCategories[col]; DATA_TYPE expectType = this.columnTypes[col]; if (category != expectCategory) { throw new Exception("column " + col + ", expect category " + expectCategory.ToString() + ", got category " + category.ToString()); } else if (category == DATA_CATEGORY.TEMPORAL && type != expectType) { throw new Exception("column " + col + ", temporal column must have exactly the same type, expect " + expectType.ToString() + ", got " + type.ToString()); } }
public ValueDomain(IVector partitionScheme, DATA_TYPE type, DATA_CATEGORY cat) { this.type = type; this.cat = cat; }
public RangeDomain(IVector range, DATA_TYPE type, DATA_CATEGORY cat) { this.type = type; this.cat = cat; this.range = range; }
public HashDomain(int buckets, DATA_TYPE type, DATA_CATEGORY cat) { this.buckets = buckets; this.type = type; this.cat = cat; }