^ I think this is a bug… Given the following mini...
# troubleshooting
h
^ I think this is a bug… Given the following minimal example:
Copy code
from pyflink.datastream import StreamExecutionEnvironment
from pyflink.table import StreamTableEnvironment
from pyflink.common import Row
from pyflink.table import DataTypes
from pyflink.table.udf import udf
from pyflink.table.expressions import call

env = StreamExecutionEnvironment.get_execution_environment()
t_env = StreamTableEnvironment.create(env)

tbl = t_env.from_elements(
    [
        {
            "normal": "value",
            "nested": Row(a=1)
        }
    ],
    schema=DataTypes.ROW([
        DataTypes.FIELD('normal', DataTypes.STRING()),
        DataTypes.FIELD('nested', DataTypes.ROW([
            DataTypes.FIELD('a', DataTypes.INT()),
        ]))
    ])
)

@udf(result_type=DataTypes.ROW([
    DataTypes.FIELD("result_field", DataTypes.STRING()),
]))
def my_udf() -> Row:
    return Row(result_field="test")

tbl = (
    tbl
    .add_columns(call(my_udf).alias('udf_result'))
)

t_env.create_temporary_view('tbl', tbl)
This SQL query works as expected:
Copy code
t_env.sql_query("""
    select
        normal,
        udf_result.result_field as udf_result_field
    from tbl
""").execute().print()
But this fails:
Copy code
t_env.sql_query("""
    select
        nested.a as nested_a,
        udf_result.result_field as udf_result_field
    from tbl
""").execute().print()
with
java.lang.IndexOutOfBoundsException: Index 1 out of bounds for length 1
1.18.0-java17, docker, m1 mac
Same issue with java11 and 1.18.1
So, to be clear: whenever I reference a nested field alongside the nested result of the UDF-> crash. No matter how I treat the data, with a CTE, using flatten, …. Whenever I select both a nested field and a nested UDF field, kaboom. Apart from each other it works fine