Package org.apache.phoenix.schema

Examples of org.apache.phoenix.schema.IllegalDataException


                try {
                    indexMutations =
                            IndexUtil.generateIndexData(tableRef.getTable(), index, mutations,
                                tempPtr, connection.getKeyValueBuilder());
                } catch (SQLException e) {
                    throw new IllegalDataException(e);
                }
                return new Pair<byte[],List<Mutation>>(index.getPhysicalName().getBytes(),indexMutations);
            }

            @Override
View Full Code Here


    public static Date parseDate(String dateValue) {
        try {
            return (Date)dateFormat.get().parseObject(dateValue);
        } catch (ParseException e) {
            throw new IllegalDataException(e);
        }
    }
View Full Code Here

    public static Time parseTime(String timeValue) {
        try {
            return (Time)timeFormat.get().parseObject(timeValue);
        } catch (ParseException e) {
            throw new IllegalDataException(e);
        }
    }
View Full Code Here

    public static Timestamp parseTimestamp(String timeValue) {
        try {
            return (Timestamp)timestampFormat.get().parseObject(timeValue);
        } catch (ParseException e) {
            throw new IllegalDataException(e);
        }
    }
View Full Code Here

        if (!encodingExpression.evaluate(tuple, ptr)) {
            return false;
        }

        if (ptr.getLength() == 0) {
            throw new IllegalDataException(getMissingEncodeFormatMsg());
        }

        PDataType type = encodingExpression.getDataType();
        String encodingFormat = ((String) type.toObject(ptr)).toUpperCase();
        EncodeFormat format = EncodeFormat.valueOf(encodingFormat);
        switch (format) {
            case BASE62:
                String encodedString = Base62Encoder.toString(num);
                ptr.set(PDataType.VARCHAR.toBytes(encodedString));
                break;
            default:
                throw new IllegalDataException(getUnsupportedEncodeFormatMsg(encodingFormat));
        }
        return true;
    }
View Full Code Here

    private TimeZone getTimezoneFromCache(String timezone) throws IllegalDataException {
        if (!cachedTimeZones.containsKey(timezone)) {
            TimeZone tz = TimeZone.getTimeZone(timezone);
            if (!tz.getID().equals(timezone)) {
                throw new IllegalDataException("Invalid timezone " + timezone);
            }
            cachedTimeZones.put(timezone, tz);
            return tz;
        }
        return cachedTimeZones.get(timezone);
View Full Code Here

                if (scale >=0 && scale <= PDataType.MAX_PRECISION) {
                    this.scale = scale;
                    return;
                }
            }
            throw new IllegalDataException("Invalid second argument for scale: " + scaleValue + ". The scale must be between 0 and " + PDataType.MAX_PRECISION + " inclusive.");
        }
    }
View Full Code Here

    if (!encodingExpression.evaluate(tuple, ptr)) {
      return false;
    }

    if (ptr.getLength() == 0) {
      throw new IllegalDataException("Missing bytes encoding.");
    }

    type = encodingExpression.getDataType();
    String encoding = ((String) type.toObject(ptr)).toUpperCase();

    byte out[];

    EncodeFormat format = EncodeFormat.valueOf(encoding);
    switch (format) {
      case HEX:
        out = decodeHex(stringToDecode);
        break;
      default:
        throw new IllegalDataException("Unsupported encoding \"" + encoding + "\"");
    }
    ptr.set(out);

    return true;
  }
View Full Code Here

    byte[] out = new byte[hexStr.length() / 2];
    for (int i = 0; i < hexStr.length(); i = i + 2) {
      try {
        out[i / 2] = (byte) Integer.parseInt(hexStr.substring(i, i + 2), 16);
      } catch (NumberFormatException ex) {
        throw new IllegalDataException("Value " + hexStr.substring(i, i + 2) + " cannot be cast to hex number");
      } catch (StringIndexOutOfBoundsException ex) {
        throw new IllegalDataException("Invalid value length, cannot cast to hex number (" + hexStr + ")");
      }
    }
    return out;
  }
View Full Code Here

        }

        if (!cachedTimeZones.containsKey(timezone)) {
            TimeZone tz = TimeZone.getTimeZone(timezone);
            if (!tz.getID().equals(timezone)) {
                throw new IllegalDataException("Invalid timezone " + timezone);
            }
            cachedTimeZones.put(timezone, tz);
        }

    Date date = (Date)PDataType.DATE.toObject(ptr, children.get(1).getSortOrder());
View Full Code Here

TOP

Related Classes of org.apache.phoenix.schema.IllegalDataException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.