Hi, I'm having trouble doing an interval join on t...
# troubleshooting
a
Hi, I'm having trouble doing an interval join on the data produced by a window aggregation. Here's the code:
Copy code
table_agg = table.window(
        Tumble.over(lit(1).hour).on(col("ts")).alias("w")
    ).group_by(col("w"), col("name")).select(
        col("w").end.alias("time_close"),
        col("name"),
        col("weight").avg.alias("weight_avg"))
    )
    t_env.create_temporary_view("TABLE_WEIGHT_AVG", table_agg)

   t_env.execute_sql(f"""
        CREATE TEMPORARY VIEW TABLE_INTERVAL_JOIN AS
        SELECT
            w.time_close,        
            w.name,
            w.weight_avg,
            c.avg_cals
        FROM TABLE_WEIGHT_AVG w, TABLE_CALS c
            WHERE w.time_close = c.time_close
    """)
This leads to the following exception:
Copy code
java.lang.AssertionError: Conversion to relational algebra failed to preserve datatypes:
validated type:
RecordType(TIMESTAMP(3) time_close, VARCHAR(2147483647) CHARACTER SET "UTF-16LE" name, FLOAT weight_avg, FLOAT avg_cals) NOT NULL
converted type:
RecordType(TIMESTAMP(3) NOT NULL time_close, VARCHAR(2147483647) CHARACTER SET "UTF-16LE" anem, FLOAT weight_avg, FLOAT avg_cals) NOT NULL
How can I reconcile the problem of NULL vs NOT NULL on time_close. Thanks a lot for the help!
m
Looking at the error, you have both
name
and
anem
in the error message. Are you sure it's the NULL vs NOT NULL?