All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.xxdb.route.ValueDomain Maven / Gradle / Ivy

There is a newer version: 3.00.2.2
Show newest version
package com.xxdb.route;

import java.util.ArrayList;
import java.util.List;

import com.xxdb.data.Entity;
import com.xxdb.data.Scalar;
import com.xxdb.data.Utils;
import com.xxdb.data.Vector;
import com.xxdb.data.Entity.DATA_TYPE;

public class ValueDomain implements Domain{
	private Entity.DATA_TYPE type;
	private Entity.DATA_CATEGORY cat;

	public ValueDomain(Vector partitionScheme, Entity.DATA_TYPE type, Entity.DATA_CATEGORY cat){
		this.type = partitionScheme.getDataType();
		this.cat = partitionScheme.getDataCategory();
	}
	
	@Override
	public List getPartitionKeys(Vector partitionCol) {
		if(partitionCol.getDataCategory() != cat)
			throw new RuntimeException("Data category incompatible.");
		if(cat == Entity.DATA_CATEGORY.TEMPORAL && this.type != partitionCol.getDataType())
			partitionCol = (Vector)Utils.castDateTime(partitionCol, this.type);

		if(this.type == DATA_TYPE.DT_LONG)
			throw new RuntimeException("Long type value can't be used as a partition column.");
		
		int rows = partitionCol.rows();
		ArrayList keys = new ArrayList(rows);
		for(int i=0; i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy