Hey all - is it expected that `collect`ing `TIMEST...
# pyflink
m
Hey all - is it expected that `collect`ing
TIMESTAMP_LTZ
values does not work with PyFlink? I have the following where I create a table with a single
TIMESTAMP_LTZ
column, insert a value into it and try to select it back out:
Copy code
from pyflink.table import TableEnvironment, EnvironmentSettings, DataTypes, Row
from pyflink.table.expressions import col
from datetime import datetime

settings = EnvironmentSettings.in_streaming_mode()
env = TableEnvironment.create(settings)

env.execute_sql(
    """
CREATE TABLE MyTable (
    a TIMESTAMP_LTZ(3)
) WITH (
    'connector' = 'filesystem',
    'path' = 'file:////path/to/file',
    'format' = 'json'
)
"""
)

env.from_elements(
    [Row(datetime.now())],
    DataTypes.ROW([DataTypes.FIELD("a", DataTypes.TIMESTAMP_LTZ(3))]),
).execute_insert("MyTable")

result = env.from_path("MyTable").select(col("a")).limit(1).execute().collect()
result_list = list(result)
This raises an exception
Copy code
py4j.protocol.Py4JJavaError: An error occurred while calling z:org.apache.flink.api.common.python.PythonBridgeUtils.getPickledBytesFromRow.
: org.apache.flink.api.python.shaded.net.razorvine.pickle.PickleException: couldn't introspect javabean: java.lang.IllegalArgumentException: wrong number of arguments
	at org.apache.flink.api.python.shaded.net.razorvine.pickle.Pickler.put_javabean(Pickler.java:727)
	at org.apache.flink.api.python.shaded.net.razorvine.pickle.Pickler.dispatch(Pickler.java:328)
	at org.apache.flink.api.python.shaded.net.razorvine.pickle.Pickler.save(Pickler.java:141)
	at org.apache.flink.api.python.shaded.net.razorvine.pickle.Pickler.dump(Pickler.java:111)
	at org.apache.flink.api.python.shaded.net.razorvine.pickle.Pickler.dumps(Pickler.java:96)
	at org.apache.flink.api.common.python.PythonBridgeUtils.getPickledBytesFromJavaObject(PythonBridgeUtils.java:236)
The record is fine in the underlying filesystem table. This doesnt happen if the column type is just a
TIMESTAMP
. I couldnt see anything in the docs that suggests this isnt a supported collection type
@Dian Fu Perhaps you might have some insight here? Is this an expected (if a little hard to read) exception?
In
PythonBridgeUtils.getPickledBytesFromJavaObject
, `LocalZonedTimestampType`s arent supported so it just attempts to dump the
Instant
object, rather than converting it into a
java.sql.Timestamp
like it does for `TimestampType`s.
d
@Mika Naylor Hey, this is unexpected. Your analysis makes much sense for me.πŸ‘
g
mind sharing your json file. keen to try this myself. dont see you setting catalog, assume you just testing the MyTable connect and being able to select from table pointing at a json file on the FS...
m
My JSON file just looks like:
Copy code
{
  "a": "2025-09-23 15:22:45.808Z"
}
πŸ‘ 1
But this also occurs with the
datagen
connector too