Merge remote-tracking branch 'origin/topic/jsiwek/path-func-record-demote'

* origin/topic/jsiwek/path-func-record-demote:
  Fix filter path_func to allow record argument as a subset of stream's columns.

Conflicts:
	src/LogMgr.cc

Closes #600.
This commit is contained in:
Robin Sommer 2011-09-15 16:45:41 -07:00
commit c2e432c5fa
6 changed files with 87 additions and 6 deletions

View file

@ -908,7 +908,17 @@ bool LogMgr::Write(EnumVal* id, RecordVal* columns)
path_arg = new StringVal("");
vl.append(path_arg->Ref());
vl.append(columns->Ref());
Val* rec_arg;
BroType* rt = filter->path_func->FType()->Args()->FieldType("rec");
if ( rt->Tag() == TYPE_RECORD )
rec_arg = columns->CoerceTo(rt->AsRecordType(), true);
else
// Can be TYPE_ANY here.
rec_arg = columns->Ref();
vl.append(rec_arg);
Val* v = filter->path_func->Call(&vl);