/** {@inheritDoc} */ @Override public String getOutputColumn() { return mOutputColumn.toString(); }
/** * Reports the request for the specified column or family, or null if no such request exists. * * @param column Requested column or family. * @return the request for the specified column or family, or null if no such request exists. */ public Column getColumn(final FijiColumnName column) { return mColumns.get(column.toString()); }
/** * Constructor. * * @param typeInfo The Hive type. * @param fijiColumnName The Fiji Column name * @param index The index of the cell to read from the column (newest is zero). */ public ColumnFlatValueExpression( TypeInfo typeInfo, FijiColumnName fijiColumnName, int index) { super(typeInfo, fijiColumnName); // Gets the declared (therefore, the target) Hive type for the Fiji cell data. final StructTypeInfo structTypeInfo = (StructTypeInfo) getTypeInfo(); mCellTypeInfo = structTypeInfo.getAllStructFieldTypeInfos().get(1); // Gets the flattened index to retrieve(or -1 for the oldest) if (index < -1) { throw new IllegalArgumentException( "Illegal index [" + index + "] for column expression " + fijiColumnName.toString()); } mIndex = index; }
/** {@inheritDoc}*/ @Override public HBaseColumnName toHBaseColumnName(FijiColumnName fijiColumnName) throws NoSuchColumnException { final String familyName = fijiColumnName.getFamily(); final String qualifierName = fijiColumnName.getQualifier(); // Validate the Fiji family final FamilyLayout family = mLayout.getFamilyMap().get(familyName); if (family == null) { throw new NoSuchColumnException(fijiColumnName.toString()); } // Validate the Fiji qualifier if (family.isGroupType() && !family.getColumnMap().containsKey(qualifierName)) { throw new NoSuchColumnException(fijiColumnName.toString()); } final byte[] localityGroupBytes = Bytes.toBytes(family.getLocalityGroup().getName()); final byte[] familyBytes = Bytes.toBytes(familyName); final byte[] qualifierBytes = Bytes.toBytes(qualifierName); final byte[] hbaseQualifierBytes = ShortColumnNameTranslator.concatWithSeparator(SEPARATOR, familyBytes, qualifierBytes); return new HBaseColumnName(localityGroupBytes, hbaseQualifierBytes); }
/** {@inheritDoc} */ @Override public void storeToConf(KeyValueStoreConfiguration conf) throws IOException { if (null == mTableUri) { throw new IOException("Required attribute not set: table URI"); } if (null == mColumn) { throw new IOException("Required attribute not set: column"); } if (!mColumn.isFullyQualified()) { throw new IOException("Column must be fully qualified"); } conf.set(CONF_TABLE_URI, mTableUri.toString()); conf.set(CONF_COLUMN, mColumn.toString()); conf.setLong(CONF_MIN_TS, mMinTs); conf.setLong(CONF_MAX_TS, mMaxTs); conf.setInt(CONF_CACHE_SIZE, mMaxObjectsToCache); if (null != mReaderSchema) { conf.set(CONF_READER_SCHEMA, mReaderSchema.toString()); } }
/** * Builds the Hive type from the schema for a particular cell within Hive. * * @param fijiColumnName that specifices which column to build the Hive type from. * @param fijiTableLayout where the column resides. * @param schemaTable of the Fiji instance for type mappings * @return String representing the corresponding Hive type for a cell within the table's layout. * @throws IOException if there is an issue retrieving the schema of a particular column. */ protected static String getHiveType(FijiColumnName fijiColumnName, FijiTableLayout fijiTableLayout, FijiSchemaTable schemaTable) throws IOException { CellSchema cellSchema = fijiTableLayout.getCellSchema(fijiColumnName); Schema schema = getSchemaFromCellSchema(cellSchema, schemaTable); String hiveType = ""; if (null != schema) { hiveType = convertSchemaToHiveType(schema); if (!fijiColumnName.isFullyQualified()) { hiveType = "MAP<STRING, " + hiveType + ">"; } } else { // Null schemas are probably indicative of a counter, but they are currently unsupported // within the Fiji Hive Adapter. Log a warning, and let the user fix it. LOG.warn(fijiColumnName.toString() + " has a null schema and is unsupported within Hive."); } return hiveType; }
throw new NoSuchColumnException(fijiColumnName.toString());
Preconditions.checkArgument(!qualifierPagingMap.containsKey(fijiColumnName.getFamily()), "Cannot override family level cell paging with fully qualified cell paging: %s", fijiColumnName.toString());
throw new NoSuchColumnException(fijiColumnName.toString());