protected function filterFields(array $fields): array
    {
        // get table columns, aliased
        $columns = $this->table->getSchema()->columns();
        foreach ($columns as $index => $column) {
            $columns[$index] = $this->table->aliasField($column);
        }

        // filter out virtual fields
        foreach ($fields as $index => $field) {
            if (!in_array($field, $columns)) {
                unset($fields[$index]);
            }
        }

        return $fields;
    }