Skip to content

Commit

Permalink
log.warn if non-default configurations are used to guide operators to…
Browse files Browse the repository at this point in the history
…wards SQL complaint behavior
  • Loading branch information
clintropolis committed Oct 10, 2023
1 parent 1793bd9 commit 0f13ac4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.druid.java.util.common.logger.Logger;

public class NullValueHandlingConfig
{
private static final Logger LOG = new Logger(NullValueHandlingConfig.class);
public static final String NULL_HANDLING_CONFIG_STRING = "druid.generic.useDefaultValueForNull";
public static final String THREE_VALUE_LOGIC_CONFIG_STRING = "druid.generic.useThreeValueLogic";

Expand Down Expand Up @@ -70,6 +72,13 @@ public NullValueHandlingConfig(
this.ignoreNullsForStringCardinality = false;
}
}

if (useDefaultValuesForNull) {
LOG.warn("druid.generic.useDefaultValueForNull set to 'true', we recommend using 'false' if using SQL to query Druid for the most SQL compliant behavior");
}
if (!useThreeValueLogic) {
LOG.warn("druid.generic.useThreeValueLogic set to 'false', we recommend using 'true' if using SQL to query Druid for the most SQL compliant behavior");
}
}

public boolean isIgnoreNullsForStringCardinality()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.druid.java.util.common.logger.Logger;

import javax.annotation.Nullable;

public class ExpressionProcessingConfig
{
private static final Logger LOG = new Logger(ExpressionProcessingConfig.class);

public static final String NULL_HANDLING_LEGACY_LOGICAL_OPS_STRING = "druid.expressions.useStrictBooleans";
// Coerce arrays to multi value strings
public static final String PROCESS_ARRAYS_AS_MULTIVALUE_STRINGS_CONFIG_STRING =
Expand Down Expand Up @@ -63,6 +66,9 @@ public ExpressionProcessingConfig(
homogenizeNullMultiValueStringArrays,
HOMOGENIZE_NULL_MULTIVALUE_STRING_ARRAYS
);
if (!useStrictBooleans) {
LOG.warn("druid.expressions.useStrictBooleans set to 'false', we recommend using 'true' if using SQL to query Druid for the most SQL compliant behavior");
}
}

public boolean isUseStrictBooleans()
Expand Down

0 comments on commit 0f13ac4

Please sign in to comment.