Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

By adding targetColumnList information to the DynamicTableSink#Context, this problem can be solved.

Public Interfaces

Add new getTargetColumnList getTargetColumns to DynamicTableSink#Context

Code Block
languagejava
        /**
         * Returns the an array of column index paths related to user specified target column name list or an empty listarray when not specified. The indices
         * are 0-based and support composite columns within (possibly nested) structures.          
         *
         * <p>This information comes from the column list of the DML clause, e.g., for a sink table schema: {@code a STRING, b ROW < b1 INT, 
		 * b2 STRING, b3 ROW <b31 INT, b32 STRING > >, c BIGINT}
         *
         * <ul>
         *   <li>insert: 'insert into target(a, b.b1, cb.b3.b31) ...', the column list will be 'a, b, c'. the, and will return {@code [[0], [1, 0], [1, 2, 0]]}. The
         *       column list will be empty for 'insert into target select ...'.
         *   <li>update: 'update target set a=1, b.b1=2 where ...', the column list will be 'a, b', will return {@code [[0], [1, 0]]}.
         * </ul>
         *
         * <p>Note: the column list will always bereturn empty array infor thea delete clause because it has no column list.
         */
        List<String> getTargetColumnListint[][] getTargetColumns();


Proposed Changes

The internal SinkRuntimeProviderContext will support new constructor with targetColumnList param, this can be used by connectors to recognize the user-specified column list.

...