Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
 public override void set(int index, IScalar value)
 {
     if (value.getDataType() == DATA_TYPE.DT_FLOAT)
     {
         setFloat(index, ((BasicFloat)value).getValue());
     }
 }
Ejemplo n.º 3
0
 public override void set(int index, IScalar value)
 {
     if (value.getDataType() == DATA_TYPE.DT_SECOND)
     {
         setSecond(index, ((BasicSecond)value).getValue());
     }
 }
Ejemplo n.º 4
0
 public override void set(int index, IScalar value)
 {
     if (value.getDataType() == DATA_TYPE.DT_DOUBLE)
     {
         setDouble(index, ((BasicDouble)value).getValue());
     }
 }
Ejemplo n.º 5
0
 public override void set(int index, IScalar value)
 {
     if (value.getDataType() == DATA_TYPE.DT_MONTH)
     {
         setMonth(index, ((BasicMonth)value).getValue());
     }
 }
Ejemplo n.º 6
0
 public override void set(int index, IScalar value)
 {
     if (value.getDataType() == DATA_TYPE.DT_DATETIME)
     {
         setDateTime(index, ((BasicDateTime)value).getValue());
     }
 }
Ejemplo n.º 7
0
 public override void set(int index, IScalar value)
 {
     if (value.getDataType() == DATA_TYPE.DT_NANOTIMESTAMP)
     {
         setNanoTimestamp(index, ((BasicNanoTimestamp)value).getValue());
     }
 }
Ejemplo n.º 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();
     }
 }
Ejemplo n.º 10
0
 public override void set(int index, IScalar value)
 {
     if (value.getDataType() == DATA_TYPE.DT_MINUTE)
     {
         setMinute(index, ((BasicMinute)value).getValue());
     }
 }
Ejemplo n.º 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. ");
     }
 }
Ejemplo n.º 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. ");
     }
 }
Ejemplo n.º 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. ");
     }
 }
Ejemplo n.º 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());
     }
 }
Ejemplo n.º 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. ");
     }
 }
Ejemplo n.º 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. ");
     }
 }
Ejemplo n.º 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. ");
     }
 }
Ejemplo n.º 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. ");
     }
 }
Ejemplo n.º 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. ");
     }
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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. ");
     }
 }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 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. ");
     }
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }