class TypeMappingUtils {

	public static void checkPhysicalLogicalTypeCompatible(
			LogicalType physicalFieldType,
			LogicalType logicalFieldType,
			String physicalFieldName,
			String logicalFieldName,
			boolean isSource) {
		if (isSource) {
			checkIfCompatible(
					physicalFieldType,
					logicalFieldType,
					(cause) -> new ValidationException(
								String.format("Type %s of table field '%s' does not match with " +
									"the physical type %s of the '%s' field of the TableSource return type.",
										logicalFieldType,
										logicalFieldName,
										physicalFieldType,
										physicalFieldName),
								cause));
		} else {
			checkIfCompatible(
					logicalFieldType,
					physicalFieldType,
					(cause) -> new ValidationException(
								String.format("Type %s of table field '%s' does not match with " +
									"the physical type %s of the '%s' field of the TableSink consumed type.",
									logicalFieldType,
									logicalFieldName,
									physicalFieldType,
									physicalFieldName),
								cause));
		}
	}

	private  TypeMappingUtils();

}