Class TableConfig

    • Method Detail

      • set

        public <T> TableConfig set​(ConfigOption<T> option,
                                   T value)
        Sets an application-specific value for the given ConfigOption.

        This method should be preferred over set(String, String) as it is type-safe, avoids unnecessary parsing of the value, and provides inline documentation.

        Note: Scala users might need to convert the value into a boxed type. E.g. by using Int.box(1) or Boolean.box(false).

        Specified by:
        set in interface WritableConfig
        Type Parameters:
        T - type of the value to be stored
        Parameters:
        option - metadata information
        value - value to be stored
        Returns:
        instance of this configuration for fluent API
        See Also:
        TableConfigOptions, ExecutionConfigOptions, OptimizerConfigOptions
      • toMap

        @Internal
        public Map<String,​String> toMap()
        Description copied from interface: ReadableConfig
        Converts the configuration items into a map of string key-value pairs.
        Specified by:
        toMap in interface ReadableConfig
        Returns:
        a map containing the configuration properties, where the keys are strings and the values are the corresponding configuration values in string format.
      • getConfiguration

        public Configuration getConfiguration()
        Gives direct access to the underlying application-specific key-value map for advanced configuration.
      • getRootConfiguration

        @Internal
        public ReadableConfig getRootConfiguration()
        Gives direct access to the underlying environment-specific key-value map for advanced configuration.
      • addConfiguration

        public void addConfiguration​(Configuration configuration)
        Adds the given key-value configuration to the underlying application-specific configuration. It overwrites existing keys.
        Parameters:
        configuration - key-value configuration to be added
      • getSqlDialect

        public SqlDialect getSqlDialect()
        Returns the current SQL dialect.
      • setSqlDialect

        public void setSqlDialect​(SqlDialect sqlDialect)
        Sets the current SQL dialect to parse a SQL query. Flink's SQL behavior by default.
      • setLocalTimeZone

        public void setLocalTimeZone​(ZoneId zoneId)
        Sets the current session time zone id. It is used when converting to/from DataTypes.TIMESTAMP_WITH_LOCAL_TIME_ZONE(). Internally, timestamps with local time zone are always represented in the UTC time zone. However, when converting to data types that don't include a time zone (e.g. TIMESTAMP, TIME, or simply STRING), the session time zone is used during conversion.

        Example:

        
         TableConfig config = tEnv.getConfig();
         config.setLocalTimeZone(ZoneOffset.ofHours(2));
         tEnv.executeSql("CREATE TABLE testTable (id BIGINT, tmstmp TIMESTAMP WITH LOCAL TIME ZONE)");
         tEnv.executeSql("INSERT INTO testTable VALUES ((1, '2000-01-01 2:00:00'), (2, TIMESTAMP '2000-01-01 2:00:00'))");
         tEnv.executeSql("SELECT * FROM testTable"); // query with local time zone set to UTC+2
         

        should produce:

         =============================
            id   |       tmstmp
         =============================
            1    | 2000-01-01 2:00:00'
            2    | 2000-01-01 2:00:00'
         

        If we change the local time zone and query the same table:

        
         config.setLocalTimeZone(ZoneOffset.ofHours(0));
         tEnv.executeSql("SELECT * FROM testTable"); // query with local time zone set to UTC+0
         

        we should get:

         =============================
            id   |       tmstmp
         =============================
            1    | 2000-01-01 0:00:00'
            2    | 2000-01-01 0:00:00'
         
        See Also:
        LocalZonedTimestampType
      • getPlannerConfig

        public PlannerConfig getPlannerConfig()
        Returns the current configuration of Planner for Table API and SQL queries.
      • setPlannerConfig

        public void setPlannerConfig​(PlannerConfig plannerConfig)
        Sets the configuration of Planner for Table API and SQL queries. Changing the configuration has no effect after the first query has been defined.
      • getMaxGeneratedCodeLength

        public Integer getMaxGeneratedCodeLength()
        Returns the current threshold where generated code will be split into sub-function calls. Java has a maximum method length of 64 KB. This setting allows for finer granularity if necessary.

        Default value is 4000 instead of 64KB as by default JIT refuses to work on methods with more than 8K byte code.

      • setMaxGeneratedCodeLength

        public void setMaxGeneratedCodeLength​(Integer maxGeneratedCodeLength)
        Sets current threshold where generated code will be split into sub-function calls. Java has a maximum method length of 64 KB. This setting allows for finer granularity if necessary.

        Default value is 4000 instead of 64KB as by default JIT refuses to work on methods with more than 8K byte code.

      • setIdleStateRetentionTime

        @Deprecated
        public void setIdleStateRetentionTime​(Duration minTime,
                                              Duration maxTime)
        Deprecated.
        Specifies a minimum and a maximum time interval for how long idle state, i.e., state which was not updated, will be retained. State will never be cleared until it was idle for less than the minimum time and will never be kept if it was idle for more than the maximum time.

        When new data arrives for previously cleaned-up state, the new data will be handled as if it was the first data. This can result in previous results being overwritten.

        Set to 0 (zero) to never clean-up the state.

        NOTE: Cleaning up state requires additional bookkeeping which becomes less expensive for larger differences of minTime and maxTime. The difference between minTime and maxTime must be at least 5 minutes.

        NOTE: Currently maxTime will be ignored and it will automatically derived from minTime as 1.5 x minTime.

        Parameters:
        minTime - The minimum time interval for which idle state is retained. Set to 0 (zero) to never clean-up the state.
        maxTime - The maximum time interval for which idle state is retained. Must be at least 5 minutes greater than minTime. Set to 0 (zero) to never clean-up the state.
      • setIdleStateRetention

        public void setIdleStateRetention​(Duration duration)
        Specifies a retention time interval for how long idle state, i.e., state which was not updated, will be retained. State will never be cleared until it was idle for less than the retention time and will be cleared on a best effort basis after the retention time.

        When new data arrives for previously cleaned-up state, the new data will be handled as if it was the first data. This can result in previous results being overwritten.

        Set to 0 (zero) to never clean-up the state.

        Parameters:
        duration - The retention time interval for which idle state is retained. Set to 0 (zero) to never clean-up the state.
        See Also:
        StateTtlConfig
      • getMinIdleStateRetentionTime

        @Deprecated
        public long getMinIdleStateRetentionTime()
        Deprecated.
        NOTE: Currently the concept of min/max idle state retention has been deprecated and only idle state retention time is supported. The min idle state retention is regarded as idle state retention and the max idle state retention is derived from idle state retention as 1.5 x idle state retention.
        Returns:
        The minimum time until state which was not updated will be retained.
      • getMaxIdleStateRetentionTime

        @Deprecated
        public long getMaxIdleStateRetentionTime()
        Deprecated.
        NOTE: Currently the concept of min/max idle state retention has been deprecated and only idle state retention time is supported. The min idle state retention is regarded as idle state retention and the max idle state retention is derived from idle state retention as 1.5 x idle state retention.
        Returns:
        The maximum time until state which was not updated will be retained.
      • getIdleStateRetention

        public Duration getIdleStateRetention()
        Returns:
        The duration until state which was not updated will be retained.
      • addJobParameter

        public void addJobParameter​(String key,
                                    String value)
        Sets a custom user parameter that can be accessed via FunctionContext.getJobParameter(String, String).

        This will add an entry to the current value of PipelineOptions.GLOBAL_JOB_PARAMETERS.

        It is also possible to set multiple parameters at once, which will override any previously set parameters:

        
         Map<String, String> params = ...
         TableConfig config = tEnv.getConfig();
         config.set(PipelineOptions.GLOBAL_JOB_PARAMETERS, params);
         
      • setRootConfiguration

        @Internal
        public void setRootConfiguration​(ReadableConfig rootConfiguration)
        Sets the given configuration as rootConfiguration, which contains any configuration set in the execution context. See the docs of TableConfig for more information.
        Parameters:
        rootConfiguration - root configuration to be set