Dennis, Looking at the code I think the SQL2REL_CONVERTER_CONFIG_BUILDER hook might be the best way to add hints for use via sql. Even though the documentation says hooks should be used for debugging/testing I think practically they are needed to accomplish tasks from adapters for eg the cassasandra adapter adds materialized views using hooks https://github.com/apache/calcite/blob/b9c2099ea92a575084b55a206efc5dd341c0df62/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraSchema.java#L106 You could do something similar by calling the hook from your adapter.
-Thomas On Fri, Oct 14, 2022 at 4:16 AM <[email protected]> wrote: > Hello Thomas, > > Thank you for your answer. > > I already register the hint strategies as in KuduQuery.java#L88. However, > no hints are visible until I surround the JDBC call with a > SqlToRelConverter hook, just like in my first email. > > I looked at Kudu's test suite and discovered that kudu also sets the hint > strategies "outside" of the JDBC call. > > https://urldefense.com/v3/__https://github.com/twilio/calcite-kudu/blob/84c13e80f7cff83f3acaf5be4fc312c977e18ee8/adapter/src/test/java/com/twilio/kudu/sql/ScenarioIT.java*L100__;Iw!!NCc8flgU!fX_K2Zv5tPpkNE4AmilrzWSG4tzp_O3Pm53KD2uPJ-VdlN3KSdkuffrAHahatF6i4r7gq5E-EzRE9oJ2YKXAZQ$ > (There is this comment: // TODO figure out a better way to set the > HintStrategyTable for sql queries) > > I assume that the hints are lost during the sql2rel conversion because the > hint strategies are not yet set in the SqlToRelConverter config. I guess it > all boils down to the question: Can I initialize the SqlToRelConverter > config with hint strategies somewhere in my adapter before the sql2rel > conversion starts? > > Regards > Dennis > > >
