[
https://issues.apache.org/jira/browse/DRILL-6210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16388969#comment-16388969
]
ASF GitHub Bot commented on DRILL-6210:
---------------------------------------
Github user Ben-Zvi commented on a diff in the pull request:
https://github.com/apache/drill/pull/1150#discussion_r172735136
--- Diff:
exec/java-exec/src/test/java/org/apache/drill/test/rowSet/schema/SchemaBuilder.java
---
@@ -0,0 +1,214 @@
+/*
+ * 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.rowSet.schema;
+
+import org.apache.drill.common.types.TypeProtos.DataMode;
+import org.apache.drill.common.types.TypeProtos.MajorType;
+import org.apache.drill.common.types.TypeProtos.MinorType;
+import org.apache.drill.exec.record.BatchSchema;
+import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode;
+import org.apache.drill.exec.record.metadata.AbstractColumnMetadata;
+import org.apache.drill.exec.record.metadata.TupleMetadata;
+import org.apache.drill.exec.record.MaterializedField;
+
+/**
+ * Builder of a row set schema expressed as a list of materialized
+ * fields. Optimized for use when creating schemas by hand in tests.
+ * <p>
+ * Example usage to create the following schema: <br>
+ * <tt>(c: INT, a: MAP(b: VARCHAR, d: INT, e: MAP(f: VARCHAR), g: INT),
+ * h: UNION(INT, MAP(h1: INT), LIST(BIGINT)),
+ * i: BIGINT[], j: VARCHAR[][][])</tt>
+ * <p>
+ * Code:<pre><code>
+ * BatchSchema batchSchema = new SchemaBuilder()
+ * .add("c", MinorType.INT)
+ * .addMap("a")
+ * .addNullable("b", MinorType.VARCHAR)
+ * .add("d", MinorType.INT)
+ * .addMap("e") // or .addMapArray("e")
+ * .add("f", MinorType.VARCHAR)
+ * .buildMap()
+ * .add("g", MinorType.INT)
+ * .buildMap()
+ * .addUnion("h") // or .addList("h")
+ * .addType(MinorType.INT)
+ * .addMap()
+ * .add("h1", MinorType.INT)
+ * .buildNested()
+ * .addList()
+ * .addType(MinorType.BIGINT)
+ * .buildNested()
+ * .build()
+ * .addArray("i", MinorType.BIGINT)
+ * .addRepeatedList("k")
--- End diff --
"k" should be "j" ....
> Enhance the test schema builder for remaining types
> ---------------------------------------------------
>
> Key: DRILL-6210
> URL: https://issues.apache.org/jira/browse/DRILL-6210
> Project: Apache Drill
> Issue Type: Improvement
> Reporter: Paul Rogers
> Assignee: Paul Rogers
> Priority: Major
> Labels: ready-to-commit
> Fix For: 1.14.0
>
>
> The result set loader project enhanced the schema builder used in tests to
> handle Drill's complex types: maps, unions, lists and repeated lists. The
> schema builder previously only handled maps.
> This ticket describes the addition of just this one part of the result set
> loader.
> Also adds a run-time schema improvement: functions to create arrays when
> testing rather than writing out the {{new String[] \{"foo", "bar"\}}} syntax.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)