public int getPartitionKey(IScalar partitionCol) { if (partitionCol.getDataCategory() != cat) { throw new Exception("Data category incompatible."); } if (cat == DATA_CATEGORY.TEMPORAL && type != partitionCol.getDataType()) { DATA_TYPE old = partitionCol.getDataType(); partitionCol = (IScalar)Utils.castDateTime(partitionCol, type); if (partitionCol == null) { throw new Exception("Can't convert type from " + old.ToString() + " to " + type.ToString()); } } int index = 0; if (dict.ContainsKey(partitionCol)) { index = (int)dict[partitionCol]; } else { index = -1; } return(index); }
public int getPartitionKey(IScalar partitionCol) { if (partitionCol.getDataCategory() != cat) { throw new Exception("Data category incompatible."); } if (cat == DATA_CATEGORY.TEMPORAL && type != partitionCol.getDataType()) { //类型转化 DATA_TYPE old = partitionCol.getDataType(); partitionCol = (IScalar)Utils.castDateTime(partitionCol, type); if (partitionCol == null) { throw new Exception("Can't convert type from " + old.ToString() + " to " + type.ToString()); } } int rows = partitionCol.rows(); int key = partitionCol.hashBucket(buckets); return(key); }
public int getPartitionKey(IScalar partitionCol) { if (partitionCol.getDataCategory() != cat) { throw new Exception("Data category incompatible."); } if (cat == DATA_CATEGORY.TEMPORAL && type != partitionCol.getDataType()) { DATA_TYPE old = partitionCol.getDataType(); partitionCol = (IScalar)Utils.castDateTime(partitionCol, type); if (partitionCol == null) { throw new Exception("Can't convert type from " + old.ToString() + " to " + type.ToString()); } } if (type == DATA_TYPE.DT_LONG) { throw new Exception("Long type value can't be used as a partition column."); } int key = partitionCol.hashBucket(1048576); return(key); }
public int getPartitionKey(IScalar partitionCol) { if (partitionCol.getDataCategory() != cat) { throw new Exception("Data category incompatible."); } if (cat == DATA_CATEGORY.TEMPORAL && type != partitionCol.getDataType()) { DATA_TYPE old = partitionCol.getDataType(); partitionCol = (IScalar)Utils.castDateTime(partitionCol, type); if (partitionCol == null) { throw new Exception("Can't convert type from " + old.ToString() + " to " + type.ToString()); } } int partitions = range.rows() - 1; int key = range.asof(partitionCol); if (key >= partitions) { key = -1; } return(key); }