示例#1
0
        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);
        }
示例#2
0
 public override void set(int index, IScalar value)
 {
     if (value.getDataType() == DATA_TYPE.DT_FLOAT)
     {
         setFloat(index, ((BasicFloat)value).getValue());
     }
 }
示例#3
0
 public override void set(int index, IScalar value)
 {
     if (value.getDataType() == DATA_TYPE.DT_SECOND)
     {
         setSecond(index, ((BasicSecond)value).getValue());
     }
 }
示例#4
0
 public override void set(int index, IScalar value)
 {
     if (value.getDataType() == DATA_TYPE.DT_DOUBLE)
     {
         setDouble(index, ((BasicDouble)value).getValue());
     }
 }
示例#5
0
 public override void set(int index, IScalar value)
 {
     if (value.getDataType() == DATA_TYPE.DT_MONTH)
     {
         setMonth(index, ((BasicMonth)value).getValue());
     }
 }
 public override void set(int index, IScalar value)
 {
     if (value.getDataType() == DATA_TYPE.DT_DATETIME)
     {
         setDateTime(index, ((BasicDateTime)value).getValue());
     }
 }
示例#7
0
 public override void set(int index, IScalar value)
 {
     if (value.getDataType() == DATA_TYPE.DT_NANOTIMESTAMP)
     {
         setNanoTimestamp(index, ((BasicNanoTimestamp)value).getValue());
     }
 }
示例#8
0
 public override void set(int index, IScalar value)
 {
     if (value.getDataType() == DATA_TYPE.DT_SHORT)
     {
         setShort(index, ((BasicShort)value).getValue());
     }
 }
 public override void set(int index, IScalar value)
 {
     if (value.getDataType() == DATA_TYPE.DT_STRING)
     {
         values[index] = ((BasicString)value).getString();
     }
 }
示例#10
0
 public override void set(int index, IScalar value)
 {
     if (value.getDataType() == DATA_TYPE.DT_MINUTE)
     {
         setMinute(index, ((BasicMinute)value).getValue());
     }
 }
示例#11
0
 public override void set(int index, IScalar value)
 {
     if (value.getDataType() == DATA_TYPE.DT_SHORT)
     {
         setShort(index, ((BasicShort)value).getValue());
     }
     else
     {
         throw new Exception("The value must be a short scalar. ");
     }
 }
示例#12
0
 public override void set(int index, IScalar value)
 {
     if (value.getDataType() == DATA_TYPE.DT_NANOTIMESTAMP)
     {
         setNanoTimestamp(index, ((BasicNanoTimestamp)value).getValue());
     }
     else
     {
         throw new Exception("The value must be a nanoTimeStamp scalar. ");
     }
 }
示例#13
0
 public override void set(int index, IScalar value)
 {
     if (value.getDataType() == DATA_TYPE.DT_SECOND)
     {
         setSecond(index, ((BasicSecond)value).getValue());
     }
     else
     {
         throw new Exception("The value must be a second scalar. ");
     }
 }
示例#14
0
 public override void set(int index, IScalar value)
 {
     if (value.getDataType() == DATA_TYPE.DT_INT)
     {
         values[index] = ((BasicInt)value).getInt();
     }
     else
     {
         values[index] = Convert.ToInt32(value.getString());
     }
 }
示例#15
0
 public override void set(int index, IScalar value)
 {
     if (value.getDataType() == DATA_TYPE.DT_FLOAT)
     {
         setFloat(index, ((BasicFloat)value).getValue());
     }
     else
     {
         throw new Exception("The value must be a float scalar. ");
     }
 }
示例#16
0
 public override void set(int index, IScalar value)
 {
     if (value.getDataType() == DATA_TYPE.DT_MINUTE)
     {
         setMinute(index, ((BasicMinute)value).getValue());
     }
     else
     {
         throw new Exception("The value must be a minute scalar. ");
     }
 }
示例#17
0
 public override void set(int index, IScalar value)
 {
     if (value.getDataType() == DATA_TYPE.DT_STRING)
     {
         values[index] = @base.find(value.getString(), true);
     }
     else
     {
         throw new Exception("The value must be a string scalar. ");
     }
 }
示例#18
0
 public override void set(int index, IScalar value)
 {
     if (value.getDataType() == DATA_TYPE.DT_MONTH)
     {
         setMonth(index, ((BasicMonth)value).getValue());
     }
     else
     {
         throw new Exception("The value must be a month scalar. ");
     }
 }
示例#19
0
 public override void set(int index, IScalar value)
 {
     if (value.getDataType() == DATA_TYPE.DT_DATETIME)
     {
         setDateTime(index, ((BasicDateTime)value).getValue());
     }
     else
     {
         throw new Exception("The value must be a dateTime scalar. ");
     }
 }
示例#20
0
        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);
        }
示例#21
0
 public override void set(int index, IScalar value)
 {
     if (value.getDataType() == DATA_TYPE.DT_UUID)
     {
         Long2 t = ((BasicInt128)value).getLong2();
         setInt128(index, t.high, t.low);
     }
     else
     {
         throw new Exception("The value must be a uuid scalar. ");
     }
 }
示例#22
0
 public virtual bool put(IScalar key, IEntity value)
 {
     if (key.getDataType() != KeyDataType || (value.getDataType() != getDataType()))
     {
         return(false);
     }
     else
     {
         dict[key] = value;
         return(true);
     }
 }
示例#23
0
 public override void set(int index, IScalar value)
 {
     if (value.getDataType() == DATA_TYPE.DT_INT128)
     {
         values[index].high = ((BasicInt128)value).getMostSignicantBits();
         values[index].low  = ((BasicInt128)value).getLeastSignicantBits();
     }
     else
     {
         throw new Exception("The value must be a int128 scalar. ");
     }
 }
示例#24
0
        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);
        }
示例#25
0
        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);
        }