/** * Validates a field of the schema to be the processing time attribute. * * @param proctimeAttribute The name of the field that becomes the processing time field. */ private Optional<String> validateProctimeAttribute(Optional<String> proctimeAttribute) { return proctimeAttribute.map((attribute) -> { // validate that field exists and is of correct type Optional<TypeInformation<?>> tpe = schema.getFieldType(attribute); if (!tpe.isPresent()) { throw new ValidationException("Processing time attribute '" + attribute + "' is not present in TableSchema."); } else if (tpe.get() != Types.SQL_TIMESTAMP()) { throw new ValidationException("Processing time attribute '" + attribute + "' is not of type SQL_TIMESTAMP."); } return attribute; }); }
/** * Validates a list of fields to be rowtime attributes. * * @param rowtimeAttributeDescriptors The descriptors of the rowtime attributes. */ private List<RowtimeAttributeDescriptor> validateRowtimeAttributeDescriptors(List<RowtimeAttributeDescriptor> rowtimeAttributeDescriptors) { Preconditions.checkNotNull(rowtimeAttributeDescriptors, "List of rowtime attributes must not be null."); // validate that all declared fields exist and are of correct type for (RowtimeAttributeDescriptor desc : rowtimeAttributeDescriptors) { String rowtimeAttribute = desc.getAttributeName(); Optional<TypeInformation<?>> tpe = schema.getFieldType(rowtimeAttribute); if (!tpe.isPresent()) { throw new ValidationException("Rowtime attribute '" + rowtimeAttribute + "' is not present in TableSchema."); } else if (tpe.get() != Types.SQL_TIMESTAMP()) { throw new ValidationException("Rowtime attribute '" + rowtimeAttribute + "' is not of type SQL_TIMESTAMP."); } } return rowtimeAttributeDescriptors; }
/** * Validates a field of the schema to be the processing time attribute. * * @param proctimeAttribute The name of the field that becomes the processing time field. */ private Optional<String> validateProctimeAttribute(Optional<String> proctimeAttribute) { return proctimeAttribute.map((attribute) -> { // validate that field exists and is of correct type Optional<TypeInformation<?>> tpe = schema.getFieldType(attribute); if (!tpe.isPresent()) { throw new ValidationException("Processing time attribute '" + attribute + "' is not present in TableSchema."); } else if (tpe.get() != Types.SQL_TIMESTAMP()) { throw new ValidationException("Processing time attribute '" + attribute + "' is not of type SQL_TIMESTAMP."); } return attribute; }); }
/** * Validates a field of the schema to be the processing time attribute. * * @param proctimeAttribute The name of the field that becomes the processing time field. */ private Optional<String> validateProctimeAttribute(Optional<String> proctimeAttribute) { return proctimeAttribute.map((attribute) -> { // validate that field exists and is of correct type Optional<TypeInformation<?>> tpe = schema.getFieldType(attribute); if (!tpe.isPresent()) { throw new ValidationException("Processing time attribute '" + attribute + "' is not present in TableSchema."); } else if (tpe.get() != Types.SQL_TIMESTAMP()) { throw new ValidationException("Processing time attribute '" + attribute + "' is not of type SQL_TIMESTAMP."); } return attribute; }); }
/** * Validates a list of fields to be rowtime attributes. * * @param rowtimeAttributeDescriptors The descriptors of the rowtime attributes. */ private List<RowtimeAttributeDescriptor> validateRowtimeAttributeDescriptors(List<RowtimeAttributeDescriptor> rowtimeAttributeDescriptors) { Preconditions.checkNotNull(rowtimeAttributeDescriptors, "List of rowtime attributes must not be null."); // validate that all declared fields exist and are of correct type for (RowtimeAttributeDescriptor desc : rowtimeAttributeDescriptors) { String rowtimeAttribute = desc.getAttributeName(); Optional<TypeInformation<?>> tpe = schema.getFieldType(rowtimeAttribute); if (!tpe.isPresent()) { throw new ValidationException("Rowtime attribute '" + rowtimeAttribute + "' is not present in TableSchema."); } else if (tpe.get() != Types.SQL_TIMESTAMP()) { throw new ValidationException("Rowtime attribute '" + rowtimeAttribute + "' is not of type SQL_TIMESTAMP."); } } return rowtimeAttributeDescriptors; }
/** * Validates a list of fields to be rowtime attributes. * * @param rowtimeAttributeDescriptors The descriptors of the rowtime attributes. */ private List<RowtimeAttributeDescriptor> validateRowtimeAttributeDescriptors(List<RowtimeAttributeDescriptor> rowtimeAttributeDescriptors) { Preconditions.checkNotNull(rowtimeAttributeDescriptors, "List of rowtime attributes must not be null."); // validate that all declared fields exist and are of correct type for (RowtimeAttributeDescriptor desc : rowtimeAttributeDescriptors) { String rowtimeAttribute = desc.getAttributeName(); Optional<TypeInformation<?>> tpe = schema.getFieldType(rowtimeAttribute); if (!tpe.isPresent()) { throw new ValidationException("Rowtime attribute '" + rowtimeAttribute + "' is not present in TableSchema."); } else if (tpe.get() != Types.SQL_TIMESTAMP()) { throw new ValidationException("Rowtime attribute '" + rowtimeAttribute + "' is not of type SQL_TIMESTAMP."); } } return rowtimeAttributeDescriptors; }