diff options
author | jonmv <venstad@gmail.com> | 2022-10-02 21:23:08 +0200 |
---|---|---|
committer | jonmv <venstad@gmail.com> | 2022-10-02 21:23:08 +0200 |
commit | 998293e64119cc1b17a2dd2d52eb5dad67a49670 (patch) | |
tree | f959f774ddea367fb1ba8e50f159b0339bb44ff8 | |
parent | aeaa3c2da60259a8ba80345591657922c90c1993 (diff) |
Revert "Merge pull request #24266 from vespa-engine/bratseth/tolerate-missing-types"
This reverts commit a2bb6fac145904c96943294b5b62d3c2063e5144, reversing
changes made to 0b08f84d1a2bc9fcbea0656d33e5e23f3e325e40.
2 files changed, 22 insertions, 38 deletions
diff --git a/config-model/src/main/java/com/yahoo/schema/derived/DerivedConfiguration.java b/config-model/src/main/java/com/yahoo/schema/derived/DerivedConfiguration.java index 8b07aa48a24..11bd14cbe46 100644 --- a/config-model/src/main/java/com/yahoo/schema/derived/DerivedConfiguration.java +++ b/config-model/src/main/java/com/yahoo/schema/derived/DerivedConfiguration.java @@ -66,31 +66,26 @@ public class DerivedConfiguration implements AttributesConfig.Producer { * schema is later modified. */ public DerivedConfiguration(Schema schema, DeployState deployState) { - try { - Validator.ensureNotNull("Schema", schema); - this.schema = schema; - this.queryProfiles = deployState.getQueryProfiles().getRegistry(); - this.maxUncommittedMemory = deployState.getProperties().featureFlags().maxUnCommittedMemory(); - if (!schema.isDocumentsOnly()) { - streamingFields = new VsmFields(schema); - streamingSummary = new VsmSummary(schema); - } - if (!schema.isDocumentsOnly()) { - attributeFields = new AttributeFields(schema); - summaries = new Summaries(schema, deployState.getDeployLogger(), deployState.getProperties().featureFlags()); - juniperrc = new Juniperrc(schema); - rankProfileList = new RankProfileList(schema, schema.rankExpressionFiles(), attributeFields, deployState); - indexingScript = new IndexingScript(schema); - indexInfo = new IndexInfo(schema); - schemaInfo = new SchemaInfo(schema, deployState.rankProfileRegistry(), summaries); - indexSchema = new IndexSchema(schema); - importedFields = new ImportedFields(schema); - } - Validation.validate(this, schema); + Validator.ensureNotNull("Schema", schema); + this.schema = schema; + this.queryProfiles = deployState.getQueryProfiles().getRegistry(); + this.maxUncommittedMemory = deployState.getProperties().featureFlags().maxUnCommittedMemory(); + if ( ! schema.isDocumentsOnly()) { + streamingFields = new VsmFields(schema); + streamingSummary = new VsmSummary(schema); } - catch (IllegalArgumentException e) { - throw new IllegalArgumentException("Invalid " + schema, e); + if ( ! schema.isDocumentsOnly()) { + attributeFields = new AttributeFields(schema); + summaries = new Summaries(schema, deployState.getDeployLogger(), deployState.getProperties().featureFlags()); + juniperrc = new Juniperrc(schema); + rankProfileList = new RankProfileList(schema, schema.rankExpressionFiles(), attributeFields, deployState); + indexingScript = new IndexingScript(schema); + indexInfo = new IndexInfo(schema); + schemaInfo = new SchemaInfo(schema, deployState.rankProfileRegistry(), summaries); + indexSchema = new IndexSchema(schema); + importedFields = new ImportedFields(schema); } + Validation.validate(this, schema); } /** diff --git a/config-model/src/main/java/com/yahoo/schema/expressiontransforms/BooleanExpressionTransformer.java b/config-model/src/main/java/com/yahoo/schema/expressiontransforms/BooleanExpressionTransformer.java index 49fb48225e7..25cd7fe7bd2 100644 --- a/config-model/src/main/java/com/yahoo/schema/expressiontransforms/BooleanExpressionTransformer.java +++ b/config-model/src/main/java/com/yahoo/schema/expressiontransforms/BooleanExpressionTransformer.java @@ -65,7 +65,7 @@ public class BooleanExpressionTransformer extends ExpressionTransformer<Transfor ChildNode rhs = stack.pop(); ChildNode lhs = stack.peek(); - boolean primitives = isDefinitelyPrimitive(lhs.child, context) && isDefinitelyPrimitive(rhs.child, context); + boolean primitives = isPrimitive(lhs.child, context) && isPrimitive(rhs.child, context); ExpressionNode combination; if (primitives && rhs.op == Operator.and) combination = andByIfNode(lhs.child, rhs.child); @@ -78,20 +78,8 @@ public class BooleanExpressionTransformer extends ExpressionTransformer<Transfor lhs.child = combination; } - private boolean isDefinitelyPrimitive(ExpressionNode node, TransformContext context) { - try { - return node.type(context.types()).rank() == 0; - } - catch (IllegalArgumentException e) { - // Types can only be reliably resolved top down, which has not done here. - // E.g - // function(nameArg) { - // attribute(nameArg) - // } - // is supported. - // So, we return false when something cannot be resolved. - return false; - } + private boolean isPrimitive(ExpressionNode node, TransformContext context) { + return node.type(context.types()).rank() == 0; } private static OperationNode resolve(ChildNode left, ChildNode right) { @@ -120,6 +108,7 @@ public class BooleanExpressionTransformer extends ExpressionTransformer<Transfor joinedChildren.add(node.child); } + private IfNode andByIfNode(ExpressionNode a, ExpressionNode b) { return new IfNode(a, b, new ConstantNode(new BooleanValue(false))); } |