public boolean shouldUseQueuedIngestion()

in ingest/src/main/java/com/microsoft/azure/kusto/ingest/ManagedStreamingQueuingPolicy.java [26:58]


    public boolean shouldUseQueuedIngestion(long dataSize, boolean compressed, IngestionProperties.DataFormat dataFormat) {
        // In case available() was implemented wrong, do streaming
        if (dataSize <= 0) {
            return false;
        }

        // In any case - don't stream more than 10mb
        if (dataSize > factor * MAX_STREAMING_STREAM_SIZE_BYTES) {
            return true;
        }

        if (!dataFormat.isCompressible()) {
            // Binary format
            if (compressed) {
                return (dataSize * BINARY_COMPRESSED_FACTOR) > factor * MAX_STREAMING_UNCOMPRESSED_RAW_SIZE_BYTES;
            }

            return (dataSize * BINARY_UNCOMPRESSED_FACTOR) > factor * MAX_STREAMING_UNCOMPRESSED_RAW_SIZE_BYTES;
        }

        if (compressed) {
            // Compressed + non-binary
            return (dataSize * NON_BINARY_FACTOR) > factor * MAX_STREAMING_UNCOMPRESSED_RAW_SIZE_BYTES;
        }

        if (dataFormat.isJsonFormat()) {
            // JSON uncompressed format
            return (dataSize / JSON_UNCOMPRESSED_FACTOR) > factor * MAX_STREAMING_UNCOMPRESSED_RAW_SIZE_BYTES;
        }

        // Uncompressed + non-binary
        return ((double) dataSize / NON_BINARY_FACTOR) > factor * MAX_STREAMING_UNCOMPRESSED_RAW_SIZE_BYTES;
    }