Examples of CastExpression


Examples of client.net.sf.saxon.ce.expr.CastExpression

                err.setErrorCode("XPST0017");
                err.setIsStaticError(true);
                throw err;
            }

            Expression cast = new CastExpression(arguments[0], type, true);
            cast.setContainer(container);
            return cast;
        }
        return null;
    }
View Full Code Here

Examples of com.dragome.compiler.ast.CastExpression

      }

      case Const.CHECKCAST:
      {

        CastExpression cast= new CastExpression();
        int index= bytes.readUnsignedShort();
        ConstantClass c= (ConstantClass) constantPool.getConstant(index);
        ObjectType type= new ObjectType(c.getBytes(constantPool).replace('/', '.'));
        cast.setTypeBinding(type);
        cast.setExpression(stack.pop());
        instruction= cast;
        break;
      }

      case Const.INSTANCEOF:
View Full Code Here

Examples of net.sf.saxon.expr.CastExpression

                err.setErrorCode("XPST0017");
                err.setIsStaticError(true);
                throw err;
            }

            return new CastExpression(arguments[0], type, true);
        }

        // Now see if it's a constructor function for a user-defined type

        if (arguments.length == 1) {
            int fp = config.getNamePool().getFingerprint(uri, localName);
            if (fp != -1) {
                SchemaType st = config.getSchemaType(fp);
                if (st != null && st.isAtomicType()) {
                    return new CastExpression(arguments[0], (AtomicType)st, true);
                }
            }
        }

        return null;
View Full Code Here

Examples of net.sf.saxon.expr.CastExpression

            AtomicType type = (AtomicType)Type.getBuiltInItemType(uri, localName);
            if (type==null) {
                return new ErrorExpression(
                            new DynamicError("Unknown constructor function: " + localName));
            }
            return new CastExpression(arguments[0], type, false);
        }

        // Now see if it's a constructor function for a user-defined type

        if (arguments.length == 1) {
            SchemaType st = config.getSchemaType(nameCode & 0xfffff);
            if (st != null && st instanceof AtomicType) {
                return new CastExpression(arguments[0], (AtomicType)st, false);
            }
        }

        return null;
    }
View Full Code Here

Examples of net.sf.saxon.expr.CastExpression

                err.setErrorCode("XPST0017");
                err.setIsStaticError(true);
                throw err;
            }

            return new CastExpression(arguments[0], type, true);
        }

        // Now see if it's a constructor function for a user-defined type

        if (arguments.length == 1) {
            int fp = config.getNamePool().getFingerprint(uri, localName);
            if (fp != -1) {
                SchemaType st = config.getSchemaType(fp);
                if (st != null && st.isAtomicType()) {
                    return new CastExpression(arguments[0], (AtomicType)st, true);
                }
            }
        }

        return null;
View Full Code Here

Examples of org.apache.drill.common.expression.CastExpression

      if(castEqual(e.getPosition(), newMajor, input.getMajorType())) return input; // don't do pointless cast.

      if(newMinor == MinorType.LATE){
        // if the type still isn't fully bound, leave as cast expression.
        return new CastExpression(input, e.getMajorType(), e.getPosition());
      } else if (newMinor == MinorType.NULL) {
        // if input is a NULL expression, remove cast expression and return a TypedNullConstant directly. 
        return new TypedNullConstant(Types.optional(e.getMajorType().getMinorType()));
      } else {
        // if the type is fully bound, convert to functioncall and materialze the function.
View Full Code Here

Examples of org.apache.pig.experimental.logical.expression.CastExpression

        public void visit(LOCast cast) throws VisitorException {
            byte b = cast.getType();
            ExpressionOperator exp = cast.getExpression();
           
            CastExpression c = new CastExpression(exprPlan, b, exprOpsMap.get(exp));
            c.setFuncSpec(cast.getLoadFuncSpec());
            exprOpsMap.put(cast, c);
        }
View Full Code Here

Examples of org.apache.pig.newplan.logical.expression.CastExpression

               
                if (fs.type != DataType.BYTEARRAY && (determinedSchema == null || (!fs.isEqual(determinedSchema.getField(i))))) {
                    // Either no schema was determined by loader OR the type
                    // from the "determinedSchema" is different
                    // from the type specified - so we need to cast
                    CastExpression cast = new CastExpression(exp, prj, new LogicalSchema.LogicalFieldSchema(fs));
                    exp.add(cast);
                    FuncSpec loadFuncSpec = null;
                    if(op instanceof LOLoad) {
                        loadFuncSpec = ((LOLoad)op).getFileSpec().getFuncSpec();
                    } else if (op instanceof LOStream) {
                        StreamingCommand command = ((LOStream)op).getStreamingCommand();
                        HandleSpec streamOutputSpec = command.getOutputSpec();
                        loadFuncSpec = new FuncSpec(streamOutputSpec.getSpec());
                    } else {
                        String msg = "TypeCastInserter invoked with an invalid operator class name: " + innerPlan.getClass().getSimpleName();
                        throw new FrontendException(msg, 2242);
                    }
                    cast.setFuncSpec(loadFuncSpec);
                }
                exps.add(exp);
            }
            if (op instanceof LOLoad)
                ((LOLoad)op).setCastInserted(true);
View Full Code Here

Examples of org.apache.pig.newplan.logical.expression.CastExpression

    }

    public void visit(LOCast cast) throws VisitorException {
        ExpressionOperator exp = cast.getExpression();
       
        CastExpression c = null;
        try {
            c = new CastExpression(exprPlan, exprOpsMap.get(exp), Util.translateFieldSchema(cast.getFieldSchema()));
        } catch (FrontendException e) {
            throw new VisitorException(e);
        }
        c.setFuncSpec(cast.getLoadFuncSpec());
        exprOpsMap.put(cast, c);
    }
View Full Code Here

Examples of org.apache.pig.newplan.logical.expression.CastExpression

               
                if (fs.type != DataType.BYTEARRAY && (determinedSchema == null || (!fs.isEqual(determinedSchema.getField(i))))) {
                    // Either no schema was determined by loader OR the type
                    // from the "determinedSchema" is different
                    // from the type specified - so we need to cast
                    CastExpression cast = new CastExpression(exp, prj, new LogicalSchema.LogicalFieldSchema(fs));
                    exp.add(cast);
                    FuncSpec loadFuncSpec = null;
                    if(op instanceof LOLoad) {
                        loadFuncSpec = ((LOLoad)op).getFileSpec().getFuncSpec();
                    } else if (op instanceof LOStream) {
                        StreamingCommand command = ((LOStream)op).getStreamingCommand();
                        HandleSpec streamOutputSpec = command.getOutputSpec();
                        loadFuncSpec = new FuncSpec(streamOutputSpec.getSpec());
                    } else {
                        String msg = "TypeCastInserter invoked with an invalid operator class name: " + innerPlan.getClass().getSimpleName();
                        throw new FrontendException(msg, 2242);
                    }
                    cast.setFuncSpec(loadFuncSpec);
                }
                exps.add(exp);
            }
            markCastInserted(op);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.