def METHOD_NAME(spark, log):
    indexer = JoinBasedIndexerEstimator().fit(log)
    indexed_df = indexer.transform(log)
    # add new user and two new items
    new_log_part = spark.createDataFrame([(100, 1), (100, 2)]).toDF(
        "user_id", "item_id"
    )
    new_log = log.union(new_log_part)
    # check indexing new user-items
    new_indexed_df = indexer.transform(new_log)
    # check that the number of unique users and items remains the same
    assert (
        new_log.select("user_id").distinct().count()
        == new_indexed_df.select("user_idx").distinct().count()
    )
    assert (
        new_log.select("item_id").distinct().count()
        == new_indexed_df.select("item_idx").distinct().count()
    )
    # check that new indexed dataframe contains indexes from previous indexed dataframe
    assert (
        indexed_df.join(new_indexed_df, on=["user_idx", "item_idx"]).count()
        == indexed_df.count()
    )
    assert (
        indexed_df.join(new_indexed_df, on=["user_idx", "item_idx"])
        .distinct()
        .count()
        == indexed_df.distinct().count()
    )
    # check indexing of new elements
    indexed_new_log_part_df = new_indexed_df.join(
        indexed_df, on=["user_idx", "item_idx"], how="left_anti"
    )
    assert (
        indexed_new_log_part_df.select("user_idx").distinct().count()
        == new_log_part.select("user_id").distinct().count()
    )
    assert (
        indexed_new_log_part_df.select("item_idx").distinct().count()
        == new_log_part.select("item_id").distinct().count()
    )