From 65d2396cb2af89fdab8ad5aaf71ea437625b3111 Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Mon, 25 Apr 2022 16:04:53 +0200 Subject: [PATCH] [jOOQ/jOOQ#9981] Add improvement and apply it to - SimpleDataKey.DATA_WINDOW_DEFINITIONS --- jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java | 10 ++-------- jOOQ/src/main/java/org/jooq/impl/Tools.java | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java b/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java index 39571d3666..19e92b6ec1 100644 --- a/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java @@ -1591,10 +1591,9 @@ final class SelectQueryImpl extends AbstractResultQuery imp SQLDialect dialect = context.dialect(); - // [#2791] TODO: Instead of explicitly manipulating these data() objects, future versions - // of jOOQ should implement a push / pop semantics to clearly delimit such scope. + // [#2791] [#9981] TODO: We have an automatic way of pushing / popping + // these values onto the scope stack. Use that, instead Object renderTrailingLimit = context.data(DATA_RENDER_TRAILING_LIMIT_IF_APPLICABLE); - Object localWindowDefinitions = context.data(DATA_WINDOW_DEFINITIONS); Name[] selectAliases = (Name[]) context.data(DATA_SELECT_ALIASES); try { @@ -1611,10 +1610,6 @@ final class SelectQueryImpl extends AbstractResultQuery imp if (TRUE.equals(renderTrailingLimit)) context.data().remove(DATA_RENDER_TRAILING_LIMIT_IF_APPLICABLE); - // [#5127] Lazy initialise this map - if (localWindowDefinitions != null) - context.data(DATA_WINDOW_DEFINITIONS, null); - if (intoTable != null && !TRUE.equals(context.data(DATA_OMIT_INTO_CLAUSE)) && EMULATE_SELECT_INTO_AS_CTAS.contains(dialect)) { @@ -1850,7 +1845,6 @@ final class SelectQueryImpl extends AbstractResultQuery imp } finally { - context.data(DATA_WINDOW_DEFINITIONS, localWindowDefinitions); if (renderTrailingLimit != null) context.data(DATA_RENDER_TRAILING_LIMIT_IF_APPLICABLE, renderTrailingLimit); if (selectAliases != null) diff --git a/jOOQ/src/main/java/org/jooq/impl/Tools.java b/jOOQ/src/main/java/org/jooq/impl/Tools.java index 37b93d2448..01f00cae30 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Tools.java +++ b/jOOQ/src/main/java/org/jooq/impl/Tools.java @@ -678,7 +678,7 @@ final class Tools { * needed in the SELECT clause when emulating them by inlining * window specifications. */ - DATA_WINDOW_DEFINITIONS, + DATA_WINDOW_DEFINITIONS(true, null, 0), /** * [#1629] The {@link Connection#getAutoCommit()} flag value before starting