return AvroUtils._logicalDate();
/** * Checks {@link AvroTypeConverter#convertToAvro(String, String)} returns logical date avro schema with in case "date" * logical type is passed */ @Test public void testConvertToAvroLogicalDate() { Schema expectedSchema = AvroUtils._logicalDate(); assertEquals(expectedSchema, AvroTypeConverter.convertToAvro(null, "date")); }
/** * Checks {@link TalendType#convertFromAvro(Schema)} converts logical date avro type to "id_Date" di type */ @Test public void testConvertFromAvroLogicalDate() { TalendType expectedType = TalendType.DATE; Schema fieldSchema = AvroUtils._logicalDate(); assertEquals(expectedType, TalendType.convertFromAvro(fieldSchema)); }
.noDefault() .name("date") .type(AvroUtils._logicalDate()) .noDefault() .name("salary")
.noDefault() .name("date") .type(Schema.createUnion(AvroUtils._logicalDate(), Schema.create(Schema.Type.NULL))) .noDefault() .name("salary")
@Before public void createSchema() { schema = SchemaBuilder.builder() .record("main") .fields() .name("integer_fld") .type(Schema.createUnion(AvroUtils._int(), Schema.create(Schema.Type.NULL))) .withDefault(1) .name("string_fld") .type(Schema.createUnion(AvroUtils._string(), Schema.create(Schema.Type.NULL))) .noDefault() .name("date_fld") .type(Schema.createUnion(AvroUtils._logicalDate(), Schema.create(Schema.Type.NULL))) .noDefault() .endRecord(); }
@Before public void createSchema(){ schema = SchemaBuilder.builder() .record("main") .fields() .name("id") .prop(SchemaConstants.TALEND_COLUMN_IS_KEY, "true") .type(AvroUtils._int()) .withDefault(1) .name("name") .prop(SchemaConstants.TALEND_COLUMN_IS_KEY, "true") .prop(SchemaConstants.TALEND_COLUMN_DB_LENGTH, "255") .prop(SchemaConstants.TALEND_COLUMN_DEFAULT, "\"ok\"") .type(AvroUtils._string()) .noDefault() .name("date") .type(AvroUtils._logicalDate()) .noDefault() .name("salary") .prop(SchemaConstants.TALEND_COLUMN_DB_TYPE, "MY_DOUBLE") .prop(SchemaConstants.TALEND_COLUMN_PRECISION, "38") .prop(SchemaConstants.TALEND_COLUMN_SCALE, "4") .type(AvroUtils._double()) .withDefault("0") .name("updated") .type(AvroUtils._logicalTimestamp()) .noDefault() .endRecord(); }
@Before public void createSchema() { schema = SchemaBuilder.builder() .record("main") .fields() .name("id") .prop(SchemaConstants.TALEND_COLUMN_IS_KEY, "true") .type(AvroUtils._int()) .withDefault(1) .name("name") .prop(SchemaConstants.TALEND_COLUMN_IS_KEY, "true") .prop(SchemaConstants.TALEND_COLUMN_DB_LENGTH, "255") .prop(SchemaConstants.TALEND_COLUMN_DEFAULT, "\"ok\"") .type(AvroUtils._string()) .noDefault() .name("date") .type(AvroUtils._logicalDate()) .noDefault() .name("salary") .prop(SchemaConstants.TALEND_COLUMN_DB_TYPE, "MY_DOUBLE") .prop(SchemaConstants.TALEND_COLUMN_PRECISION, "38") .prop(SchemaConstants.TALEND_COLUMN_SCALE, "4") .type(AvroUtils._double()) .withDefault("0") .name("updated") .type(AvroUtils._logicalTimestamp()) .noDefault() .endRecord(); }
@Before public void createSchema() { schema = SchemaBuilder.builder() .record("main") .fields() .name("id") .prop(SchemaConstants.TALEND_COLUMN_IS_KEY, "true") .type(Schema.createUnion(AvroUtils._int(), Schema.create(Schema.Type.NULL))) .withDefault(1) .name("name") .prop(SchemaConstants.TALEND_COLUMN_IS_KEY, "true") .prop(SchemaConstants.TALEND_COLUMN_DB_LENGTH, "255") .prop(SchemaConstants.TALEND_COLUMN_DEFAULT, "\"ok\"") .type(Schema.createUnion(AvroUtils._string(), Schema.create(Schema.Type.NULL))) .noDefault() .name("date") .type(Schema.createUnion(AvroUtils._logicalDate(), Schema.create(Schema.Type.NULL))) .noDefault() .name("salary") .prop(SchemaConstants.TALEND_COLUMN_DB_TYPE, "MY_DOUBLE") .prop(SchemaConstants.TALEND_COLUMN_DB_LENGTH, "38") .prop(SchemaConstants.TALEND_COLUMN_PRECISION, "4") .type(Schema.createUnion(AvroUtils._double(), Schema.create(Schema.Type.NULL))) .withDefault("0") .name("updated") .type(Schema.createUnion(AvroUtils._logicalTimestamp(), Schema.create(Schema.Type.NULL))) .noDefault() .endRecord(); }
.noDefault() .name("date_fld") .type(AvroUtils._logicalDate()) .noDefault() .name("float_fld")