Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@
import com.facebook.presto.operator.scalar.MapSubscriptOperator;
import com.facebook.presto.operator.scalar.MapValues;
import com.facebook.presto.operator.scalar.MathFunctions;
import com.facebook.presto.operator.scalar.MathFunctions.LegacyLogFunction;
import com.facebook.presto.operator.scalar.MultimapFromEntriesFunction;
import com.facebook.presto.operator.scalar.QuantileDigestFunctions;
import com.facebook.presto.operator.scalar.Re2JRegexpFunctions;
Expand Down Expand Up @@ -657,10 +656,6 @@ public FunctionRegistry(TypeManager typeManager, BlockEncodingSerde blockEncodin
break;
}

if (featuresConfig.isLegacyLogFunction()) {
builder.scalar(LegacyLogFunction.class);
}

addFunctions(builder.getFunctions());

if (typeManager instanceof TypeRegistry) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,19 +161,6 @@ public static Slice absLong(@SqlType("decimal(p, s)") Slice arg)
}
}

@ScalarFunction("log")
@Description("logarithm to given base")
public static final class LegacyLogFunction
{
private LegacyLogFunction() {}

@SqlType(StandardTypes.DOUBLE)
public static double log(@SqlType(StandardTypes.DOUBLE) double number, @SqlType(StandardTypes.DOUBLE) double base)
{
return Math.log(number) / Math.log(base);
}
}

@Description("absolute value")
@ScalarFunction("abs")
@SqlType(StandardTypes.REAL)
Expand Down Expand Up @@ -466,6 +453,14 @@ public static double ln(@SqlType(StandardTypes.DOUBLE) double num)
return Math.log(num);
}

@Description("logarithm to given base")
@ScalarFunction
@SqlType(StandardTypes.DOUBLE)
public static double log(@SqlType(StandardTypes.DOUBLE) double base, @SqlType(StandardTypes.DOUBLE) double number)
{
return Math.log(number) / Math.log(base);
}

@Description("logarithm to base 2")
@ScalarFunction
@SqlType(StandardTypes.DOUBLE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ public class FeaturesConfig
private boolean pushTableWriteThroughUnion = true;
private boolean exchangeCompressionEnabled;
private boolean legacyArrayAgg;
private boolean legacyLogFunction;
private boolean groupByUsesEqualTo;
private boolean legacyTimestamp = true;
private boolean legacyMapSubscript;
Expand Down Expand Up @@ -233,18 +232,6 @@ public boolean isLegacyArrayAgg()
return legacyArrayAgg;
}

@Config("deprecated.legacy-log-function")
public FeaturesConfig setLegacyLogFunction(boolean value)
{
this.legacyLogFunction = value;
return this;
}

public boolean isLegacyLogFunction()
{
return legacyLogFunction;
}

@Config("deprecated.group-by-uses-equal")
public FeaturesConfig setGroupByUsesEqualTo(boolean value)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected AbstractTestFunctions(FeaturesConfig config)
protected AbstractTestFunctions(Session session, FeaturesConfig config)
{
this.session = requireNonNull(session, "session is null");
this.config = requireNonNull(config, "config is null").setLegacyLogFunction(true);
this.config = requireNonNull(config, "config is null");
}

@BeforeClass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,8 @@ public void testLog()
{
for (double doubleValue : DOUBLE_VALUES) {
for (double base : DOUBLE_VALUES) {
assertFunction("log(" + doubleValue + ", " + base + ")", DOUBLE, Math.log(doubleValue) / Math.log(base));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This testLog test needs to be removed from the previous commit, otherwise it will fail as the log function no longer exists.

assertFunction("log(REAL '" + (float) doubleValue + "', REAL'" + (float) base + "')", DOUBLE, Math.log((float) doubleValue) / Math.log((float) base));
assertFunction("log(" + base + ", " + doubleValue + ")", DOUBLE, Math.log(doubleValue) / Math.log(base));
assertFunction("log(REAL '" + (float) base + "', REAL'" + (float) doubleValue + "')", DOUBLE, Math.log((float) doubleValue) / Math.log((float) base));
}
}
assertFunction("log(NULL, NULL)", DOUBLE, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ public void testDefaults()
.setMemoryRevokingThreshold(0.9)
.setMemoryRevokingTarget(0.5)
.setOptimizeMixedDistinctAggregations(false)
.setLegacyLogFunction(false)
.setIterativeOptimizerEnabled(true)
.setIterativeOptimizerTimeout(new Duration(3, MINUTES))
.setEnableStatsCalculator(true)
Expand Down Expand Up @@ -123,7 +122,6 @@ public void testExplicitPropertyMappings()
.put("optimizer.ignore-stats-calculator-failures", "false")
.put("optimizer.default-filter-factor-enabled", "true")
.put("deprecated.legacy-array-agg", "true")
.put("deprecated.legacy-log-function", "true")
.put("deprecated.group-by-uses-equal", "true")
.put("deprecated.legacy-map-subscript", "true")
.put("deprecated.legacy-row-field-ordinal-access", "true")
Expand Down Expand Up @@ -218,7 +216,6 @@ public void testExplicitPropertyMappings()
.setSpillMaxUsedSpaceThreshold(0.8)
.setMemoryRevokingThreshold(0.2)
.setMemoryRevokingTarget(0.8)
.setLegacyLogFunction(true)
.setExchangeCompressionEnabled(true)
.setLegacyTimestamp(false)
.setLegacyRowFieldOrdinalAccess(true)
Expand Down

This file was deleted.