Hi Chang, I think the TableEnvironment is not designed to be used by multiple threads. If you want to share state between the different instances, then you have to either duplicate this information or put a synchronization mechanism into place (e.g. by creating a thread safe CatalogManager or synchronizing on the TableEnvironment accesses).
Cheers, Till On Tue, Jan 18, 2022 at 5:14 PM Chang Chen <[email protected]> wrote: > Thanks Till. > > If so, how does Flink share Catalog data between threads? I didn't find > any synchronized codes in CatalogManager. Does it mean we can only share > catalogs through an external hive meta store? > > BR > - Chang > > > Till Rohrmann <[email protected]> 于2022年1月17日周一 17:26写道: > > > Hi Chang, > > > > Yes, I think this would make most sense to do. > > > > Cheers, > > Till > > > > On Mon, Jan 17, 2022 at 9:13 AM Chang Chen <[email protected]> wrote: > > > > > IIUC, TableEnvironment isn't thread-safe, since it contains some > internal > > > states, for example, PlannerContext that has RelOptCluster used to > > optimize > > > SQL. > > > > > > So do I create a TableEnvironment per thread? > > > > > >
