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

    https://github.com/apache/metamodel/pull/182#discussion_r193787182
  
    --- Diff: 
hbase/src/main/java/org/apache/metamodel/hbase/HBaseCreateTableBuilder.java ---
    @@ -0,0 +1,98 @@
    +/**
    + * 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.metamodel.hbase;
    +
    +import java.util.Set;
    +
    +import org.apache.metamodel.MetaModelException;
    +import org.apache.metamodel.create.AbstractTableCreationBuilder;
    +import org.apache.metamodel.schema.MutableSchema;
    +import org.apache.metamodel.schema.Schema;
    +import org.apache.metamodel.schema.Table;
    +import org.apache.metamodel.util.SimpleTableDef;
    +
    +/**
    + * A builder-class to create tables in a HBase datastore
    + */
    +public class HBaseCreateTableBuilder extends 
AbstractTableCreationBuilder<HBaseUpdateCallback> {
    +
    +    private Set<String> _columnFamilies;
    +
    +    public HBaseCreateTableBuilder(final HBaseUpdateCallback 
updateCallback, final Schema schema, final String name) {
    +        this(updateCallback, schema, name, null);
    +    }
    +
    +    /**
    +     * Create a {@link HBaseCreateTableBuilder}.
    +     * Throws an {@link IllegalArgumentException} if the schema isn't a 
{@link MutableSchema}.
    +     * @param updateCallback
    +     * @param schema
    +     * @param name
    +     * @param columnFamilies
    +     */
    +    public HBaseCreateTableBuilder(final HBaseUpdateCallback 
updateCallback, final Schema schema, final String name,
    +            final Set<String> columnFamilies) {
    +        super(updateCallback, schema, name);
    +        if (!(schema instanceof MutableSchema)) {
    +            throw new IllegalArgumentException("Not a mutable schema: " + 
schema);
    +        }
    +        this._columnFamilies = columnFamilies;
    +    }
    +
    +    @Override
    +    public Table execute() {
    +        if (_columnFamilies == null || _columnFamilies.isEmpty()) {
    --- End diff --
    
    An option might be to drop the setColumnFamilies method and instead use the 
withColumn method to set the column families for this CreateTableBuilder, but 
then we have to make clear that the column added by the withColumn method 
represents a column family for the HBase perspective.


---

Reply via email to