String propertyName = propValue.getPropertyName();
String selectorName = propValue.getSelectorName().getName();
final int index = columns.getColumnIndexForProperty(selectorName, propertyName);
// Find the expected property type of the value ...
Table table = schemata.getTable(propValue.getSelectorName());
Column schemaColumn = table.getColumn(propertyName);
final String expectedType = schemaColumn.getPropertyType();
final TypeFactory<?> typeFactory = typeSystem.getTypeFactory(expectedType);
return new DynamicOperation() {
public String getExpectedType() {
return expectedType;
}
public Object evaluate( Object[] tuple ) {
return typeFactory.create(tuple[index]);
}
};
}
final TypeFactory<String> stringFactory = typeSystem.getStringFactory();
if (operand instanceof Length) {
Length length = (Length)operand;
PropertyValue value = length.getPropertyValue();
String propertyName = value.getPropertyName();
String selectorName = value.getSelectorName().getName();
final int index = columns.getColumnIndexForProperty(selectorName, propertyName);
// Find the expected property type of the value ...
Table table = context.getSchemata().getTable(value.getSelectorName());
Column schemaColumn = table.getColumn(propertyName);
final String expectedType = schemaColumn.getPropertyType();
final TypeFactory<?> typeFactory = typeSystem.getTypeFactory(expectedType);
final TypeFactory<Long> longFactory = typeSystem.getLongFactory();
return new DynamicOperation() {
public String getExpectedType() {
return longFactory.getTypeName(); // length is always LONG