private LogicalExpression getIndexExpression(IndexFieldDesc desc) throws InvalidIndexDefinitionException { final String fieldName = desc.getFieldPath().asPathString(); final String functionDef = desc.getFunctionName(); if ((functionDef != null)) { // this is a function String[] tokens = functionDef.split("\\s+"); if (tokens[0].equalsIgnoreCase("cast")) { if (tokens.length != 3) { throw new InvalidIndexDefinitionException("cast function definition not recognized: " + functionDef); } LogicalExpression idxExpr = castFunctionSQLSyntax(fieldName, tokens[2]); if (idxExpr == null) { throw new InvalidIndexDefinitionException("got null expression for function definition: " + functionDef); } return idxExpr; } else { throw new InvalidIndexDefinitionException("function definition is not supported for indexing: " + functionDef); } } // else it is a schemaPath return fieldName2SchemaPath(fieldName); }
private LogicalExpression getIndexExpression(IndexFieldDesc desc) throws InvalidIndexDefinitionException { final String fieldName = desc.getFieldPath().asPathString(); final String functionDef = desc.getFunctionName(); if ((functionDef != null)) { // this is a function String[] tokens = functionDef.split("\\s+"); if (tokens[0].equalsIgnoreCase("cast")) { if (tokens.length != 3) { throw new InvalidIndexDefinitionException("cast function definition not recognized: " + functionDef); } LogicalExpression idxExpr = castFunctionSQLSyntax(fieldName, tokens[2]); if (idxExpr == null) { throw new InvalidIndexDefinitionException("got null expression for function definition: " + functionDef); } return idxExpr; } else { throw new InvalidIndexDefinitionException("function definition is not supported for indexing: " + functionDef); } } // else it is a schemaPath return fieldName2SchemaPath(fieldName); }