Problem
In a Unity Catalog-enabled workspace, you run the following SQL command in a notebook to apply a SKEW
join hint on a table.
%sql
SELECT /*+ SKEW('<table-name>', '<column-name>', (0, 1)) */
<column1>,
<column2>
FROM <catalog>.<schema>.<table-name>;
The query fails with the following error.
Skew hint: invalid arguments List(<table-name>, <column-name>, named_struct(col1, 0, col2, 1))
Cause
In Unity Catalog-enabled workspaces, the SKEW
hint requires the fully qualified table name, <catalog>.<schema>.<table-name>
.
Providing only the table name is not sufficient. The parser interprets the arguments incorrectly and returns the "invalid arguments"
error.
Solution
Rewrite the query using the fully-qualified Unity Catalog name. The following code rewrites the example from the problem statement to demonstrate.
%sql
SELECT /*+ SKEW('<catalog>.<schema>.<table-name>', '<column-name>', (0, 1)) */
<column1>,
<column2>
FROM <catalog>.<schema>.<table-name>;