tempo icon indicating copy to clipboard operation
tempo copied to clipboard

IntervalsDF initialization method doesn't match description

Open IvoMerchiers opened this issue 2 years ago • 2 comments

The IntervalsDF class talks about a metrics paramater that should be defined, but this is not present in the current api.

If I try to run the example code under disjoint (after replacing the Nulls with None):

df = spark.createDataFrame(
    [["2020-08-01 00:00:10", "2020-08-01 00:00:14", "v1", 5, None],
     ["2020-08-01 00:00:09", "2020-08-01 00:00:11", "v1", None, 0]],
    "start_ts STRING, end_ts STRING, series_1 STRING, metric_1 STRING, metric_2 INT",
)
idf = IntervalsDF(df, "start_ts", "end_ts", ["series_1"], ["metric_1", "metric_2"])
idf.disjoint().df.collect()

I get the following error:

TypeError: __init__() takes from 4 to 5 positional arguments but 6 were given

IvoMerchiers avatar Feb 13 '23 16:02 IvoMerchiers

Thanks for opening this. We made an update to infer the metrics instead of having the user pass them as an argument and missed updating the docs

If you update the call to create idf to the below it should work:

idf = IntervalsDF(df, "start_ts", "end_ts", ["series_1"])

R7L208 avatar Feb 28 '23 21:02 R7L208

I plan to address this as part of the PR for #268

R7L208 avatar Apr 28 '23 19:04 R7L208