From 6b90a320cf737264da551069c843692a32424509 Mon Sep 17 00:00:00 2001 From: imply-cheddar <86940447+imply-cheddar@users.noreply.github.com> Date: Fri, 10 Mar 2023 14:06:34 +0900 Subject: [PATCH] Add back function signature for compat (#13914) * Add back function signature for compat * Suppress IntelliJ Error --- .../data/input/MaxSizeSplitHintSpec.java | 1 + .../data/input/SegmentsSplitHintSpec.java | 1 + .../sql/calcite/expression/Expressions.java | 25 +++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/processing/src/main/java/org/apache/druid/data/input/MaxSizeSplitHintSpec.java b/processing/src/main/java/org/apache/druid/data/input/MaxSizeSplitHintSpec.java index 0a7e36d8b7c..2bd61aac089 100644 --- a/processing/src/main/java/org/apache/druid/data/input/MaxSizeSplitHintSpec.java +++ b/processing/src/main/java/org/apache/druid/data/input/MaxSizeSplitHintSpec.java @@ -42,6 +42,7 @@ import java.util.function.Function; */ public class MaxSizeSplitHintSpec implements SplitHintSpec { + @SuppressWarnings("unused") public static final String TYPE = "maxSize"; @VisibleForTesting diff --git a/processing/src/main/java/org/apache/druid/data/input/SegmentsSplitHintSpec.java b/processing/src/main/java/org/apache/druid/data/input/SegmentsSplitHintSpec.java index c3b07114e20..ed59d67285a 100644 --- a/processing/src/main/java/org/apache/druid/data/input/SegmentsSplitHintSpec.java +++ b/processing/src/main/java/org/apache/druid/data/input/SegmentsSplitHintSpec.java @@ -40,6 +40,7 @@ import java.util.function.Function; */ public class SegmentsSplitHintSpec implements SplitHintSpec { + @SuppressWarnings("unused") public static final String TYPE = "segments"; private static final HumanReadableBytes DEFAULT_MAX_INPUT_SEGMENT_BYTES_PER_TASK = new HumanReadableBytes("1GiB"); diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/expression/Expressions.java b/sql/src/main/java/org/apache/druid/sql/calcite/expression/Expressions.java index 3e762a21a9f..8fb0d1f8e35 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/expression/Expressions.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/expression/Expressions.java @@ -21,6 +21,7 @@ package org.apache.druid.sql.calcite.expression; import com.google.common.base.Preconditions; import com.google.common.collect.Iterables; +import org.apache.calcite.jdbc.JavaTypeFactoryImpl; import org.apache.calcite.rel.core.Project; import org.apache.calcite.rel.type.RelDataTypeFactory; import org.apache.calcite.rex.RexCall; @@ -80,6 +81,30 @@ public class Expressions // No instantiation. } + /** + * Old method used to translate a field access, possibly through a projection, to an underlying Druid dataSource. + * + * This exists to provide API compatibility to extensions, but is deprecated because there is a 4 argument version + * that should be used instead. Call sites should have access to a RexBuilder instance that they can get the + * typeFactory from. + * + * @param rowSignature row signature of underlying Druid dataSource + * @param project projection, or null + * @param fieldNumber number of the field to access + * + * @return row expression + */ + @Deprecated + public static RexNode fromFieldAccess( + final RowSignature rowSignature, + @Nullable final Project project, + final int fieldNumber + ) + { + //noinspection VariableNotUsedInsideIf + return fromFieldAccess(project == null ? new JavaTypeFactoryImpl() : null, rowSignature, project, fieldNumber); + } + /** * Translate a field access, possibly through a projection, to an underlying Druid dataSource. *