ExprNodeColumnDesc exprNodeColumnDesc = (ExprNodeColumnDesc) columnDesc; final PrimitiveTypeInfo typeInfo = TypeInfoFactory.getPrimitiveTypeInfo(exprNodeColumnDesc.getTypeString().toLowerCase()); return interpretNodeAs(typeInfo, valueDesc);
if (cs != null && cs.getRange() != null && cs.getRange().maxValue != null && cs.getRange().minValue != null) { String colTypeLowerCase = columnDesc.getTypeString().toLowerCase(); try { if (colTypeLowerCase.equals(serdeConstants.TINYINT_TYPE_NAME)) {
if (cs != null && cs.getRange() != null && cs.getRange().maxValue != null && cs.getRange().minValue != null) { String colTypeLowerCase = columnDesc.getTypeString().toLowerCase(); try { if (colTypeLowerCase.equals(serdeConstants.TINYINT_TYPE_NAME)) {
aspCtx.addAffectedColumn(encd); String colName = encd.getColumn(); String colType = encd.getTypeString(); if (colType.equalsIgnoreCase(serdeConstants.BOOLEAN_TYPE_NAME)) { ColStatistics cs = stats.getColumnStatisticsFromColName(colName);
String colType = encd.getTypeString(); if (colType.equalsIgnoreCase(serdeConstants.BOOLEAN_TYPE_NAME)) { ColStatistics cs = stats.getColumnStatisticsFromColName(colName);
/** * Used as a fast path for operations that don't modify their input, like unary + * and casting boolean to long. IdentityExpression and its children are always * projections. */ private VectorExpression getIdentityExpression(List<ExprNodeDesc> childExprList) throws HiveException { ExprNodeDesc childExpr = childExprList.get(0); int inputCol; String colType; VectorExpression v1 = null; if (childExpr instanceof ExprNodeGenericFuncDesc) { v1 = getVectorExpression(childExpr); inputCol = v1.getOutputColumn(); colType = v1.getOutputType(); } else if (childExpr instanceof ExprNodeColumnDesc) { ExprNodeColumnDesc colDesc = (ExprNodeColumnDesc) childExpr; inputCol = getInputColumnIndex(colDesc.getColumn()); colType = colDesc.getTypeString(); } else { throw new HiveException("Expression not supported: "+childExpr); } VectorExpression expr = new IdentityExpression(inputCol, colType); if (v1 != null) { expr.setChildExpressions(new VectorExpression [] {v1}); } return expr; }
.getParameters().get(0)).getColumn()); String colName = desc.getColumn(); StatType type = getType(desc.getTypeString()); if (!tbl.isPartitioned()) { if (!StatsUtils.areBasicStatsUptoDateForQueryAnswering(tbl, tbl.getParameters())) { Logger.debug("Unsupported type: " + desc.getTypeString() + " encountered in " + "metadata optimizer for column : " + colName); return null; Long nullCnt = getNullcountFor(type, statData); if (nullCnt == null) { Logger.debug("Unsupported type: " + desc.getTypeString() + " encountered in " + "metadata optimizer for column : " + colName); return null; ExprNodeColumnDesc colDesc = (ExprNodeColumnDesc)exprMap.get(((ExprNodeColumnDesc)aggr.getParameters().get(0)).getColumn()); String colName = colDesc.getColumn(); StatType type = getType(colDesc.getTypeString()); if(!tbl.isPartitioned()) { if (!StatsUtils.areColumnStatsUptoDateForQueryAnswering(tbl, tbl.getParameters(), colName)) { String name = colDesc.getTypeString().toUpperCase(); switch (type) { case Integer: { Logger.debug("Unsupported type: " + colDesc.getTypeString() + " encountered in " + "metadata optimizer for column : " + colName); return null;
.getParameters().get(0)).getColumn()); String colName = desc.getColumn(); StatType type = getType(desc.getTypeString()); if (!tbl.isPartitioned()) { if (!StatsSetupConst.areBasicStatsUptoDate(tbl.getParameters())) { Logger.debug("Unsupported type: " + desc.getTypeString() + " encountered in " + "metadata optimizer for column : " + colName); return null; Long nullCnt = getNullcountFor(type, statData); if (nullCnt == null) { Logger.debug("Unsupported type: " + desc.getTypeString() + " encountered in " + "metadata optimizer for column : " + colName); return null; ExprNodeColumnDesc colDesc = (ExprNodeColumnDesc)exprMap.get(((ExprNodeColumnDesc)aggr.getParameters().get(0)).getColumn()); String colName = colDesc.getColumn(); StatType type = getType(colDesc.getTypeString()); if(!tbl.isPartitioned()) { if (!StatsSetupConst.areColumnStatsUptoDate(tbl.getParameters(), colName)) { String name = colDesc.getTypeString().toUpperCase(); switch (type) { case Integeral: { Logger.debug("Unsupported type: " + colDesc.getTypeString() + " encountered in " + "metadata optimizer for column : " + colName); return null;
expr = new IdentityExpression(columnNum, exprDesc.getTypeString()); break;
aspCtx.addAffectedColumn(encd); String colName = encd.getColumn(); String colType = encd.getTypeString(); if (colType.equalsIgnoreCase(serdeConstants.BOOLEAN_TYPE_NAME)) { ColStatistics cs = stats.getColumnStatisticsFromColName(colName);
String colType = encd.getTypeString(); if (colType.equalsIgnoreCase(serdeConstants.BOOLEAN_TYPE_NAME)) { ColStatistics cs = stats.getColumnStatisticsFromColName(colName);
if (columnDesc.getTypeString().equals("boolean")) { builder.equals(columnDesc.getColumn(), PredicateLeaf.Type.BOOLEAN, true);
if (columnDesc.getTypeString().equals("boolean")) { builder.equals(columnDesc.getColumn(), PredicateLeaf.Type.BOOLEAN, true);
public String buildExpressionStringFrom(JobConf jobConf, IndexSearchCondition condition) { final String type = condition.getColumnDesc().getTypeString(); String column = condition.getColumnDesc().getColumn(); String rColumn = findReplacement(jobConf, column); if(rColumn != null) { column = rColumn; } return JOINER_SPACE.join( "\"" + column + "\"", getSqlCompOpString(condition), joiner != null ? createConstants(type, condition.getConstantDescs()) : createConstant(type, condition.getConstantDesc())); }
private IndexSearchCondition mockedIndexSearchCondition(String comparisionOp, Object constantValue, Object[] constantValues, String columnName, String typeString, boolean isNot) { IndexSearchCondition condition = mock(IndexSearchCondition.class); when(condition.getComparisonOp()).thenReturn(comparisionOp); if (constantValue != null) { ExprNodeConstantDesc constantDesc = mock(ExprNodeConstantDesc.class); when(constantDesc.getValue()).thenReturn(constantValue); when(condition.getConstantDesc()).thenReturn(constantDesc); } ExprNodeColumnDesc columnDesc = mock(ExprNodeColumnDesc.class); when(columnDesc.getColumn()).thenReturn(columnName); when(columnDesc.getTypeString()).thenReturn(typeString); when(condition.getColumnDesc()).thenReturn(columnDesc); if (ArrayUtils.isNotEmpty(constantValues)) { ExprNodeConstantDesc[] constantDescs = new ExprNodeConstantDesc[constantValues.length]; for (int i = 0; i < constantDescs.length; i++) { constantDescs[i] = mock(ExprNodeConstantDesc.class); when(condition.getConstantDesc(i)).thenReturn(constantDescs[i]); when(constantDescs[i].getValue()).thenReturn(constantValues[i]); } when(condition.getConstantDescs()).thenReturn(constantDescs); } when(condition.isNot()).thenReturn(isNot); return condition; }
private VectorExpression getColumnVectorExpression(ExprNodeColumnDesc exprDesc, Mode mode) throws HiveException { int columnNum = getInputColumnIndex(exprDesc.getColumn()); VectorExpression expr = null; switch (mode) { case FILTER: //Important: It will come here only if the column is being used as a boolean expr = new SelectColumnIsTrue(columnNum); break; case PROJECTION: expr = new IdentityExpression(columnNum, exprDesc.getTypeString()); break; } return expr; }
public CompareOp getCompareOp(String udfType, IndexSearchCondition sc) throws NoSuchCompareOpException, SerDeException { Class<? extends CompareOp> clz = getCompareOpClass(udfType); try { return clz.newInstance(); } catch (ClassCastException e) { throw new SerDeException("Column type mismatch in WHERE clause " + sc.getComparisonExpr().getExprString() + " found type " + sc.getConstantDesc().getTypeString() + " instead of " + sc.getColumnDesc().getTypeString()); } catch (IllegalAccessException e) { throw new SerDeException("Could not instantiate class for WHERE clause", e); } catch (InstantiationException e) { throw new SerDeException("Could not instantiate class for WHERE clause", e); } }
public PrimitiveComparison getPrimitiveComparison(String type, IndexSearchCondition sc) throws NoSuchPrimitiveComparisonException, SerDeException { Class<? extends PrimitiveComparison> clz = getPrimitiveComparisonClass(type); try { return clz.newInstance(); } catch (ClassCastException e) { throw new SerDeException("Column type mismatch in WHERE clause " + sc.getComparisonExpr().getExprString() + " found type " + sc.getConstantDesc().getTypeString() + " instead of " + sc.getColumnDesc().getTypeString()); } catch (IllegalAccessException e) { throw new SerDeException("Could not instantiate class for WHERE clause", e); } catch (InstantiationException e) { throw new SerDeException("Could not instantiate class for WHERE clause", e); } }
public CompareOp getCompareOp(String udfType, IndexSearchCondition sc) throws NoSuchCompareOpException, SerDeException { Class<? extends CompareOp> clz = getCompareOpClass(udfType); try { return clz.newInstance(); } catch (ClassCastException e) { throw new SerDeException("Column type mismatch in WHERE clause " + sc.getIndexExpr().getExprString() + " found type " + sc.getConstantDesc().getTypeString() + " instead of " + sc.getColumnDesc().getTypeString()); } catch (IllegalAccessException e) { throw new SerDeException("Could not instantiate class for WHERE clause", e); } catch (InstantiationException e) { throw new SerDeException("Could not instantiate class for WHERE clause", e); } }
public PrimitiveComparison getPrimitiveComparison(String type, IndexSearchCondition sc) throws NoSuchPrimitiveComparisonException, SerDeException { Class<? extends PrimitiveComparison> clz = getPrimitiveComparisonClass(type); try { return clz.newInstance(); } catch (ClassCastException e) { throw new SerDeException("Column type mismatch in WHERE clause " + sc.getIndexExpr().getExprString() + " found type " + sc.getConstantDesc().getTypeString() + " instead of " + sc.getColumnDesc().getTypeString()); } catch (IllegalAccessException e) { throw new SerDeException("Could not instantiate class for WHERE clause", e); } catch (InstantiationException e) { throw new SerDeException("Could not instantiate class for WHERE clause", e); } }