Package net.hydromatic.linq4j.expressions

Examples of net.hydromatic.linq4j.expressions.Expression


      final JavaTypeFactory typeFactory = implementor.getTypeFactory();
      RelDataType inputRowType = child.getRowType();

      // final Enumerable<List<Employee>> child = <<child impl>>;
      // return child.selectMany(LIST_TO_ENUMERABLE);
      final Expression child_ =
          builder.append(
              "child", result.block);
      builder.add(
          Expressions.return_(null,
              Expressions.call(child_,
View Full Code Here


                  && Object[].class.isAssignableFrom((Class) getElementType()))
              ? JavaRowFormat.ARRAY
              : JavaRowFormat.CUSTOM);
      RexToLixTranslator t = RexToLixTranslator.forAggregation(
          (JavaTypeFactory) getCluster().getTypeFactory(), bb, null);
      final Expression translated = t.translate(getCall());
      bb.add(Expressions.return_(null, translated));
      return implementor.result(physType, bb.toBlock());
    }
View Full Code Here

  private static CallImplementor createImplementor(final Method method) {
    return RexImpTable.createImplementor(new ReflectiveCallNotNullImplementor(
        method) {
      public Expression implement(RexToLixTranslator translator,
          RexCall call, List<Expression> translatedOperands) {
        Expression expr = super.implement(translator, call,
            translatedOperands);
        Expression queryable = Expressions.call(
          Expressions.convert_(expr, QueryableTable.class),
          BuiltinMethod.QUERYABLE_TABLE_AS_QUERYABLE.method,
          Expressions.call(DataContext.ROOT,
            BuiltinMethod.DATA_CONTEXT_GET_QUERY_PROVIDER.method),
          Expressions.constant(null, SchemaPlus.class),
View Full Code Here

      SchemaPlus parentSchema,
      String name,
      DataSource dataSource,
      String catalog,
      String schema) {
    final Expression expression =
        Schemas.subSchemaExpression(parentSchema, name, JdbcSchema.class);
    final SqlDialect dialect = createDialect(dataSource);
    final JdbcConvention convention =
        JdbcConvention.of(dialect, expression, name);
    return new JdbcSchema(dataSource, dialect, convention, catalog, schema);
View Full Code Here

            getRowType(),
            JavaRowFormat.CUSTOM);
    SparkRel.Implementor sparkImplementor =
        new SparkImplementorImpl(implementor);
    final SparkRel.Result result = child.implementSpark(sparkImplementor);
    final Expression rdd = list.append("rdd", result.block);
    final Expression enumerable =
        list.append(
            "enumerable",
            Expressions.call(
                SparkMethod.AS_ENUMERABLE.method,
                rdd));
View Full Code Here

      final PhysType physType =
          PhysTypeImpl.of(
              implementor.getTypeFactory(),
              getRowType(),
              result.format);
      Expression childExp =
          builder.append(
              "child", result.block);

      Expression v = childExp;
      if (offset != null) {
        v = builder.append(
            "offset",
            Expressions.call(
                v,
View Full Code Here

      return new EnumerableUnionRel(getCluster(), traitSet, inputs, all);
    }

    public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
      final BlockBuilder builder = new BlockBuilder();
      Expression unionExp = null;
      for (Ord<RelNode> ord : Ord.zip(inputs)) {
        EnumerableRel input = (EnumerableRel) ord.e;
        final Result result = implementor.visitChild(this, ord.i, input, pref);
        Expression childExp =
            builder.append(
                "child" + ord.i,
                result.block);

        if (unionExp == null) {
View Full Code Here

          all);
    }

    public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
      final BlockBuilder builder = new BlockBuilder();
      Expression intersectExp = null;
      for (Ord<RelNode> ord : Ord.zip(inputs)) {
        EnumerableRel input = (EnumerableRel) ord.e;
        final Result result = implementor.visitChild(this, ord.i, input, pref);
        Expression childExp =
            builder.append(
                "child" + ord.i,
                result.block);

        if (intersectExp == null) {
View Full Code Here

          all);
    }

    public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
      final BlockBuilder builder = new BlockBuilder();
      Expression minusExp = null;
      for (Ord<RelNode> ord : Ord.zip(inputs)) {
        EnumerableRel input = (EnumerableRel) ord.e;
        final Result result = implementor.visitChild(this, ord.i, input, pref);
        Expression childExp =
            builder.append(
                "child" + ord.i,
                result.block);

        if (minusExp == null) {
View Full Code Here

    public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
      final BlockBuilder builder = new BlockBuilder();
      final Result result = implementor.visitChild(
          this, 0, (EnumerableRel) getChild(), pref);
      Expression childExp =
          builder.append(
              "child", result.block);
      final ParameterExpression collectionParameter =
          Expressions.parameter(Collection.class,
              builder.newName("collection"));
      final Expression expression = table.getExpression(ModifiableTable.class);
      assert expression != null; // TODO: user error in validator
      assert ModifiableTable.class.isAssignableFrom(
          Types.toClass(expression.getType())) : expression.getType();
      builder.add(
          Expressions.declare(
              Modifier.FINAL,
              collectionParameter,
              Expressions.call(
                  expression,
                  BuiltinMethod.MODIFIABLE_TABLE_GET_MODIFIABLE_COLLECTION
                      .method)));
      final Expression countParameter =
          builder.append(
              "count",
              Expressions.call(collectionParameter, "size"),
              false);
      Expression convertedChildExp;
      if (!getChild().getRowType().equals(getRowType())) {
        final JavaTypeFactory typeFactory =
            (JavaTypeFactory) getCluster().getTypeFactory();
        PhysType physType =
            PhysTypeImpl.of(
View Full Code Here

TOP

Related Classes of net.hydromatic.linq4j.expressions.Expression

Copyright © 2018 www.massapicom. 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.