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("lookup") final LookupExtractor lookup,
@JsonProperty("retainMissingValue") final boolean retainMissingValue, @JsonProperty("retainMissingValue") final boolean retainMissingValue,
@Nullable @JsonProperty("replaceMissingValueWith") final String replaceMissingValueWith, @Nullable @JsonProperty("replaceMissingValueWith") final String replaceMissingValueWith,
@JsonProperty("injective") final Boolean injective, @Nullable @JsonProperty("injective") final Boolean injective,
@JsonProperty("optimize") final Boolean optimize @Nullable @JsonProperty("optimize") final Boolean optimize
) )
{ {
super( super(

View File

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

View File

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

View File

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