[treebuilder] add filter function