/** * Returns a boolean value under the given existing key. */ public boolean getBoolean(String key) { return getOptionalBoolean(key).orElseThrow(exceptionSupplier(key)); }
@Override public DeserializationSchema<Row> createDeserializationSchema(Map<String, String> properties) { final DescriptorProperties descriptorProperties = getValidatedProperties(properties); // create and configure final JsonRowDeserializationSchema schema = new JsonRowDeserializationSchema(createTypeInformation(descriptorProperties)); descriptorProperties.getOptionalBoolean(JsonValidator.FORMAT_FAIL_ON_MISSING_FIELD) .ifPresent(schema::setFailOnMissingField); return schema; }
private Map<SinkOption, String> getSinkOptions(DescriptorProperties descriptorProperties) { final Map<SinkOption, String> options = new HashMap<>(); descriptorProperties.getOptionalBoolean(CONNECTOR_FLUSH_ON_CHECKPOINT) .ifPresent(v -> options.put(SinkOption.DISABLE_FLUSH_ON_CHECKPOINT, String.valueOf(!v)));
@Override public void validate(DescriptorProperties properties) { super.validate(properties); properties.validateBoolean(FORMAT_DERIVE_SCHEMA, true); final boolean deriveSchema = properties.getOptionalBoolean(FORMAT_DERIVE_SCHEMA).orElse(false); final boolean hasSchema = properties.containsKey(FORMAT_SCHEMA); final boolean hasSchemaString = properties.containsKey(FORMAT_JSON_SCHEMA); if (deriveSchema && (hasSchema || hasSchemaString)) { throw new ValidationException( "Format cannot define a schema and derive from the table's schema at the same time."); } else if (!deriveSchema && hasSchema && hasSchemaString) { throw new ValidationException("A definition of both a schema and JSON schema is not allowed."); } else if (!deriveSchema && !hasSchema && !hasSchemaString) { throw new ValidationException("A definition of a schema or JSON schema is required."); } else if (hasSchema) { properties.validateType(FORMAT_SCHEMA, false, true); } else if (hasSchemaString) { properties.validateString(FORMAT_JSON_SCHEMA, false, 1); } properties.validateBoolean(FORMAT_FAIL_ON_MISSING_FIELD, true); } }
.getOptionalBoolean(SCHEMA + '.' + i + '.' + SCHEMA_PROCTIME) .orElse(false); final String timestampKey = SCHEMA + '.' + i + '.' + ROWTIME_TIMESTAMPS_TYPE;
/** * Returns a boolean value under the given existing key. */ public boolean getBoolean(String key) { return getOptionalBoolean(key).orElseThrow(exceptionSupplier(key)); }
/** * Returns a boolean value under the given existing key. */ public boolean getBoolean(String key) { return getOptionalBoolean(key).orElseThrow(exceptionSupplier(key)); }
@Override public DeserializationSchema<Row> createDeserializationSchema(Map<String, String> properties) { final DescriptorProperties descriptorProperties = getValidatedProperties(properties); // create and configure final JsonRowDeserializationSchema schema = new JsonRowDeserializationSchema(createTypeInformation(descriptorProperties)); descriptorProperties.getOptionalBoolean(JsonValidator.FORMAT_FAIL_ON_MISSING_FIELD) .ifPresent(schema::setFailOnMissingField); return schema; }
@Override public DeserializationSchema<Row> createDeserializationSchema(Map<String, String> properties) { final DescriptorProperties descriptorProperties = getValidatedProperties(properties); // create and configure final JsonRowDeserializationSchema schema = new JsonRowDeserializationSchema(createTypeInformation(descriptorProperties)); descriptorProperties.getOptionalBoolean(JsonValidator.FORMAT_FAIL_ON_MISSING_FIELD) .ifPresent(schema::setFailOnMissingField); return schema; }
private Map<SinkOption, String> getSinkOptions(DescriptorProperties descriptorProperties) { final Map<SinkOption, String> options = new HashMap<>(); descriptorProperties.getOptionalBoolean(CONNECTOR_FLUSH_ON_CHECKPOINT) .ifPresent(v -> options.put(SinkOption.DISABLE_FLUSH_ON_CHECKPOINT, String.valueOf(!v)));
private Map<SinkOption, String> getSinkOptions(DescriptorProperties descriptorProperties) { final Map<SinkOption, String> options = new HashMap<>(); descriptorProperties.getOptionalBoolean(CONNECTOR_FLUSH_ON_CHECKPOINT) .ifPresent(v -> options.put(SinkOption.DISABLE_FLUSH_ON_CHECKPOINT, String.valueOf(!v)));
@Override public void validate(DescriptorProperties properties) { super.validate(properties); properties.validateBoolean(FORMAT_DERIVE_SCHEMA, true); final boolean deriveSchema = properties.getOptionalBoolean(FORMAT_DERIVE_SCHEMA).orElse(false); final boolean hasSchema = properties.containsKey(FORMAT_SCHEMA); final boolean hasSchemaString = properties.containsKey(FORMAT_JSON_SCHEMA); if (deriveSchema && (hasSchema || hasSchemaString)) { throw new ValidationException( "Format cannot define a schema and derive from the table's schema at the same time."); } else if (!deriveSchema && hasSchema && hasSchemaString) { throw new ValidationException("A definition of both a schema and JSON schema is not allowed."); } else if (!deriveSchema && !hasSchema && !hasSchemaString) { throw new ValidationException("A definition of a schema or JSON schema is required."); } else if (hasSchema) { properties.validateType(FORMAT_SCHEMA, false, true); } else if (hasSchemaString) { properties.validateString(FORMAT_JSON_SCHEMA, false, 1); } properties.validateBoolean(FORMAT_FAIL_ON_MISSING_FIELD, true); } }
@Override public void validate(DescriptorProperties properties) { super.validate(properties); properties.validateBoolean(FORMAT_DERIVE_SCHEMA, true); final boolean deriveSchema = properties.getOptionalBoolean(FORMAT_DERIVE_SCHEMA).orElse(false); final boolean hasSchema = properties.containsKey(FORMAT_SCHEMA); final boolean hasSchemaString = properties.containsKey(FORMAT_JSON_SCHEMA); if (deriveSchema && (hasSchema || hasSchemaString)) { throw new ValidationException( "Format cannot define a schema and derive from the table's schema at the same time."); } else if (!deriveSchema && hasSchema && hasSchemaString) { throw new ValidationException("A definition of both a schema and JSON schema is not allowed."); } else if (!deriveSchema && !hasSchema && !hasSchemaString) { throw new ValidationException("A definition of a schema or JSON schema is required."); } else if (hasSchema) { properties.validateType(FORMAT_SCHEMA, false, true); } else if (hasSchemaString) { properties.validateString(FORMAT_JSON_SCHEMA, false, 1); } properties.validateBoolean(FORMAT_FAIL_ON_MISSING_FIELD, true); } }
.getOptionalBoolean(SCHEMA + '.' + i + '.' + SCHEMA_PROCTIME) .orElse(false); final String timestampKey = SCHEMA + '.' + i + '.' + ROWTIME_TIMESTAMPS_TYPE;
.getOptionalBoolean(SCHEMA + '.' + i + '.' + SCHEMA_PROCTIME) .orElse(false); final String timestampKey = SCHEMA + '.' + i + '.' + ROWTIME_TIMESTAMPS_TYPE;