((targetFragment == null) || (targetFragment != null && targetFragment.isNative())) )
{
ExprEvaluator evaluatorFragment;
// A match was found, we replace the expression
final EventPropertyGetter getter = eventTypeStream.getGetter(propertyName);
final Class returnType = eventTypeStream.getPropertyType(propertyName);
evaluatorFragment = new ExprEvaluator() {
public Object evaluate(EventBean[] eventsPerStream, boolean isNewData, ExprEvaluatorContext exprEvaluatorContext)
{
EventBean streamEvent = eventsPerStream[streamNum];
if (streamEvent == null)
{
return null;
}
return getter.get(streamEvent);
}
public Class getType()
{
return returnType;
}
@Override
public Map<String, Object> getEventType() {
return null;
}
};
exprEvaluators[i] = evaluatorFragment;
}
else
{
ExprEvaluator evaluatorFragment;
final EventPropertyGetter getter = eventTypeStream.getGetter(propertyName);
final Class returnType = eventTypeStream.getFragmentType(propertyName).getFragmentType().getUnderlyingType();
// A match was found, we replace the expression
evaluatorFragment = new ExprEvaluator() {
public Object evaluate(EventBean[] eventsPerStream, boolean isNewData, ExprEvaluatorContext exprEvaluatorContext)
{
EventBean streamEvent = eventsPerStream[streamNum];
if (streamEvent == null)
{
return null;
}
return getter.getFragment(streamEvent);
}
public Class getType()
{
return returnType;
}
public Map<String, Object> getEventType() {
return null;
}
};
exprEvaluators[i] = evaluatorFragment;
if (!fragmentType.isIndexed())
{
expressionReturnTypes[i] = fragmentType.getFragmentType();
}
else
{
expressionReturnTypes[i] = new EventType[] {fragmentType.getFragmentType()};
}
}
}
// Find if there is any stream expression (ExprStreamNode) :
// This is a special case for stream selection: select a, b from A as a, B as b
// We'd like to maintain 'A' and 'B' EventType in the Map type, and 'a' and 'b' EventBeans in the event bean
for (int i = 0; i < selectionList.size(); i++)
{
if (!(exprEvaluators[i] instanceof ExprStreamUnderlyingNode))
{
continue;
}
ExprStreamUnderlyingNode undNode = (ExprStreamUnderlyingNode) exprEvaluators[i];
final int streamNum = undNode.getStreamId();
final Class returnType = undNode.getExprEvaluator().getType();
EventType eventTypeStream = typeService.getEventTypes()[streamNum];
// A match was found, we replace the expression
ExprEvaluator evaluator = new ExprEvaluator() {
public Object evaluate(EventBean[] eventsPerStream, boolean isNewData, ExprEvaluatorContext exprEvaluatorContext)
{
return eventsPerStream[streamNum];
}
public Class getType()
{
return returnType;
}
public Map<String, Object> getEventType() {
return null;
}
};
exprEvaluators[i] = evaluator;
expressionReturnTypes[i] = eventTypeStream;
}
// Build event type that reflects all selected properties
Map<String, Object> selPropertyTypes = new LinkedHashMap<String, Object>();
int count = 0;
for (ExprEvaluator expressionNode : exprEvaluators)
{
Object expressionReturnType = expressionReturnTypes[count];
selPropertyTypes.put(columnNames[count], expressionReturnType);
count++;
}
if (!selectedStreams.isEmpty()) {
for (SelectClauseStreamCompiledSpec element : namedStreams)
{
EventType eventTypeStream = typeService.getEventTypes()[element.getStreamNumber()];
selPropertyTypes.put(columnNames[count], eventTypeStream);
count++;
}
if (isUsingWildcard && typeService.getEventTypes().length > 1)
{
for (int i = 0; i < typeService.getEventTypes().length; i++)
{
EventType eventTypeStream = typeService.getEventTypes()[i];
selPropertyTypes.put(columnNames[count], eventTypeStream);
count++;
}
}
}
// Handle stream selection
EventType underlyingEventType = null;
int underlyingStreamNumber = 0;
boolean underlyingIsFragmentEvent = false;
EventPropertyGetter underlyingPropertyEventGetter = null;
if (!selectedStreams.isEmpty()) {
// Resolve underlying event type in the case of wildcard or non-named stream select.
// Determine if the we are considering a tagged event or a stream name.
if((isUsingWildcard) || (!unnamedStreams.isEmpty()))