drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paul-rogers <...@git.apache.org>
Subject [GitHub] drill pull request #710: DRILL-5126: Provide simplified, unified "cluster fi...
Date Sat, 07 Jan 2017 06:27:43 GMT
Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/710#discussion_r95053125
  
    --- Diff: exec/java-exec/src/test/java/org/apache/drill/test/FieldDef.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.drill.test;
    +
    +import java.util.regex.Matcher;
    +import java.util.regex.Pattern;
    +
    +/**
    + * Basic representation of a column parsed from a query profile.
    + * Idea is to use this to generate mock data that represents a
    + * query obtained from a user. This is a work in progress.
    + */
    +
    +public class FieldDef {
    +  public enum Type { VARCHAR, DOUBLE };
    +  public enum TypeHint { DATE, TIME };
    +
    +  public final String name;
    +  public final String typeStr;
    +  public final Type type;
    +  public int length;
    +  public TypeHint hint;
    +
    +  public FieldDef( String name, String typeStr ) {
    +    this.name = name;
    +    this.typeStr = typeStr;
    +    Pattern p = Pattern.compile( "(\\w+)(?:\\((\\d+)\\))?" );
    +    Matcher m = p.matcher(typeStr);
    +    if ( ! m.matches() ) { throw new IllegalStateException( ); }
    +    if ( m.group(2) == null ) {
    +      length = 0;
    +    } else {
    +      length = Integer.parseInt( m.group(2) );
    --- End diff --
    
    Done. There is much to do still here. This is a work in progress that needs expansion
as we use it for more test cases.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message