Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Licensed 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 com.facebook.presto.tpch;
 
 
 import java.util.List;
 
 import static com.facebook.presto.tpch.TpchRecordSet.createTpchRecordSet;
 import static com.facebook.presto.tpch.Types.checkType;
 import static io.airlift.tpch.TpchColumnType.BIGINT;
 
 public class TpchRecordSetProvider
         implements ConnectorRecordSetProvider
 {
     @Override
     public RecordSet getRecordSet(ConnectorSplit splitList<? extends ConnectorColumnHandlecolumns)
     {
         TpchSplit tpchSplit = checkType(splitTpchSplit.class"split");
 
         String tableName = tpchSplit.getTableHandle().getTableName();
 
         TpchTable<?> tpchTable = TpchTable.getTable(tableName);
 
         return getRecordSet(tpchTablecolumnstpchSplit.getTableHandle().getScaleFactor(), tpchSplit.getPartNumber(), tpchSplit.getTotalParts());
     }
 
     public <E extends TpchEntityRecordSet getRecordSet(
             TpchTable<E> table,
             List<? extends ConnectorColumnHandlecolumns,
             double scaleFactor,
             int partNumber,
             int totalParts)
     {
         ImmutableList.Builder<TpchColumn<E>> builder = ImmutableList.builder();
         for (ConnectorColumnHandle column : columns) {
             String columnName = checkType(columnTpchColumnHandle.class"column").getColumnName();
             if (columnName.equalsIgnoreCase(.)) {
                 builder.add(new RowNumberTpchColumn<E>());
             }
             else {
                 builder.add(table.getColumn(columnName));
             }
         }
 
         return createTpchRecordSet(tablebuilder.build(), scaleFactorpartNumber + 1, totalParts);
     }
 
     private static class RowNumberTpchColumn<E extends TpchEntity>
             implements TpchColumn<E>
     {
         @Override
         public String getColumnName()
         {
             throw new UnsupportedOperationException();
         }
 
         @Override
         public TpchColumnType getType()
         {
             return ;
         }
 
         @Override
         public double getDouble(E entity)
         {
             throw new UnsupportedOperationException();
         }
 
         @Override
         public long getLong(E entity)
         {
             return entity.getRowNumber();
         }
 
         @Override
         public String getString(E entity)
         {
             throw new UnsupportedOperationException();
         }
        @Override
        public int getDate(E entity)
        {
            throw new UnsupportedOperationException();
        }
    }
New to GrepCode? Check out our FAQ X