-
Notifications
You must be signed in to change notification settings - Fork 609
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32822 from vespa-engine/bratseth/indexing-type-in…
…ference-2 Bratseth/indexing type inference 2
- Loading branch information
Showing
9 changed files
with
103 additions
and
29 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
...nguage/src/main/java/com/yahoo/vespa/indexinglanguage/expressions/AnyNumericDataType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. | ||
package com.yahoo.vespa.indexinglanguage.expressions; | ||
|
||
import com.yahoo.document.DataType; | ||
import com.yahoo.document.NumericDataType; | ||
import com.yahoo.document.datatypes.DoubleFieldValue; | ||
import com.yahoo.document.datatypes.FieldValue; | ||
|
||
/** | ||
* A DataType representing any numeric type. This is (so far) only needed during type resolution of indexing pipelines | ||
* so it is placed here. | ||
* | ||
* @author bratseth | ||
*/ | ||
class AnyNumericDataType extends NumericDataType { | ||
|
||
static final AnyNumericDataType instance = new AnyNumericDataType(); | ||
|
||
private AnyNumericDataType() { | ||
super("numeric", DataType.lastPredefinedDataTypeId() + 2, DoubleFieldValue.class, new UnsupportedFactory()); | ||
} | ||
|
||
@Override | ||
public boolean isAssignableFrom(DataType other) { | ||
return other instanceof NumericDataType; | ||
} | ||
|
||
@Override | ||
public boolean isAssignableTo(DataType other) { | ||
return other instanceof AnyNumericDataType || other instanceof AnyDataType; | ||
} | ||
|
||
@Override | ||
public boolean isValueCompatible(FieldValue value) { | ||
return isAssignableFrom(value.getDataType()); | ||
} | ||
|
||
@Override | ||
public FieldValue createFieldValue() { throw new UnsupportedOperationException(); } | ||
|
||
private static class UnsupportedFactory extends Factory { | ||
|
||
public FieldValue create() { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
public FieldValue create(String value) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters