Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable ORC stripe prunning based on the DECIMAL predicates #5001

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
053ef85
Add hashcode operator for DECIMAL
Feb 17, 2016
8639925
Remove unspecified values support from TypeCalculation
Feb 5, 2016
1c00d20
Migrate ADD/SUBSTRACT/DIVIDE Decimal operators
Feb 5, 2016
85d3e33
Refactor function signatures binding algorithm
Feb 5, 2016
2421321
Migrate TestSignature and TestTypeSignature
Feb 9, 2016
9856d36
Allow implicit conversions from BIGINT to DECIMAL
arhimondr Jan 30, 2016
6891f35
Allow implicit conversions from DECIMAL to DOUBLE
arhimondr Jan 30, 2016
7d3b77e
Introduce most specific function selection algorithm
Feb 15, 2016
0122680
Resolve ambiguities for the operator invocations with unknown type
Feb 15, 2016
e6c1d05
Resolve lenght(UNKNOWN) ambigulity
Feb 15, 2016
1bd776d
Resolve approx_set(UNKNOWN) ambigulity
Feb 15, 2016
949091b
Resolve Json functions ambigulities for UNKNOWN
Feb 15, 2016
9fa81f7
Fix error message in filterOutLessSpecificFunctions
fiedukow Feb 18, 2016
1eac827
Remove AbstractTestDecimalFunctions
Mar 10, 2016
b84fd03
Implement Decimal to/from Json casts
losipiuk Feb 23, 2016
49f0e23
Make resolveFunction need fewer unknown functions
rschlussel-zz Mar 7, 2016
cfcc1b4
Allow implicit conversions from INTEGER to DECIMAL
Apr 26, 2016
ea1d727
Support Decimal predicates in ORC stripe prunning
Apr 12, 2016
2c10c69
Generalize BIGINT to DOUBLE comparison translation
Apr 14, 2016
b9fb0a3
Implement DECIMAL to DECIMAL saturated floor cast
Apr 15, 2016
f61c50a
Implement DECIMAL to BIGINT saturated floor cast
Apr 15, 2016
7f78ce1
Implement DOUBLE to DECIMAL saturated floor cast
Apr 20, 2016
4c9580d
Implement DOUBLE to INTEGER saturated floor cast
Apr 20, 2016
13f1179
Implement BIGINT to INTEGER saturated floor cast
Apr 20, 2016
f56b415
Implement DECIMAL to INTEGER saturated floor cast
Apr 26, 2016
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 @@ -822,7 +822,7 @@ public void testMaps()
public void testRows()
throws Exception
{
assertUpdate("CREATE TABLE tmp_row1 AS SELECT test_row(1, CAST(NULL as BIGINT)) AS a", 1);
assertUpdate("CREATE TABLE tmp_row1 AS SELECT test_row(CAST(1 as BIGINT), CAST(NULL as BIGINT)) AS a", 1);

assertQuery(
"SELECT a.col0, a.col1 FROM tmp_row1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,20 @@
import com.facebook.presto.spi.type.Type;
import com.google.common.collect.ImmutableMap;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.OptionalLong;

import static com.google.common.base.Preconditions.checkState;
import static java.util.Collections.unmodifiableMap;
import static java.util.Objects.requireNonNull;

public class BoundVariables
{
private final Map<String, Type> typeVariables;
private final Map<String, OptionalLong> longVariables;
private final Map<String, Long> longVariables;

public BoundVariables(Map<String, Type> typeVariables,
Map<String, OptionalLong> longVariables)
Map<String, Long> longVariables)
{
requireNonNull(typeVariables, "typeVariableBindings is null");
requireNonNull(longVariables, "longVariableBindings is null");
Expand All @@ -50,10 +49,10 @@ public boolean containsTypeVariable(String variableName)

public Map<String, Type> getTypeVariables()
{
return unmodifiableMap(typeVariables);
return typeVariables;
}

public OptionalLong getLongVariable(String variableName)
public Long getLongVariable(String variableName)
{
return getValue(longVariables, variableName);
}
Expand All @@ -63,25 +62,32 @@ public boolean containsLongVariable(String variableName)
return containsValue(longVariables, variableName);
}

public Map<String, OptionalLong> getLongVariables()
public Map<String, Long> getLongVariables()
{
return unmodifiableMap(longVariables);
return longVariables;
}

private <T> T getValue(Map<String, T> map, String variableName)
private static <T> T getValue(Map<String, T> map, String variableName)
{
checkState(variableName != null, "variableName is null");
T value = map.get(variableName);
checkState(value != null, "value for variable '%s' is null", variableName);
return value;
}

private boolean containsValue(Map<String, ?> map, String variableName)
private static boolean containsValue(Map<String, ?> map, String variableName)
{
checkState(variableName != null, "variableName is null");
return map.containsKey(variableName);
}

private static <T> void setValue(Map<String, T> map, String variableName, T value)
{
checkState(variableName != null, "variableName is null");
checkState(value != null, "value for variable '%s' is null", variableName);
map.put(variableName, value);
}

@Override
public boolean equals(Object o)
{
Expand All @@ -101,4 +107,62 @@ public int hashCode()
{
return Objects.hash(typeVariables, longVariables);
}

public static Builder builder()
{
return new Builder();
}

public static class Builder
{
private final Map<String, Type> typeVariables = new HashMap<>();
private final Map<String, Long> longVariables = new HashMap<>();

public Type getTypeVariable(String variableName)
{
return getValue(typeVariables, variableName);
}

public Builder setTypeVariable(String variableName, Type variableValue)
{
setValue(typeVariables, variableName, variableValue);
return this;
}

public boolean containsTypeVariable(String variableName)
{
return containsValue(typeVariables, variableName);
}

public Map<String, Type> getTypeVariables()
{
return typeVariables;
}

public Long getLongVariable(String variableName)
{
return getValue(longVariables, variableName);
}

public Builder setLongVariable(String variableName, Long variableValue)
{
setValue(longVariables, variableName, variableValue);
return this;
}

public boolean containsLongVariable(String variableName)
{
return containsValue(longVariables, variableName);
}

public Map<String, Long> getLongVariables()
{
return longVariables;
}

public BoundVariables build()
{
return new BoundVariables(typeVariables, longVariables);
}
}
}
Loading