public CustomDateTimeJsonFieldDecoder(DecoderColumnHandle columnHandle) { this.columnHandle = requireNonNull(columnHandle, "columnHandle is null"); if (!SUPPORTED_TYPES.contains(columnHandle.getType())) { throwUnsupportedColumnType(columnHandle); } checkArgument(columnHandle.getFormatHint() != null, "format hint not defined for column '%s'", columnHandle.getName()); try { formatter = DateTimeFormat.forPattern(columnHandle.getFormatHint()).withLocale(Locale.ENGLISH).withZoneUTC(); } catch (IllegalArgumentException e) { throw new PrestoException( GENERIC_USER_ERROR, format("invalid joda pattern '%s' passed as format hint for column '%s'", columnHandle.getFormatHint(), columnHandle.getName())); } }
public AvroColumnDecoder(DecoderColumnHandle columnHandle) { try { requireNonNull(columnHandle, "columnHandle is null"); this.columnType = columnHandle.getType(); this.columnMapping = columnHandle.getMapping(); this.columnName = columnHandle.getName(); checkArgument(!columnHandle.isInternal(), "unexpected internal column '%s'", columnName); checkArgument(columnHandle.getFormatHint() == null, "unexpected format hint '%s' defined for column '%s'", columnHandle.getFormatHint(), columnName); checkArgument(columnHandle.getDataFormat() == null, "unexpected data format '%s' defined for column '%s'", columnHandle.getDataFormat(), columnName); checkArgument(columnHandle.getMapping() != null, "mapping not defined for column '%s'", columnName); checkArgument(isSupportedType(columnType), "Unsupported column type '%s' for column '%s'", columnType, columnName); } catch (IllegalArgumentException e) { throw new PrestoException(GENERIC_USER_ERROR, e); } }
public CsvColumnDecoder(DecoderColumnHandle columnHandle) { try { requireNonNull(columnHandle, "columnHandle is null"); checkArgument(!columnHandle.isInternal(), "unexpected internal column '%s'", columnHandle.getName()); columnName = columnHandle.getName(); checkArgument(columnHandle.getFormatHint() == null, "unexpected format hint '%s' defined for column '%s'", columnHandle.getFormatHint(), columnName); checkArgument(columnHandle.getDataFormat() == null, "unexpected data format '%s' defined for column '%s'", columnHandle.getDataFormat(), columnName); columnType = columnHandle.getType(); checkArgument(columnHandle.getMapping() != null, "mapping not defined for column '%s'", columnName); try { columnIndex = Integer.parseInt(columnHandle.getMapping()); } catch (NumberFormatException e) { throw new IllegalArgumentException(format("invalid mapping '%s' for column '%s'", columnHandle.getMapping(), columnName)); } checkArgument(columnIndex >= 0, "invalid mapping '%s' for column '%s'", columnHandle.getMapping(), columnName); checkArgument(isSupportedType(columnType), "Unsupported column type '%s' for column '%s'", columnType.getDisplayName(), columnName); } catch (IllegalArgumentException e) { throw new PrestoException(GENERIC_USER_ERROR, e); } }
requireNonNull(columnHandle, "columnHandle is null"); checkArgument(!columnHandle.isInternal(), "unexpected internal column '%s'", columnHandle.getName()); checkArgument(columnHandle.getFormatHint() == null, "unexpected format hint '%s' defined for column '%s'", columnHandle.getFormatHint(), columnHandle.getName());
public CustomDateTimeJsonFieldDecoder(DecoderColumnHandle columnHandle) { this.columnHandle = requireNonNull(columnHandle, "columnHandle is null"); if (!SUPPORTED_TYPES.contains(columnHandle.getType())) { throwUnsupportedColumnType(columnHandle); } checkArgument(columnHandle.getFormatHint() != null, "format hint not defined for column '%s'", columnHandle.getName()); try { formatter = DateTimeFormat.forPattern(columnHandle.getFormatHint()).withLocale(Locale.ENGLISH).withZoneUTC(); } catch (IllegalArgumentException e) { throw new PrestoException( GENERIC_USER_ERROR, format("invalid joda pattern '%s' passed as format hint for column '%s'", columnHandle.getFormatHint(), columnHandle.getName())); } }
public AvroColumnDecoder(DecoderColumnHandle columnHandle) { try { requireNonNull(columnHandle, "columnHandle is null"); this.columnType = columnHandle.getType(); this.columnMapping = columnHandle.getMapping(); this.columnName = columnHandle.getName(); checkArgument(!columnHandle.isInternal(), "unexpected internal column '%s'", columnName); checkArgument(columnHandle.getFormatHint() == null, "unexpected format hint '%s' defined for column '%s'", columnHandle.getFormatHint(), columnName); checkArgument(columnHandle.getDataFormat() == null, "unexpected data format '%s' defined for column '%s'", columnHandle.getDataFormat(), columnName); checkArgument(columnHandle.getMapping() != null, "mapping not defined for column '%s'", columnName); checkArgument(isSupportedType(columnType), "Unsupported column type '%s' for column '%s'", columnType, columnName); } catch (IllegalArgumentException e) { throw new PrestoException(GENERIC_USER_ERROR, e); } }
public CsvColumnDecoder(DecoderColumnHandle columnHandle) { try { requireNonNull(columnHandle, "columnHandle is null"); checkArgument(!columnHandle.isInternal(), "unexpected internal column '%s'", columnHandle.getName()); columnName = columnHandle.getName(); checkArgument(columnHandle.getFormatHint() == null, "unexpected format hint '%s' defined for column '%s'", columnHandle.getFormatHint(), columnName); checkArgument(columnHandle.getDataFormat() == null, "unexpected data format '%s' defined for column '%s'", columnHandle.getDataFormat(), columnName); columnType = columnHandle.getType(); checkArgument(columnHandle.getMapping() != null, "mapping not defined for column '%s'", columnName); try { columnIndex = Integer.parseInt(columnHandle.getMapping()); } catch (NumberFormatException e) { throw new IllegalArgumentException(format("invalid mapping '%s' for column '%s'", columnHandle.getMapping(), columnName)); } checkArgument(columnIndex >= 0, "invalid mapping '%s' for column '%s'", columnHandle.getMapping(), columnName); checkArgument(isSupportedType(columnType), "Unsupported column type '%s' for column '%s'", columnType.getDisplayName(), columnName); } catch (IllegalArgumentException e) { throw new PrestoException(GENERIC_USER_ERROR, e); } }
requireNonNull(columnHandle, "columnHandle is null"); checkArgument(!columnHandle.isInternal(), "unexpected internal column '%s'", columnHandle.getName()); checkArgument(columnHandle.getFormatHint() == null, "unexpected format hint '%s' defined for column '%s'", columnHandle.getFormatHint(), columnHandle.getName());