Allow override of requireTimeCondition in query context

This commit is contained in:
Andrew Ho 2024-10-22 15:44:36 -07:00
parent a44006c998
commit 9960fbb786
2 changed files with 7 additions and 1 deletions

View File

@ -39,6 +39,7 @@ public class PlannerConfig
public static final String CTX_KEY_FORCE_EXPRESSION_VIRTUAL_COLUMNS = "forceExpressionVirtualColumns"; public static final String CTX_KEY_FORCE_EXPRESSION_VIRTUAL_COLUMNS = "forceExpressionVirtualColumns";
public static final String CTX_MAX_NUMERIC_IN_FILTERS = "maxNumericInFilters"; public static final String CTX_MAX_NUMERIC_IN_FILTERS = "maxNumericInFilters";
public static final String CTX_NATIVE_QUERY_SQL_PLANNING_MODE = "plannerStrategy"; public static final String CTX_NATIVE_QUERY_SQL_PLANNING_MODE = "plannerStrategy";
public static final String CTX_KEY_REQUIRE_TIME_CONDITION = "requireTimeCondition";
public static final int NUM_FILTER_NOT_USED = -1; public static final int NUM_FILTER_NOT_USED = -1;
@JsonProperty @JsonProperty
@ -386,6 +387,11 @@ public class PlannerConfig
CTX_NATIVE_QUERY_SQL_PLANNING_MODE, CTX_NATIVE_QUERY_SQL_PLANNING_MODE,
nativeQuerySqlPlanningMode nativeQuerySqlPlanningMode
); );
requireTimeCondition = QueryContexts.parseBoolean(
queryContext,
CTX_KEY_REQUIRE_TIME_CONDITION,
requireTimeCondition
);
return this; return this;
} }

View File

@ -44,7 +44,7 @@ export const DatasourcePreviewPane = React.memo(function DatasourcePreviewPane(
try { try {
result = await queryRunner.runQuery({ result = await queryRunner.runQuery({
query: `SELECT * FROM ${T(datasource)}`, query: `SELECT * FROM ${T(datasource)}`,
extraQueryContext: { sqlOuterLimit: 100 }, extraQueryContext: { sqlOuterLimit: 100, requireTimeCondition: false },
cancelToken, cancelToken,
}); });
} catch (e) { } catch (e) {