com.xxdb.route.ValueDomain Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dolphindb-javaapi Show documentation
Show all versions of dolphindb-javaapi Show documentation
The messaging and data conversion protocol between Java and DolphinDB server
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