private static void preIngestionQuerying()

in quickstart/src/main/java/com/microsoft/azure/kusto/quickstart/SampleApp.java [380:412]


    private static void preIngestionQuerying(ConfigJson config, Client kustoClient) {
        if (config.isUseExistingTable()) {
            if (config.isAlterTable()) {
                // Tip: Usually table was originally created with a schema appropriate for the data being ingested, so this wouldn't be needed.
                // Learn More: For more information about altering table schemas, see:
                // https://docs.microsoft.com/azure/data-explorer/kusto/management/alter-table-command
                waitForUserToProceed(String.format("Alter-merge existing table '%s.%s' to align with the provided schema", config.getDatabaseName(),
                        config.getTableName()));
                alterMergeExistingTableToProvidedSchema(kustoClient, config.getDatabaseName(), config.getTableName(), config.getTableSchema());
            }
            if (config.isQueryData()) {
                waitForUserToProceed(String.format("Get existing row count in '%s.%s'", config.getDatabaseName(), config.getTableName()));
                queryExistingNumberOfRows(kustoClient, config.getDatabaseName(), config.getTableName());
            }
        } else {
            // Tip: This is generally a one-time configuration
            // Learn More: For more information about creating tables, see: https://docs.microsoft.com/azure/data-explorer/one-click-table
            waitForUserToProceed(String.format("Create table '%s.%s'", config.getDatabaseName(), config.getTableName()));
            createNewTable(kustoClient, config.getDatabaseName(), config.getTableName(), config.getTableSchema());
        }

        // Learn More: Kusto batches data for ingestion efficiency. The default batching policy ingests data when one of the following conditions are met:
        // 1) More than 1,000 files were queued for ingestion for the same table by the same user
        // 2) More than 1GB of data was queued for ingestion for the same table by the same user
        // 3) More than 5 minutes have passed since the first File was queued for ingestion for the same table by the same user
        // For more information about customizing the ingestion batching policy, see:
        // https://docs.microsoft.com/azure/data-explorer/kusto/management/batchingpolicy
        // TODO: Change if needed. Disabled to prevent an existing batching policy from being unintentionally changed
        if (false && config.getBatchingPolicy() != null) {
            waitForUserToProceed(String.format("Alter the batching policy for table '%s.%s'", config.getDatabaseName(), config.getTableName()));
            alterBatchingPolicy(kustoClient, config.getDatabaseName(), config.getTableName(), config.getBatchingPolicy());
        }
    }