allow sql lookup function to take advantage of injective lookups (#7655)

This commit is contained in:
Clint Wylie 2019-06-06 14:36:10 -07:00 committed by Gian Merlino
parent 080270283a
commit 12a1ecfc2b
4 changed files with 12 additions and 10 deletions

View File

@ -41,8 +41,8 @@ public class LookupExtractionFn extends FunctionalExtraction
@JsonProperty("lookup") final LookupExtractor lookup,
@JsonProperty("retainMissingValue") final boolean retainMissingValue,
@Nullable @JsonProperty("replaceMissingValueWith") final String replaceMissingValueWith,
@JsonProperty("injective") final Boolean injective,
@JsonProperty("optimize") final Boolean optimize
@Nullable @JsonProperty("injective") final Boolean injective,
@Nullable @JsonProperty("optimize") final Boolean optimize
)
{
super(

View File

@ -48,7 +48,7 @@ public class RegisteredLookupExtractionFn implements ExtractionFn
@JsonProperty("lookup") String lookup,
@JsonProperty("retainMissingValue") final boolean retainMissingValue,
@Nullable @JsonProperty("replaceMissingValueWith") final String replaceMissingValueWith,
@JsonProperty("injective") final Boolean injective,
@Nullable @JsonProperty("injective") final Boolean injective,
@JsonProperty("optimize") Boolean optimize
)
{
@ -73,12 +73,14 @@ public class RegisteredLookupExtractionFn implements ExtractionFn
return retainMissingValue;
}
@Nullable
@JsonProperty("replaceMissingValueWith")
public String getReplaceMissingValueWith()
{
return replaceMissingValueWith;
}
@Nullable
@JsonProperty("injective")
public Boolean isInjective()
{
@ -151,10 +153,10 @@ public class RegisteredLookupExtractionFn implements ExtractionFn
delegate = new LookupExtractionFn(
factory,
isRetainMissingValue(),
getReplaceMissingValueWith(),
injective == null ? factory.isOneToOne() : injective,
isOptimize()
retainMissingValue,
replaceMissingValueWith,
injective,
optimize
);
}
}

View File

@ -81,7 +81,7 @@ public class QueryLookupOperatorConversion implements SqlOperatorConversion
(String) lookupNameExpr.getLiteralValue(),
false,
null,
false,
null,
true
)
);

View File

@ -5887,7 +5887,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
"lookyloo",
false,
null,
false,
null,
true
);
@ -5940,7 +5940,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
"lookyloo",
false,
null,
false,
null,
true
);