• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java RelDataType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eigenbase.reltype.RelDataType的典型用法代码示例。如果您正苦于以下问题:Java RelDataType类的具体用法?Java RelDataType怎么用?Java RelDataType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RelDataType类属于org.eigenbase.reltype包,在下文中一共展示了RelDataType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: create

import org.eigenbase.reltype.RelDataType; //导入依赖的package包/类
public SolrTable create(SchemaPlus schema, String name,
                        Map<String, Object> map, RelDataType rowType) {
    String host = (String) map.get("host");

    SolrServer server = new HttpSolrServer(host);

    SolrQuery query = new SolrQuery();
    query.setQuery( "*:*" );
    query.setFacetLimit(100000);
    query.setParam("rows","10000");
    SolrDocumentList res = null;
    try {
        res = server.query(query).getResults();
    } catch (SolrServerException e) {
        e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
    }
    assert res != null;

    final List<SolrFieldType> list = new ArrayList<SolrFieldType>();
    return new SolrTable(schema, name, res, server);
}
 
开发者ID:OSBI,项目名称:optiq-solr,代码行数:22,代码来源:SolrTableFactory.java


示例2: implementRewrite

import org.eigenbase.reltype.RelDataType; //导入依赖的package包/类
/**
 * Because OLAPTableScan is reused for the same table, we can't use
 * this.context and have to use parent context
 */
@Override
public void implementRewrite(RewriteImplementor implementor) {
    Map<String, RelDataType> rewriteFields = this.context.rewriteFields;
    if (implementor.getParentContext() != null) {
        rewriteFields = implementor.getParentContext().rewriteFields;
    }

    for (Map.Entry<String, RelDataType> rewriteField : rewriteFields.entrySet()) {
        String fieldName = rewriteField.getKey();
        RelDataTypeField field = rowType.getField(fieldName, true);
        if (field != null) {
            RelDataType fieldType = field.getType();
            rewriteField.setValue(fieldType);
        }
    }
}
 
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:21,代码来源:OLAPTableScan.java


示例3: createSqlType

import org.eigenbase.reltype.RelDataType; //导入依赖的package包/类
private RelDataType createSqlType(RelDataTypeFactory typeFactory, ColumnDesc column) {
    SqlTypeName sqlTypeName = SQLTYPE_MAPPING.get(column.getTypeName());
    if (sqlTypeName == null)
        throw new IllegalArgumentException("Unrecognized column type " + column.getTypeName() + " from " + column);

    int precision = column.getTypePrecision();
    int scale = column.getTypeScale();

    RelDataType result;
    if (precision >= 0 && scale >= 0)
        result = typeFactory.createSqlType(sqlTypeName, precision, scale);
    else if (precision >= 0)
        result = typeFactory.createSqlType(sqlTypeName, precision);
    else
        result = typeFactory.createSqlType(sqlTypeName);

    // due to left join and uncertain data quality, dimension value can be
    // null
    if (column.isNullable()) {
        result = typeFactory.createTypeWithNullability(result, true);
    } else {
        result = typeFactory.createTypeWithNullability(result, false);
    }

    return result;
}
 
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:27,代码来源:OLAPTable.java


示例4: getTypeClass

import org.eigenbase.reltype.RelDataType; //导入依赖的package包/类
public static Class<? extends Value> getTypeClass(RelDataType type) {
	if(type.getSqlTypeName() == SqlTypeName.INTEGER) {
		return IntValue.class;
	}
	if(type.getSqlTypeName() == SqlTypeName.VARCHAR || type.getSqlTypeName() == SqlTypeName.CHAR) {
		return StringValue.class;
	}
	if(type.getSqlTypeName() == SqlTypeName.DOUBLE) {
		return DoubleValue.class;
	}
	if(type.getSqlTypeName() == SqlTypeName.BIGINT) {
		return LongValue.class;
	}
	if(type.getSqlTypeName() == SqlTypeName.DECIMAL) {
		return DecimalValue.class;
	}
	if(type.getSqlTypeName() == SqlTypeName.DATE) {
		return DateValue.class;
	}
	throw new RuntimeException("Unsupported type "+type);
}
 
开发者ID:rmetzger,项目名称:stratosphere-sql,代码行数:22,代码来源:StratosphereRelUtils.java


示例5: prepareShipping

import org.eigenbase.reltype.RelDataType; //导入依赖的package包/类
/**
 * Create the list of fields.
 * @param rowType
 */
public void prepareShipping(RelDataType rowType) {
	Preconditions.checkNotNull(condition);
	Preconditions.checkNotNull(rexBuilder);

	StratosphereRexUtils.GetInputRefVisitor replaceInputRefsByExternalInputRefsVisitor = new StratosphereRexUtils.GetInputRefVisitor();
	condition.accept(replaceInputRefsByExternalInputRefsVisitor);

	final ImmutableList<RexNode> localExps = ImmutableList.of(condition);

	fields = new HashSet<StratosphereRexUtils.ProjectionFieldProperties>();
	int pos = 0;
	for(Pair<Integer, RelDataType> rexInput : replaceInputRefsByExternalInputRefsVisitor.getInputPosAndType() ) {
		StratosphereRexUtils.ProjectionFieldProperties field = new StratosphereRexUtils.ProjectionFieldProperties();
		field.fieldIndex = pos++;
		field.positionInInput = rexInput.getKey();
		field.inFieldType = StratosphereRelUtils.getTypeClass(rexInput.getValue());
		field.name = condition.toString();
		fields.add(field);
	}
	final RexExecutorImpl executor = new RexExecutorImpl(null);
	RexExecutable executable = executor.getExecutable(rexBuilder, localExps, rowType);
	System.err.println("Code: "+executable.getSource());
	this.source = executable.getSource();
}
 
开发者ID:rmetzger,项目名称:stratosphere-sql,代码行数:29,代码来源:Filter.java


示例6: deriveRowType

import org.eigenbase.reltype.RelDataType; //导入依赖的package包/类
@Override
public RelDataType deriveRowType() {
    final RelDataTypeFactory.FieldInfoBuilder builder =
            getCluster().getTypeFactory().builder();
    for (int field : fields) {
        builder.add(table.getRowType().getFieldList().get(field));
    }
    return getCluster().getTypeFactory().createStructType(builder);
}
 
开发者ID:OSBI,项目名称:optiq-solr,代码行数:10,代码来源:SolrTableScan.java


示例7: getRowType

import org.eigenbase.reltype.RelDataType; //导入依赖的package包/类
public RelDataType getRowType(RelDataTypeFactory typeFactory) {
    if (protoRowType != null) {
        return protoRowType.apply(typeFactory);
    }
    if (fieldTypes == null) {
        fieldTypes = new ArrayList<SolrFieldType>();
        return deduceRowType((JavaTypeFactory) typeFactory, server, fieldTypes);
    } else {
        fieldTypes = new ArrayList<SolrFieldType>();
        return deduceRowType((JavaTypeFactory) typeFactory, server, fieldTypes);
    }

    //return rowType;
}
 
开发者ID:OSBI,项目名称:optiq-solr,代码行数:15,代码来源:SolrTable.java


示例8: getRowType

import org.eigenbase.reltype.RelDataType; //导入依赖的package包/类
@Override
public RelDataType getRowType(RelDataTypeFactory typeFactory) {
  ArrayList<RelDataType> typeList = new ArrayList<>();
  ArrayList<String> fieldNameList = new ArrayList<>();

  fieldNameList.add(KEY_NAME);
  typeList.add(typeFactory.createSqlType(SqlTypeName.ANY));
  fieldNameList.add(KEY_VALUE);
  typeList.add(typeFactory.createSqlType(SqlTypeName.ANY));

  return typeFactory.createStructType(typeList, fieldNameList);
}
 
开发者ID:jacques-n,项目名称:drill-couchbase-plugin,代码行数:13,代码来源:DrillCouchbaseTable.java


示例9: implement

import org.eigenbase.reltype.RelDataType; //导入依赖的package包/类
@Override
public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
    // keep it for having clause
    RexBuilder rexBuilder = getCluster().getRexBuilder();
    RelDataType inputRowType = getChild().getRowType();
    RexProgramBuilder programBuilder = new RexProgramBuilder(inputRowType, rexBuilder);
    programBuilder.addIdentity();
    programBuilder.addCondition(this.condition);
    RexProgram program = programBuilder.getProgram();

    EnumerableCalcRel enumCalcRel = new EnumerableCalcRel(getCluster(), getCluster().traitSetOf(EnumerableConvention.INSTANCE), getChild(), this.rowType, program, ImmutableList.<RelCollation> of());

    return enumCalcRel.implement(implementor, pref);
}
 
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:15,代码来源:OLAPFilterRel.java


示例10: OLAPProjectRel

import org.eigenbase.reltype.RelDataType; //导入依赖的package包/类
public OLAPProjectRel(RelOptCluster cluster, RelTraitSet traitSet, RelNode child, List<RexNode> exps, RelDataType rowType, int flags) {
    super(cluster, traitSet, child, exps, rowType, flags);
    Preconditions.checkArgument(getConvention() == OLAPRel.CONVENTION);
    Preconditions.checkArgument(child.getConvention() == OLAPRel.CONVENTION);
    this.rewriteProjects = exps;
    this.hasJoin = false;
    this.afterJoin = false;
    this.rowType = getRowType();
}
 
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:10,代码来源:OLAPProjectRel.java


示例11: implementRewrite

import org.eigenbase.reltype.RelDataType; //导入依赖的package包/类
@Override
public void implementRewrite(RewriteImplementor implementor) {
    implementor.visitChild(this, this.left);
    implementor.visitChild(this, this.right);

    this.rowType = this.deriveRowType();

    if (this.isTopJoin && RewriteImplementor.needRewrite(this.context)) {
        // find missed rewrite fields
        int paramIndex = this.rowType.getFieldList().size();
        List<RelDataTypeField> newFieldList = new LinkedList<RelDataTypeField>();
        for (Map.Entry<String, RelDataType> rewriteField : this.context.rewriteFields.entrySet()) {
            String fieldName = rewriteField.getKey();
            if (this.rowType.getField(fieldName, true) == null) {
                RelDataType fieldType = rewriteField.getValue();
                RelDataTypeField newField = new RelDataTypeFieldImpl(fieldName, paramIndex++, fieldType);
                newFieldList.add(newField);
            }
        }

        // rebuild row type
        FieldInfoBuilder fieldInfo = getCluster().getTypeFactory().builder();
        fieldInfo.addAll(this.rowType.getFieldList());
        fieldInfo.addAll(newFieldList);
        this.rowType = getCluster().getTypeFactory().createStructType(fieldInfo);
        this.context.olapRowType = this.rowType;

        // rebuild columns
        this.columnRowType = this.buildColumnRowType();
    }
}
 
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:32,代码来源:OLAPJoinRel.java


示例12: buildHiveResult

import org.eigenbase.reltype.RelDataType; //导入依赖的package包/类
private Result buildHiveResult(EnumerableRelImplementor enumImplementor, Prefer pref, OLAPContext context) {
    RelDataType hiveRowType = getRowType();

    context.olapRowType = hiveRowType;
    PhysType physType = PhysTypeImpl.of(enumImplementor.getTypeFactory(), hiveRowType, pref.preferArray());

    RelOptTable factTable = context.firstTableScan.getTable();
    Result result = enumImplementor.result(physType, Blocks.toBlock(Expressions.call(factTable.getExpression(OLAPTable.class), "executeHiveQuery", enumImplementor.getRootExpression())));
    return result;
}
 
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:11,代码来源:OLAPToEnumerableConverter.java


示例13: fillbackOptimizedColumn

import org.eigenbase.reltype.RelDataType; //导入依赖的package包/类
private void fillbackOptimizedColumn() {
    // some aggcall will be optimized out in sub-query (e.g. tableau generated sql)
    // we need to fill them back
    RelDataType inputAggRow = getChild().getRowType();
    RelDataType outputAggRow = getRowType();
    if (inputAggRow.getFieldCount() != outputAggRow.getFieldCount()) {
        for (RelDataTypeField inputField : inputAggRow.getFieldList()) {
            String inputFieldName = inputField.getName();
            if (outputAggRow.getField(inputFieldName, true) == null) {
                TblColRef column = this.columnRowType.getColumnByIndex(inputField.getIndex());
                this.context.metricsColumns.add(column);
            }
        }
    }
}
 
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:16,代码来源:OLAPAggregateRel.java


示例14: rewriteAggregateCall

import org.eigenbase.reltype.RelDataType; //导入依赖的package包/类
private AggregateCall rewriteAggregateCall(AggregateCall aggCall, FunctionDesc func) {

        // rebuild parameters
        List<Integer> newArgList = new ArrayList<Integer>(1);
        String fieldName = func.getRewriteFieldName();
        RelDataTypeField field = getChild().getRowType().getField(fieldName, true);
        newArgList.add(field.getIndex());

        // rebuild function
        RelDataType fieldType = aggCall.getType();
        Aggregation newAgg = aggCall.getAggregation();
        if (func.isCountDistinct()) {
            newAgg = createHyperLogLogAggFunction(fieldType);
        } else if (func.isCount()) {
            newAgg = new SqlSumEmptyIsZeroAggFunction(fieldType);
        }

        // rebuild aggregate call
        AggregateCall newAggCall = new AggregateCall(newAgg, false, newArgList, fieldType, newAgg.getName());

        // To make sure specified type matches the inferReturnType, or otherwise
        // there will be assertion failure in optiq
        // The problem is BIGINT != BIGINT NOT NULL
        // Details see https://github.scm.corp.ebay.com/Kylin/Kylin/issues/323
        SqlAggFunction aggFunction = (SqlAggFunction) newAggCall.getAggregation();
        AggCallBinding callBinding = newAggCall.createBinding(this);
        RelDataType inferReturnType = aggFunction.inferReturnType(callBinding);

        return new AggregateCall(newAgg, false, newArgList, inferReturnType, newAgg.getName());
    }
 
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:31,代码来源:OLAPAggregateRel.java


示例15: createHyperLogLogAggFunction

import org.eigenbase.reltype.RelDataType; //导入依赖的package包/类
private Aggregation createHyperLogLogAggFunction(RelDataType returnType) {
    RelDataTypeFactory typeFactory = getCluster().getTypeFactory();
    SqlIdentifier sqlIdentifier = new SqlIdentifier("HLL_COUNT", new SqlParserPos(1, 1));
    AggregateFunction aggFunction = AggregateFunctionImpl.create(HLLDistinctCountAggFunc.class);
    List<RelDataType> argTypes = new ArrayList<RelDataType>();
    List<SqlTypeFamily> typeFamilies = new ArrayList<SqlTypeFamily>();
    for (FunctionParameter o : aggFunction.getParameters()) {
        final RelDataType type = o.getType(typeFactory);
        argTypes.add(type);
        typeFamilies.add(Util.first(type.getSqlTypeName().getFamily(), SqlTypeFamily.ANY));
    }
    return new SqlUserDefinedAggFunction(sqlIdentifier, ReturnTypes.explicit(returnType), InferTypes.explicit(argTypes), OperandTypes.family(typeFamilies), aggFunction);
}
 
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:14,代码来源:OLAPAggregateRel.java


示例16: deriveRowType

import org.eigenbase.reltype.RelDataType; //导入依赖的package包/类
@Override
public RelDataType deriveRowType() {
    final List<RelDataTypeField> fieldList = table.getRowType().getFieldList();
    final RelDataTypeFactory.FieldInfoBuilder builder = getCluster().getTypeFactory().builder();
    for (int field : fields) {
        builder.add(fieldList.get(field));
    }
    return getCluster().getTypeFactory().createStructType(builder);
}
 
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:10,代码来源:OLAPTableScan.java


示例17: getRowType

import org.eigenbase.reltype.RelDataType; //导入依赖的package包/类
@Override
public RelDataType getRowType(RelDataTypeFactory typeFactory) {
    if (this.rowType == null) {
        // always build exposedColumns and rowType together
        this.exposedColumns = listSourceColumns();
        this.rowType = deduceRowType(typeFactory);
    }
    return this.rowType;
}
 
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:10,代码来源:OLAPTable.java


示例18: deduceRowType

import org.eigenbase.reltype.RelDataType; //导入依赖的package包/类
private RelDataType deduceRowType(RelDataTypeFactory typeFactory) {
    RelDataTypeFactory.FieldInfoBuilder fieldInfo = typeFactory.builder();
    for (ColumnDesc column : exposedColumns) {
        RelDataType sqlType = createSqlType(typeFactory, column);
        sqlType = SqlTypeUtil.addCharsetAndCollation(sqlType, typeFactory);
        fieldInfo.add(column.getName(), sqlType);
    }
    return typeFactory.createStructType(fieldInfo);
}
 
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:10,代码来源:OLAPTable.java


示例19: newValue

import org.eigenbase.reltype.RelDataType; //导入依赖的package包/类
public static Value newValue(RelDataType in) {
	if(in.getSqlTypeName() == SqlTypeName.INTEGER) {
		return new IntValue();
	}
	if(in.getSqlTypeName() == SqlTypeName.VARCHAR) {
		return new StringValue();
	}
	throw new RuntimeException("Unsupported type "+in);
}
 
开发者ID:rmetzger,项目名称:stratosphere-sql,代码行数:10,代码来源:StratosphereRelUtils.java


示例20: getKeyTypeClass

import org.eigenbase.reltype.RelDataType; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static Class<? extends Key<?>> getKeyTypeClass(RelDataType type) {
	final Class<? extends Value> val = getTypeClass(type);
	if(Key.class.isAssignableFrom(val) ) {
		return (Class<? extends Key<?>>) val;
	}
	throw new RuntimeException("RelDataType is not a Key: "+type+" to val "+val);
}
 
开发者ID:rmetzger,项目名称:stratosphere-sql,代码行数:9,代码来源:StratosphereRelUtils.java



注:本文中的org.eigenbase.reltype.RelDataType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FakeTaskTrackerManager类代码示例发布时间:2022-05-22
下一篇:
Java BootLogger类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap