public TimeGranularitySpec(@Nonnull DataType dataType, @Nonnull TimeUnit timeType, @Nonnull String timeFormat, @Nonnull String name) { Preconditions.checkNotNull(timeType); Preconditions.checkNotNull(name); Preconditions.checkNotNull(timeFormat); Preconditions.checkArgument(timeFormat.equals(TimeFormat.EPOCH.toString()) || (timeFormat .startsWith(TimeFormat.SIMPLE_DATE_FORMAT.toString()))); _dataType = dataType.getStoredType(); _timeType = timeType; _name = name; _timeFormat = timeFormat; }
public TimeGranularitySpec(@Nonnull DataType dataType, int timeUnitSize, @Nonnull TimeUnit timeType, @Nonnull String name) { Preconditions.checkNotNull(timeType); Preconditions.checkNotNull(name); _dataType = dataType.getStoredType(); _timeType = timeType; _timeUnitSize = timeUnitSize; _name = name; }
public TimeGranularitySpec(@Nonnull DataType dataType, @Nonnull TimeUnit timeType, @Nonnull String name) { Preconditions.checkNotNull(timeType); Preconditions.checkNotNull(name); _dataType = dataType.getStoredType(); _timeType = timeType; _name = name; }
/** * Test all {@link FieldSpec.DataType}. */ @Test public void testDataType() { Assert.assertEquals(INT.getStoredType(), INT); Assert.assertEquals(LONG.getStoredType(), LONG); Assert.assertEquals(FLOAT.getStoredType(), FLOAT); Assert.assertEquals(DOUBLE.getStoredType(), DOUBLE); Assert.assertEquals(BOOLEAN.getStoredType(), STRING); Assert.assertEquals(STRING.getStoredType(), STRING); Assert.assertEquals(BYTES.getStoredType(), BYTES); Assert.assertEquals(INT.size(), Integer.BYTES); Assert.assertEquals(LONG.size(), Long.BYTES); Assert.assertEquals(FLOAT.size(), Float.BYTES); Assert.assertEquals(DOUBLE.size(), Double.BYTES); Assert.assertEquals(FieldSpec.DataType.valueOf(Schema.Type.INT), INT); Assert.assertEquals(FieldSpec.DataType.valueOf(Schema.Type.LONG), LONG); Assert.assertEquals(FieldSpec.DataType.valueOf(Schema.Type.FLOAT), FLOAT); Assert.assertEquals(FieldSpec.DataType.valueOf(Schema.Type.DOUBLE), DOUBLE); Assert.assertEquals(FieldSpec.DataType.valueOf(Schema.Type.BOOLEAN), STRING); Assert.assertEquals(FieldSpec.DataType.valueOf(Schema.Type.STRING), STRING); Assert.assertEquals(FieldSpec.DataType.valueOf(Schema.Type.ENUM), STRING); Assert.assertEquals(FieldSpec.DataType.valueOf(Schema.Type.BYTES), BYTES); }
public void setDataType(@Nonnull DataType dataType) { _dataType = dataType.getStoredType(); }
public void setDataType(DataType dataType) { _dataType = dataType.getStoredType(); _defaultNullValue = getDefaultNullValue(getFieldType(), _dataType, _stringDefaultNullValue); }
public TimeGranularitySpec(@Nonnull DataType dataType, int timeUnitSize, @Nonnull TimeUnit timeType, @Nonnull String timeFormat, @Nonnull String name) { Preconditions.checkNotNull(timeType); Preconditions.checkNotNull(name); Preconditions.checkNotNull(timeFormat); Preconditions.checkArgument(timeFormat.equals(TimeFormat.EPOCH.toString()) || (timeFormat .startsWith(TimeFormat.SIMPLE_DATE_FORMAT.toString()))); _dataType = dataType.getStoredType(); _timeType = timeType; _timeUnitSize = timeUnitSize; _name = name; _timeFormat = timeFormat; }
public Builder setDataType(DataType dataType) { this.dataType = dataType.getStoredType(); return this; }
public FieldSpec(String name, DataType dataType, boolean isSingleValueField, int maxLength, @Nullable Object defaultNullValue) { _name = name; _dataType = dataType.getStoredType(); _isSingleValueField = isSingleValueField; _maxLength = maxLength; setDefaultNullValue(defaultNullValue); }