Пример #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());
     }
 }
Пример #6
0
 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);
        }