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));
        }
Example #2
0
 internal OrcSink(string type, object writeBatchSize, object writeBatchTimeout, object sinkRetryCount, object sinkRetryWait, object maxConcurrentConnections, IDictionary <string, object> additionalProperties, StoreWriteSettings storeSettings, OrcWriteSettings formatSettings) : base(type, writeBatchSize, writeBatchTimeout, sinkRetryCount, sinkRetryWait, maxConcurrentConnections, additionalProperties)
 {
     StoreSettings  = storeSettings;
     FormatSettings = formatSettings;
     Type           = type ?? "OrcSink";
 }
Example #3
0
        internal static OrcSink DeserializeOrcSink(JsonElement element)
        {
            Optional <StoreWriteSettings> storeSettings                 = default;
            Optional <OrcWriteSettings>   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 = OrcWriteSettings.DeserializeOrcWriteSettings(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 OrcSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, additionalProperties, storeSettings.Value, formatSettings.Value));
        }