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.sql.planner.plan;
 
 
 
 import java.util.List;
 
 import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Preconditions.checkNotNull;
 
 public class TableWriterNode
         extends PlanNode
 {
     private final PlanNode source;
     private final WriterTarget target;
     private final List<Symboloutputs;
     private final List<Symbolcolumns;
     private final List<StringcolumnNames;
     private final Optional<SymbolsampleWeightSymbol;
 
     @JsonCreator
     public TableWriterNode(
             @JsonProperty("id"PlanNodeId id,
             @JsonProperty("source"PlanNode source,
             @JsonProperty("target"WriterTarget target,
             @JsonProperty("columns"List<Symbolcolumns,
             @JsonProperty("columnNames"List<StringcolumnNames,
             @JsonProperty("outputs"List<Symboloutputs,
             @JsonProperty("sampleWeightSymbol"Optional<SymbolsampleWeightSymbol)
     {
         super(id);
 
         checkNotNull(columns"columns is null");
         checkNotNull(columnNames"columnNames is null");
         checkArgument(columns.size() == columnNames.size(), "columns and columnNames sizes don't match");
 
         this. = checkNotNull(source"source is null");
         this. = checkNotNull(target"target is null");
         this. = ImmutableList.copyOf(columns);
         this. = ImmutableList.copyOf(columnNames);
         this. = ImmutableList.copyOf(checkNotNull(outputs"outputs is null"));
         this. = checkNotNull(sampleWeightSymbol"sampleWeightSymbol is null");
     }
 
     @JsonProperty
     {
         return ;
     }
 
     @JsonProperty
     public PlanNode getSource()
     {
         return ;
     }
 
     @JsonProperty
     public WriterTarget getTarget()
     {
         return ;
     }
 
     @JsonProperty
     public List<SymbolgetColumns()
     {
         return ;
     }
 
     @JsonProperty
     public List<StringgetColumnNames()
     {
         return ;
     }
 
    @JsonProperty("outputs")
    @Override
    public List<SymbolgetOutputSymbols()
    {
        return ;
    }
    @Override
    public List<PlanNodegetSources()
    {
        return ImmutableList.of();
    }
    @Override
    public <C, R> R accept(PlanVisitor<C, R> visitor, C context)
    {
        return visitor.visitTableWriter(thiscontext);
    }
    @JsonTypeInfo(use = .., property = "type")
    @JsonSubTypes({
            @JsonSubTypes.Type(value = CreateHandle.class, name = "CreateHandle"),
            @JsonSubTypes.Type(value = InsertHandle.class, name = "InsertHandle"),
    })
    @SuppressWarnings({"EmptyClass""ClassMayBeInterface"})
    public abstract static class WriterTarget
    {
        @Override
        public abstract String toString();
    }
    // only used during planning -- will not be serialized
    public static class CreateName
            extends WriterTarget
    {
        private final String catalog;
        private final TableMetadata tableMetadata;
        public CreateName(String catalogTableMetadata tableMetadata)
        {
            this. = checkNotNull(catalog"catalog is null");
            this. = checkNotNull(tableMetadata"tableMetadata is null");
        }
        public String getCatalog()
        {
            return ;
        }
        public TableMetadata getTableMetadata()
        {
            return ;
        }
        @Override
        public String toString()
        {
            return  + "." + .getTable();
        }
    }
    public static class CreateHandle
            extends WriterTarget
    {
        private final OutputTableHandle handle;
        @JsonCreator
        public CreateHandle(@JsonProperty("handle"OutputTableHandle handle)
        {
            this. = checkNotNull(handle"handle is null");
        }
        @JsonProperty
        public OutputTableHandle getHandle()
        {
            return ;
        }
        @Override
        public String toString()
        {
            return .toString();
        }
    }
    // only used during planning -- will not be serialized
    public static class InsertReference
            extends WriterTarget
    {
        private final TableHandle handle;
        public InsertReference(TableHandle handle)
        {
            this. = checkNotNull(handle"handle is null");
        }
        public TableHandle getHandle()
        {
            return ;
        }
        @Override
        public String toString()
        {
            return .toString();
        }
    }
    public static class InsertHandle
            extends WriterTarget
    {
        private final InsertTableHandle handle;
        @JsonCreator
        public InsertHandle(@JsonProperty("handle"InsertTableHandle handle)
        {
            this. = checkNotNull(handle"handle is null");
        }
        @JsonProperty
        public InsertTableHandle getHandle()
        {
            return ;
        }
        @Override
        public String toString()
        {
            return .toString();
        }
    }
New to GrepCode? Check out our FAQ X