@Override public Boolean visitCastExpression(CastExpression e, ErrorCollector errors) { return e.getInput().accept(this, errors); }
@Override public Boolean visitCastExpression(CastExpression e, ErrorCollector value) throws RuntimeException { return e.getInput().accept(this, value); }
@Override public Void visitCastExpression(CastExpression e, ErrorCollector value) throws RuntimeException { return e.getInput().accept(this, value); }
private void init() { int count = 0; for (LogicalExpression indexedExpr : indexDesc.getIndexColumns()) { if (!(indexedExpr instanceof SchemaPath)) { hasFunctionalField = true; SchemaPath functionalFieldPath = SchemaPath.getSimplePath("$"+count); newPathsForIndexedFunction.add(functionalFieldPath); // now we handle only cast expression if (indexedExpr instanceof CastExpression) { // We handle only CAST directly on SchemaPath for now. SchemaPath pathBeingCasted = (SchemaPath)((CastExpression) indexedExpr).getInput(); addTargetPathForOriginalPath(pathBeingCasted, functionalFieldPath); addPathInExpr(indexedExpr, pathBeingCasted); exprToConvert.put(indexedExpr, functionalFieldPath); allPathsInFunction.add(pathBeingCasted); } count++; } } }
e.getInput().accept(this, sb); sb.append(" ) as "); sb.append(mt.getMinorType().name());
@Override public Boolean visitCastExpression(CastExpression e, IdentityHashMap<LogicalExpression, Object> value) throws RuntimeException { return e.getInput().accept(this, value); }
@Override public Boolean visitCastExpression(CastExpression e, ErrorCollector errors) { return e.getInput().accept(this, errors); }
@Override public Boolean visitCastExpression(CastExpression e, ErrorCollector value) throws RuntimeException { return e.getInput().accept(this, value); }
@Override public Void visitCastExpression(CastExpression e, ErrorCollector value) throws RuntimeException { return e.getInput().accept(this, value); }
@Override public ExprNode visitCastExpression(CastExpression e, Void value) throws RuntimeException { if (e.getInput() instanceof FieldReference) { FieldReference fieldRef = (FieldReference) e.getInput(); String field = fieldRef.getRootSegmentPath().toUpperCase(); if (field.equals(CATS_COL_CATALOG_NAME) || field.equals(SCHS_COL_SCHEMA_NAME) || field.equals(SHRD_COL_TABLE_NAME) || field.equals(SHRD_COL_TABLE_SCHEMA) || field.equals(COLS_COL_COLUMN_NAME) || field.equals(FILES_COL_ROOT_SCHEMA_NAME) || field.equals(FILES_COL_WORKSPACE_NAME)) { return new FieldExprNode(field); } } return visitUnknown(e, value); }
public Boolean visitCastExpression(CastExpression castExpr, Void value) throws RuntimeException { if (preProcess(castExpr)) { //when it is true, we know this is exactly the indexed expression, no more deep search return true; } return castExpr.getInput().accept(this, null); }
boolean castIsCompatible(CastExpression castExpr, Collection<LogicalExpression> indexFields) { for (LogicalExpression indexExpr : indexFields) { if (indexExpr.getClass() != castExpr.getClass()) { continue; } CastExpression indexCastExpr = (CastExpression)indexExpr; // we compare input using equals because we know we are comparing SchemaPath, // if we extend to support other expression, make sure the equals of that expression // is implemented properly, otherwise it will fall to identity comparison if (!castExpr.getInput().equals(indexCastExpr.getInput()) ) { continue; } if (castExpr.getMajorType().getMinorType() != indexCastExpr.getMajorType().getMinorType()) { continue; } return true; } return false; }
private void init() { int count = 0; for (LogicalExpression indexedExpr : indexDesc.getIndexColumns()) { if (!(indexedExpr instanceof SchemaPath)) { hasFunctionalField = true; SchemaPath functionalFieldPath = SchemaPath.getSimplePath("$"+count); newPathsForIndexedFunction.add(functionalFieldPath); // now we handle only cast expression if (indexedExpr instanceof CastExpression) { // We handle only CAST directly on SchemaPath for now. SchemaPath pathBeingCasted = (SchemaPath)((CastExpression) indexedExpr).getInput(); addTargetPathForOriginalPath(pathBeingCasted, functionalFieldPath); addPathInExpr(indexedExpr, pathBeingCasted); exprToConvert.put(indexedExpr, functionalFieldPath); allPathsInFunction.add(pathBeingCasted); } count++; } } }
e.getInput().accept(this, sb); sb.append(" ) as "); sb.append(mt.getMinorType().name());
@Override public RexNode visitCastExpression(CastExpression e, Void value) throws RuntimeException { RexNode convertedInput = e.getInput().accept(this, null); String typeStr = e.getMajorType().getMinorType().toString(); if (SqlTypeName.get(typeStr) == null) { logger.debug("SqlTypeName could not find {}", typeStr); } SqlTypeName typeName = TypeInferenceUtils.getCalciteTypeFromDrillType(e.getMajorType().getMinorType()); RelDataType targetType = TypeInferenceUtils.createCalciteTypeWithNullability( inputRel.getCluster().getTypeFactory(), typeName, true); return builder.makeCast(targetType, convertedInput); }
LogicalExpression input = e.getInput().accept(this, functionLookupContext);