Github user cestella commented on a diff in the pull request:

    https://github.com/apache/incubator-metron/pull/119#discussion_r63101688
  
    --- Diff: 
metron-platform/metron-pcap/src/main/java/org/apache/metron/pcap/filter/query/QueryPcapFilter.java
 ---
    @@ -0,0 +1,74 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.metron.pcap.filter.query;
    +
    +import org.apache.hadoop.conf.Configuration;
    +import org.apache.metron.common.Constants;
    +import org.apache.metron.common.query.PredicateProcessor;
    +import org.apache.metron.common.query.VariableResolver;
    +import org.apache.metron.pcap.PacketInfo;
    +import org.apache.metron.pcap.PcapHelper;
    +import org.apache.metron.pcap.filter.PcapFilter;
    +import org.apache.metron.pcap.filter.PcapFilterConfigurator;
    +import org.apache.metron.pcap.filter.PcapFilters;
    +
    +import java.util.EnumMap;
    +import java.util.Map;
    +
    +public class QueryPcapFilter implements PcapFilter {
    +  public static final String QUERY_STR_CONFIG = "mql";
    +
    +  public static class Configurator implements 
PcapFilterConfigurator<String> {
    +    @Override
    +    public void addToConfig(String query, Configuration conf) {
    +      conf.set(QUERY_STR_CONFIG, query);
    +      conf.set(PCAP_FILTER_NAME_CONF, PcapFilters.QUERY.name());
    +    }
    +
    +    @Override
    +    public String queryToString(String fields) {
    +      return fields.replaceAll("\\w", "_")
    --- End diff --
    
    I think you mean "\\s" there, not "\\w".  \\w matches word, so the output 
of this will be "___ ___" for input "foo bar".  Might be worth while to add a 
unit test around that too.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to