org.apache.flink.table.sources.tsextractors.TimestampExtractor Java Examples
The following examples show how to use
org.apache.flink.table.sources.tsextractors.TimestampExtractor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SchemaValidator.java From flink with Apache License 2.0 | 6 votes |
/** * Finds the rowtime attributes if defined. */ public static List<RowtimeAttributeDescriptor> deriveRowtimeAttributes( DescriptorProperties properties) { Map<String, String> names = properties.getIndexedProperty(SCHEMA, SCHEMA_NAME); List<RowtimeAttributeDescriptor> attributes = new ArrayList<>(); // check for rowtime in every field for (int i = 0; i < names.size(); i++) { Optional<Tuple2<TimestampExtractor, WatermarkStrategy>> rowtimeComponents = RowtimeValidator .getRowtimeComponents(properties, SCHEMA + "." + i + "."); int index = i; // create descriptor rowtimeComponents.ifPresent(tuple2 -> attributes.add(new RowtimeAttributeDescriptor( properties.getString(SCHEMA + "." + index + "." + SCHEMA_NAME), tuple2.f0, tuple2.f1)) ); } return attributes; }
Example #2
Source File: SchemaValidator.java From flink with Apache License 2.0 | 6 votes |
/** * Finds the rowtime attributes if defined. */ public static List<RowtimeAttributeDescriptor> deriveRowtimeAttributes( DescriptorProperties properties) { Map<String, String> names = properties.getIndexedProperty(SCHEMA, SCHEMA_NAME); List<RowtimeAttributeDescriptor> attributes = new ArrayList<>(); // check for rowtime in every field for (int i = 0; i < names.size(); i++) { Optional<Tuple2<TimestampExtractor, WatermarkStrategy>> rowtimeComponents = RowtimeValidator .getRowtimeComponents(properties, SCHEMA + "." + i + "."); int index = i; // create descriptor rowtimeComponents.ifPresent(tuple2 -> attributes.add(new RowtimeAttributeDescriptor( properties.getString(SCHEMA + "." + index + "." + SCHEMA_NAME), tuple2.f0, tuple2.f1)) ); } return attributes; }
Example #3
Source File: RowtimeAttributeDescriptor.java From flink with Apache License 2.0 | 5 votes |
public RowtimeAttributeDescriptor( String attributeName, TimestampExtractor timestampExtractor, WatermarkStrategy watermarkStrategy) { this.attributeName = attributeName; this.timestampExtractor = timestampExtractor; this.watermarkStrategy = watermarkStrategy; }
Example #4
Source File: Timestamps.java From alchemy with Apache License 2.0 | 5 votes |
public TimestampExtractor get(){ if(type == null){ return null; } if(type.equals(Type.FIELD.getType())){ return new ExistingField(from); }else if(type.equals(Type.SOURCE.getType())){ return new StreamRecordTimestamp(); } return null; }
Example #5
Source File: RowtimeAttributeDescriptor.java From flink with Apache License 2.0 | 5 votes |
public RowtimeAttributeDescriptor( String attributeName, TimestampExtractor timestampExtractor, WatermarkStrategy watermarkStrategy) { this.attributeName = attributeName; this.timestampExtractor = timestampExtractor; this.watermarkStrategy = watermarkStrategy; }
Example #6
Source File: TableSourceValidation.java From flink with Apache License 2.0 | 5 votes |
private static void validateTimestampExtractorArguments( List<RowtimeAttributeDescriptor> descriptors, TableSource<?> tableSource) { if (descriptors.size() == 1) { TimestampExtractor extractor = descriptors.get(0).getTimestampExtractor(); TypeInformation<?>[] types = Arrays.stream(TimestampExtractorUtils.getAccessedFields( extractor, tableSource.getProducedDataType(), getNameMappingFunction(tableSource) )).map(ResolvedFieldReference::resultType) .toArray(TypeInformation<?>[]::new); extractor.validateArgumentFields(types); } }
Example #7
Source File: RowtimeAttributeDescriptor.java From flink with Apache License 2.0 | 4 votes |
/** Returns the [[TimestampExtractor]] for the attribute. */ public TimestampExtractor getTimestampExtractor() { return timestampExtractor; }
Example #8
Source File: RowtimeAttributeDescriptor.java From flink with Apache License 2.0 | 4 votes |
/** Returns the [[TimestampExtractor]] for the attribute. */ public TimestampExtractor getTimestampExtractor() { return timestampExtractor; }
Example #9
Source File: Rowtime.java From flink with Apache License 2.0 | 2 votes |
/** * Sets a custom timestamp extractor to be used for the rowtime attribute. * * @param extractor The {@link TimestampExtractor} to extract the rowtime attribute * from the physical type. */ public Rowtime timestampsFromExtractor(TimestampExtractor extractor) { internalProperties.putProperties(extractor.toProperties()); return this; }
Example #10
Source File: Rowtime.java From flink with Apache License 2.0 | 2 votes |
/** * Sets a custom timestamp extractor to be used for the rowtime attribute. * * @param extractor The {@link TimestampExtractor} to extract the rowtime attribute * from the physical type. */ public Rowtime timestampsFromExtractor(TimestampExtractor extractor) { internalProperties.putProperties(extractor.toProperties()); return this; }