[
https://issues.apache.org/jira/browse/DRILL-5126?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15806918#comment-15806918
]
ASF GitHub Bot commented on DRILL-5126:
---------------------------------------
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.
> Provide simplified, unified "cluster fixture" for tests
> -------------------------------------------------------
>
> Key: DRILL-5126
> URL: https://issues.apache.org/jira/browse/DRILL-5126
> Project: Apache Drill
> Issue Type: Improvement
> Components: Tools, Build & Test
> Affects Versions: 1.9.0
> Reporter: Paul Rogers
> Assignee: Paul Rogers
> Priority: Minor
>
> Drill provides a robust selection of test frameworks that have evolved to
> satisfy the needs of a variety of test cases. For newbies, however, the
> result is a bewildering array of ways to do basically the same thing: set up
> an embedded Drill cluster, run queries and check results.
> Further, some key test settings are distributed: some are in the pom.xml
> file, some in config files stored as resources, some in hard-coded settings
> in base test classes.
> Also, some test base classes helpfully set up a test cluster, but then
> individual tests need a different config, so they immediately tear down the
> default cluster and create a new one.
> This ticket proposes a new test framework, available for new tests, that
> combines the best of the existing test frameworks into a single, easy-to-use
> package.
> * Builder for the cluster
> * Accept config-time options
> * Accept run-time session and system options
> * Specify number of Drillbits
> * Simplified API for the most common options
> * AutoCloseable for use in try-with-resources statements
> * Integration with existing test builder classes
> And so on.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)