Skip to content

Commit

Permalink
updates/fix style/etc
Browse files Browse the repository at this point in the history
  • Loading branch information
kgyrtkirk committed Jul 30, 2024
1 parent df42245 commit b345dd9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,19 @@
import org.apache.calcite.sql.SqlNode;
import org.apache.druid.guice.annotations.UnstableApi;
import org.apache.druid.sql.calcite.rel.DruidRel;
import org.apache.druid.sql.hook.DruidHookDispatcher;

/**
* Druid-specific version of Calcite's {@link org.apache.calcite.runtime.Hook Hook}
* class. Captures artifacts of interest in the Druid planning process, generally
* for test validation. Calcite's hook has multiple low-level events, but, sadly,
* none at the points where tests want to verify, except for the opportunity to
* capture the native query.
*
* Should be removed ; use {@link DruidHookDispatcher} instead.
*/
@UnstableApi
@Deprecated
public interface PlannerHook
{
void captureSql(String sql);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import com.google.inject.Inject;
import org.apache.druid.guice.LazySingleton;
import org.apache.druid.quidem.DruidConnectionExtras;
import org.apache.druid.sql.calcite.planner.PlannerContext;
import org.apache.druid.sql.hook.DruidHook.HookKey;

Expand All @@ -37,7 +36,7 @@
* A single instance should live in the system and be used to dispatch hooks.
* Usual way to dispatch should be via
* {@link PlannerContext#dispatchHook(HookKey, Object)}. Access to this class is
* also possible thru {@link DruidConnectionExtras}.
* also possible thru DruidConnectionExtras.
*/
@LazySingleton
public class DruidHookDispatcher
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,9 @@ public DruidHookDispatcher getDruidHookDispatcher()

static DruidConnectionExtras unwrapOrThrow(Connection connection)
{
if(connection instanceof DruidConnectionExtras ) {
if (connection instanceof DruidConnectionExtras) {
return (DruidConnectionExtras) connection;
}
throw new UnsupportedOperationException("Expected DruidConnectionExtras to be implemented by connection!");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ protected final void executeExplain(Context x) throws IOException, SQLException
}
}

protected final DruidHookDispatcher unwrapDruidHookDispatcher(Context x) {
protected final DruidHookDispatcher unwrapDruidHookDispatcher(Context x)
{
return DruidConnectionExtras.unwrapOrThrow(x.connection()).getDruidHookDispatcher();
}
}
Expand Down

0 comments on commit b345dd9

Please sign in to comment.