Dynamic SQL Hints

SQL hints are supported for SQL Stream Builder (SSB) that allows you to use the dynamic table options. With the dynamic table options, you can alter any option of a table on a query level.

The dynamic table options of Flink SQL allows you to specify and override options for a table in a SQL query. The hint is formatted as a SQL comment containing an OPTIONS() clause, for example:
/*+ OPTIONS(‘key1’=’value1’, ‘key2’=’value2’) */

You need to place the clause directly afte the table name where you need to change the options. You can use separate clauses for separate tables within a SQL query.

For example, you can use the following SQL hint to dynamically configure a Kafka consumer group at run time:
SELECT t1.column_a, t2.column_b
FROM tableName_A /*+ OPTIONS(‘properties.group.id’=’my_consumer_group’) */ AS t1
JOIN tableName_B /*+ OPTIONS(‘properties.group.id’=’my_other_consumer_group’) */ AS t2
ON t1.column_a = t2.column_b

Any option of a table that is accessible in the DDL of a connector can be overridden using the SQL hints. The options of a connector can be viewed on the Connector page of Streaming SQL Console.

For more information about the SQL Hints, see the official Apache Flink documentation.