16 #ifndef IMPALA_RUNTIME_DESCRIPTORS_H
17 #define IMPALA_RUNTIME_DESCRIPTORS_H
20 #include <tr1/unordered_map>
22 #include <boost/scoped_ptr.hpp>
29 #include "gen-cpp/Descriptors_types.h"
30 #include "gen-cpp/Types_types.h"
42 class TDescriptorTable;
43 class TSlotDescriptor;
45 class TTupleDescriptor;
66 : byte_offset(byte_offset),
67 bit_mask(bit_offset == -1 ? 0 : 1 << bit_offset) {
73 std::ostream&
operator<<(std::ostream& os,
const NullIndicatorOffset& null_indicator);
159 return slot_desc->
col_path().size() == 1 &&
239 PartitionIdToDescriptorMap::const_iterator it =
275 bool col_binary_encoded)
281 const std::vector<HBaseColumnDescriptor>&
cols()
const {
return cols_; }
288 std::vector<HBaseColumnDescriptor>
cols_;
302 const std::vector<SlotDescriptor*>&
slots()
const {
return slots_; }
350 void GetTupleDescs(std::vector<TupleDescriptor*>* descs)
const;
376 const std::vector<bool>& nullable_tuples);
387 RowDescriptor(
const std::vector<TupleDescriptor*>& tuple_descs,
388 const std::vector<bool>& nullable_tuples);
417 void ToThrift(std::vector<TTupleId>* row_tuple_ids);
const std::string & null_column_value() const
std::string null_partition_key_value_
const TableDescriptor * table_desc() const
virtual std::string DebugString() const
std::string DebugString() const
llvm::PointerType * tuple_ptr
THdfsFileFormat::type file_format() const
HBaseColumnDescriptor(const std::string &col_family, const std::string &col_qualifier, bool col_binary_encoded)
Status OpenExprs(RuntimeState *state)
std::string table_name_
native name of hbase table
static bool ColPathLessThan(const SlotDescriptor *a, const SlotDescriptor *b)
SlotDescriptorMap slot_desc_map_
llvm::Function * set_null_fn_
DataSourceTableDescriptor(const TTableDescriptor &tdesc)
const int slot_size_
the byte size of this slot.
const std::string & database() const
std::vector< SlotDescriptor * > string_slots_
Status PrepareExprs(RuntimeState *state)
llvm::StructType * tuple_struct
const std::string table_name() const
virtual std::string DebugString() const
const NullIndicatorOffset null_indicator_offset_
TableDescriptor * GetTableDescriptor(TableId id) const
int num_materialized_slots_
std::vector< bool > tuple_idx_nullable_map_
tuple_idx_nullable_map_[i] is true if tuple i can be null
TableDescriptorMap tbl_desc_map_
std::vector< std::string > col_names_
const std::vector< int > & col_path() const
const std::string & hdfs_base_dir() const
int num_null_bytes() const
const std::vector< SlotDescriptor * > & slots() const
std::vector< int > tuple_idx_map_
map from TupleId to position of tuple w/in row
HdfsPartitionDescriptor(const THdfsPartition &thrift_partition, ObjectPool *pool)
std::string null_column_value_
Special string to indicate NULL values in text-encoded columns.
llvm::Function * is_null_fn_
Cached codegen'd functions.
llvm::StructType * GenerateLlvmStruct(LlvmCodeGen *codegen)
const NullIndicatorOffset & null_indicator_offset() const
virtual ~TableDescriptor()
TupleDescriptor * GetTupleDescriptor(TupleId id) const
bool TupleIsNullable(int tuple_idx) const
Return true if the Tuple of the given Tuple index is nullable.
static const int INVALID_IDX
std::tr1::unordered_map< SlotId, SlotDescriptor * > SlotDescriptorMap
ObjectPool * object_pool_
Owned by DescriptorTbl.
TableDescriptor(const TTableDescriptor &tdesc)
const std::vector< SlotDescriptor * > & string_slots() const
SlotDescriptor(const TSlotDescriptor &tdesc)
LLVM code generator. This is the top level object to generate jitted code.
std::vector< int > indices
HBaseTableDescriptor(const TTableDescriptor &tdesc)
llvm::StructType * llvm_struct_
ObjectPool * object_pool_
RowDescriptor(const RowDescriptor &desc)
standard copy c'tor, made explicit here
const std::vector< HBaseColumnDescriptor > & cols() const
std::string hdfs_base_dir_
llvm::Function * set_not_null_fn_
bool IsPrefixOf(const RowDescriptor &other_desc) const
void CloseExprs(RuntimeState *state)
const ColumnType & type() const
const std::string & location() const
llvm::Function * CodegenIsNull(LlvmCodeGen *, llvm::StructType *tuple)
virtual std::string DebugString() const
int num_clustering_cols() const
const PartitionIdToDescriptorMap & partition_descriptors() const
bool Equals(const RowDescriptor &other_desc) const
Return true if the tuple ids of this descriptor match tuple ids of other desc.
std::vector< SlotDescriptor * > slots_
void ToThrift(std::vector< TTupleId > *row_tuple_ids)
Populate row_tuple_ids with our ids.
std::string DebugString() const
std::tr1::unordered_map< TupleId, TupleDescriptor * > TupleDescriptorMap
std::vector< TupleDescriptor * > tuple_desc_map_
map from position of tuple w/in row to its descriptor
llvm::Function * CodegenUpdateNull(LlvmCodeGen *, llvm::StructType *tuple, bool set_null)
std::string DebugString() const
Base class for table descriptors.
bool IsAnyTupleNullable() const
Return true if any Tuple of the row is nullable.
int GetTupleIdx(TupleId id) const
Returns INVALID_IDX if id not part of this row.
std::string DebugString() const
const std::vector< std::string > & col_names() const
TupleDescriptor(const TTupleDescriptor &tdesc)
bool exprs_prepared_
True if PrepareExprs has been called, to prevent repeating expensive codegen.
std::vector< ExprContext * > partition_key_value_ctxs_
std::tr1::unordered_map< TableId, TableDescriptor * > TableDescriptorMap
void InitTupleIdxMap()
Initializes tupleIdxMap during c'tor using the tuple_desc_map_.
const std::string & name() const
const std::vector< TupleDescriptor * > & tuple_descriptors() const
Return descriptors for all tuples in this row, in order of appearance.
PartitionIdToDescriptorMap partition_descriptors_
bool IsClusteringCol(const SlotDescriptor *slot_desc) const
std::string avro_schema_
Set to the table's Avro schema if this is an Avro table, empty string otherwise.
virtual std::string DebugString() const
SlotDescriptor * GetSlotDescriptor(SlotId id) const
void AddSlot(SlotDescriptor *slot)
std::string DebugString() const
int field_idx() const
Returns the field index in the generated llvm struct for this slot's tuple.
Metadata for a single partition inside an Hdfs table.
static Status Create(ObjectPool *pool, const TDescriptorTable &thrift_tbl, DescriptorTbl **tbl)
Descriptor for a DataSourceTable.
bool is_materialized() const
std::vector< HBaseColumnDescriptor > cols_
List of family/qualifier pairs.
HdfsPartitionDescriptor * GetPartition(int64_t partition_id) const
RowDescriptor()
dummy descriptor, needed for the JNI EvalPredicate() function
TableDescriptor * table_desc_
char collection_delim() const
TupleDescriptorMap tuple_desc_map_
const std::vector< int > col_path_
ostream & operator<<(ostream &os, const map< TNetworkAddress, llama::TAllocatedResource > &resources)
NullIndicatorOffset(int byte_offset, int bit_offset)
HdfsTableDescriptor(const TTableDescriptor &tdesc, ObjectPool *pool)
THdfsFileFormat::type file_format_
The format (e.g. text, sequence file etc.) of data in the files in this partition.
const bool is_materialized_
std::string DebugString() const
const std::string & null_partition_key_value() const
const std::string & avro_schema() const
void GetTupleDescs(std::vector< TupleDescriptor * > *descs) const
return all registered tuple descriptors
const std::vector< ExprContext * > & partition_key_value_ctxs() const
const int num_null_bytes_
std::map< int64_t, HdfsPartitionDescriptor * > PartitionIdToDescriptorMap