From 9960fbb786eab8640d399bc3e36e0c444082123d Mon Sep 17 00:00:00 2001 From: Andrew Ho Date: Tue, 22 Oct 2024 15:44:36 -0700 Subject: [PATCH] Allow override of requireTimeCondition in query context --- .../org/apache/druid/sql/calcite/planner/PlannerConfig.java | 6 ++++++ .../datasource-preview-pane/datasource-preview-pane.tsx | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/planner/PlannerConfig.java b/sql/src/main/java/org/apache/druid/sql/calcite/planner/PlannerConfig.java index 6e2e6685a08b..01cf8954905c 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/planner/PlannerConfig.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/planner/PlannerConfig.java @@ -39,6 +39,7 @@ public class PlannerConfig 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_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; @JsonProperty @@ -386,6 +387,11 @@ public Builder withOverrides(final Map queryContext) CTX_NATIVE_QUERY_SQL_PLANNING_MODE, nativeQuerySqlPlanningMode ); + requireTimeCondition = QueryContexts.parseBoolean( + queryContext, + CTX_KEY_REQUIRE_TIME_CONDITION, + requireTimeCondition + ); return this; } diff --git a/web-console/src/dialogs/datasource-table-action-dialog/datasource-preview-pane/datasource-preview-pane.tsx b/web-console/src/dialogs/datasource-table-action-dialog/datasource-preview-pane/datasource-preview-pane.tsx index 1ca92787c1cb..1a25f5c487bf 100644 --- a/web-console/src/dialogs/datasource-table-action-dialog/datasource-preview-pane/datasource-preview-pane.tsx +++ b/web-console/src/dialogs/datasource-table-action-dialog/datasource-preview-pane/datasource-preview-pane.tsx @@ -44,7 +44,7 @@ export const DatasourcePreviewPane = React.memo(function DatasourcePreviewPane( try { result = await queryRunner.runQuery({ query: `SELECT * FROM ${T(datasource)}`, - extraQueryContext: { sqlOuterLimit: 100 }, + extraQueryContext: { sqlOuterLimit: 100, requireTimeCondition: false }, cancelToken, }); } catch (e) {