Skip to content

Commit

Permalink
[feature][dingo-executor] Support text search with hint
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaoyuan2024 authored and guojn1 committed Oct 12, 2024
1 parent 037389d commit a2dd9a7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,9 @@ public RelRoot convert(@NonNull SqlNode sqlNode, boolean needsValidation) {
HintStrategyTable hintStrategyTable = new HintStrategyTable.Builder()
.hintStrategy("vector_pre", hintPredicate)
.hintStrategy(HybridSearchTable.HINT_NAME, hintPredicate)
.hintStrategy("disable_index", hintPredicate).build();
.hintStrategy("disable_index", hintPredicate)
.hintStrategy("document_pre", hintPredicate)
.build();
SqlToRelConverter sqlToRelConverter = new DingoSqlToRelConverter(
ViewExpanders.simpleContext(cluster),
sqlValidator,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
import io.dingodb.calcite.DingoTable;
import io.dingodb.calcite.grammar.SqlUserDefinedOperators;
import io.dingodb.calcite.rel.LogicalDingoDocument;
import io.dingodb.common.table.HybridSearchTable;
import io.dingodb.common.type.TupleMapping;
import org.apache.calcite.plan.RelOptRuleCall;
import org.apache.calcite.plan.RelRule;
import org.apache.calcite.rel.hint.RelHint;
import org.apache.calcite.rel.logical.LogicalProject;
import org.apache.calcite.rel.rules.SubstitutionRule;
import org.apache.calcite.rex.RexCall;
Expand Down Expand Up @@ -92,6 +94,15 @@ select id, distance from xx where not in (sub item size > 20) -> generate same
selectedColumns.sort(Comparator.naturalOrder());
Mapping mapping = Mappings.target(selectedColumns, document.getRowType().getFieldCount());

List<RelHint> hints = document.hints;
if (project.getHints() != null) {
for (RelHint hint: project.getHints()) {
if (hint.hintName.equalsIgnoreCase(HybridSearchTable.HINT_NAME)) {
hints.add(hint);
}
}
}

LogicalDingoDocument newDocument = new LogicalDingoDocument(
document.getCluster(),
document.getTraitSet(),
Expand Down

0 comments on commit a2dd9a7

Please sign in to comment.