com.xxdb.route.ListDomain 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.HashMap;
import java.util.List;
import java.util.Map;
import com.xxdb.data.BasicAnyVector;
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 ListDomain implements Domain {
private Entity.DATA_TYPE type;
private Entity.DATA_CATEGORY cat;
private Map dict;
public ListDomain(Vector list, Entity.DATA_TYPE type, Entity.DATA_CATEGORY cat){
this.type = type;
this.cat = cat;
if(list.getDataType() != Entity.DATA_TYPE.DT_ANY)
throw new RuntimeException("The input list must be a tuple.");
this.dict = new HashMap();
BasicAnyVector values = (BasicAnyVector)list;
int partitions = values.rows();
for(int i=0; i getPartitionKeys(Vector partitionCol) {
if(partitionCol.getDataCategory() != this.cat)
throw new RuntimeException("Data category incompatible.");
if (this.cat == Entity.DATA_CATEGORY.TEMPORAL && type != partitionCol.getDataType())
partitionCol = (Vector)Utils.castDateTime(partitionCol, this.type);
int rows = partitionCol.rows();
ArrayList keys = new ArrayList(rows);
for(int i=0; i