internal static FormatWriteSettings DeserializeFormatWriteSettings(JsonElement element) { if (element.TryGetProperty("type", out JsonElement discriminator)) { switch (discriminator.GetString()) { case "AvroWriteSettings": return(AvroWriteSettings.DeserializeAvroWriteSettings(element)); case "JsonWriteSettings": return(JsonWriteSettings.DeserializeJsonWriteSettings(element)); case "OrcWriteSettings": return(OrcWriteSettings.DeserializeOrcWriteSettings(element)); case "ParquetWriteSettings": return(ParquetWriteSettings.DeserializeParquetWriteSettings(element)); case "DelimitedTextWriteSettings": return(DelimitedTextWriteSettings.DeserializeDelimitedTextWriteSettings(element)); } } string type = default; IDictionary <string, object> additionalProperties = default; Dictionary <string, object> additionalPropertiesDictionary = new Dictionary <string, object>(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } additionalProperties = additionalPropertiesDictionary; return(new FormatWriteSettings(type, additionalProperties)); }
internal ParquetSink(string type, object writeBatchSize, object writeBatchTimeout, object sinkRetryCount, object sinkRetryWait, object maxConcurrentConnections, IDictionary <string, object> additionalProperties, StoreWriteSettings storeSettings, ParquetWriteSettings formatSettings) : base(type, writeBatchSize, writeBatchTimeout, sinkRetryCount, sinkRetryWait, maxConcurrentConnections, additionalProperties) { StoreSettings = storeSettings; FormatSettings = formatSettings; Type = type ?? "ParquetSink"; }
internal static ParquetSink DeserializeParquetSink(JsonElement element) { Optional <StoreWriteSettings> storeSettings = default; Optional <ParquetWriteSettings> formatSettings = default; string type = default; Optional <object> writeBatchSize = default; Optional <object> writeBatchTimeout = default; Optional <object> sinkRetryCount = default; Optional <object> sinkRetryWait = default; Optional <object> maxConcurrentConnections = default; IDictionary <string, object> additionalProperties = default; Dictionary <string, object> additionalPropertiesDictionary = new Dictionary <string, object>(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("storeSettings")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } storeSettings = StoreWriteSettings.DeserializeStoreWriteSettings(property.Value); continue; } if (property.NameEquals("formatSettings")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } formatSettings = ParquetWriteSettings.DeserializeParquetWriteSettings(property.Value); continue; } if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("writeBatchSize")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } writeBatchSize = property.Value.GetObject(); continue; } if (property.NameEquals("writeBatchTimeout")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } writeBatchTimeout = property.Value.GetObject(); continue; } if (property.NameEquals("sinkRetryCount")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } sinkRetryCount = property.Value.GetObject(); continue; } if (property.NameEquals("sinkRetryWait")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } sinkRetryWait = property.Value.GetObject(); continue; } if (property.NameEquals("maxConcurrentConnections")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } maxConcurrentConnections = property.Value.GetObject(); continue; } additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } additionalProperties = additionalPropertiesDictionary; return(new ParquetSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, additionalProperties, storeSettings.Value, formatSettings.Value)); }