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

Java RelProtoDataType类代码示例

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

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



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

示例1: DruidTable

import org.apache.calcite.rel.type.RelProtoDataType; //导入依赖的package包/类
/**
 * Creates a Druid table.
 *
 * @param schema Druid schema that contains this table
 * @param dataSource Druid data source name
 * @param protoRowType Field names and types
 * @param metricFieldNames Names of fields that are metrics
 * @param intervals Default interval if query does not constrain the time, or null
 * @param timestampFieldName Name of the column that contains the time
 */
public DruidTable(DruidSchema schema, String dataSource,
    RelProtoDataType protoRowType, Set<String> metricFieldNames,
    String timestampFieldName, List<Interval> intervals,
    Map<String, List<ComplexMetric>> complexMetrics, Map<String, SqlTypeName> allFields) {
  this.timestampFieldName = Preconditions.checkNotNull(timestampFieldName);
  this.schema = Preconditions.checkNotNull(schema);
  this.dataSource = Preconditions.checkNotNull(dataSource);
  this.protoRowType = protoRowType;
  this.metricFieldNames = ImmutableSet.copyOf(metricFieldNames);
  this.intervals = intervals != null ? ImmutableList.copyOf(intervals)
      : ImmutableList.of(DEFAULT_INTERVAL);
  this.complexMetrics = complexMetrics == null ? ImmutableMap.<String, List<ComplexMetric>>of()
          : ImmutableMap.copyOf(complexMetrics);
  this.allFields = allFields == null ? ImmutableMap.<String, SqlTypeName>of()
          : ImmutableMap.copyOf(allFields);
}
 
开发者ID:apache,项目名称:calcite,代码行数:27,代码来源:DruidTable.java


示例2: ColumnLoader

import org.apache.calcite.rel.type.RelProtoDataType; //导入依赖的package包/类
/** Creates a column loader, and performs the load.
 *
 * @param typeFactory Type factory
 * @param sourceTable Source data
 * @param protoRowType Logical row type
 * @param repList Physical row types, or null if not known */
ColumnLoader(JavaTypeFactory typeFactory,
    Enumerable<T> sourceTable,
    RelProtoDataType protoRowType,
    List<ColumnMetaData.Rep> repList) {
  this.typeFactory = typeFactory;
  final RelDataType rowType = protoRowType.apply(typeFactory);
  if (repList == null) {
    repList =
        Collections.nCopies(rowType.getFieldCount(),
            ColumnMetaData.Rep.OBJECT);
  }
  sourceTable.into(list);
  final int[] sorts = {-1};
  load(rowType, repList, sorts);
  this.sortField = sorts[0];
}
 
开发者ID:apache,项目名称:calcite,代码行数:23,代码来源:ColumnLoader.java


示例3: getParameters

import org.apache.calcite.rel.type.RelProtoDataType; //导入依赖的package包/类
public List<FunctionParameter> getParameters() {
  final List<FunctionParameter> parameters = new ArrayList<>();
  for (final Ord<RelProtoDataType> type : Ord.zip(getParams())) {
    parameters.add(
        new FunctionParameter() {
          public int getOrdinal() {
            return type.i;
          }

          public String getName() {
            return "arg" + type.i;
          }

          public RelDataType getType(RelDataTypeFactory typeFactory) {
            return type.e.apply(typeFactory);
          }

          public boolean isOptional() {
            return false;
          }
        });
  }
  return parameters;
}
 
开发者ID:apache,项目名称:calcite,代码行数:25,代码来源:UdfTest.java


示例4: getRelDataType

import org.apache.calcite.rel.type.RelProtoDataType; //导入依赖的package包/类
@Override
RelProtoDataType getRelDataType(
		DatabaseMetaData metaData,
		String catalogName,
		String schemaName,
		String tableName
) throws SQLException {
	if (journalledTableKeys.containsKey(tableName)) {
		// 1: Find columns for journal table
		RelDataType relDataType = super
				.getRelDataType(metaData, catalogName, schemaName, journalNameFor(tableName))
				.apply(new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT) {
					@Override
					public RelDataType copyType(RelDataType type) {
						return type;
					}
				});

		RelDataTypeFactory.FieldInfoBuilder fieldInfo = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT).builder();

		// 2: Filter out journal-implementation columns
		for (RelDataTypeField field : relDataType.getFieldList()) {
			String fieldName = field.getName();
			if (fieldName.equals(versionField) || fieldName.equals(subsequentVersionField)) {
				continue;
			}
			fieldInfo.add(field);
		}

		return RelDataTypeImpl.proto(fieldInfo.build());
	} else {
		return super.getRelDataType(metaData, catalogName, schemaName, tableName);
	}
}
 
开发者ID:tzolov,项目名称:calcite-sql-rewriter,代码行数:35,代码来源:JournalledJdbcSchema.java


示例5: toCalciteRowType

import org.apache.calcite.rel.type.RelProtoDataType; //导入依赖的package包/类
/**
 * Create an instance of {@code RelDataType} so it can be used to create a table.
 */
public static RelProtoDataType toCalciteRowType(final BeamRecordSqlType that) {
  return new RelProtoDataType() {
    @Override
    public RelDataType apply(RelDataTypeFactory a) {
      RelDataTypeFactory.FieldInfoBuilder builder = a.builder();
      for (int idx = 0; idx < that.getFieldNames().size(); ++idx) {
        builder.add(that.getFieldNameByIndex(idx), toCalciteType(that.getFieldTypeByIndex(idx)));
      }
      return builder.build();
    }
  };
}
 
开发者ID:apache,项目名称:beam,代码行数:16,代码来源:CalciteUtils.java


示例6: buildRowType

import org.apache.calcite.rel.type.RelProtoDataType; //导入依赖的package包/类
private RelProtoDataType buildRowType() {
  return new RelProtoDataType() {

    @Override public RelDataType apply(RelDataTypeFactory a0) {
      return a0.builder().add("id", SqlTypeName.INTEGER).add("order_id", SqlTypeName.BIGINT)
          .add("price", SqlTypeName.FLOAT).add("amount", SqlTypeName.DOUBLE)
          .add("user_name", SqlTypeName.VARCHAR).build();
    }
  };
}
 
开发者ID:apache,项目名称:beam,代码行数:11,代码来源:BeamTextCSVTableTest.java


示例7: genRowType

import org.apache.calcite.rel.type.RelProtoDataType; //导入依赖的package包/类
private static BeamRecordSqlType genRowType() {
  return CalciteUtils.toBeamRowType(new RelProtoDataType() {

    @Override public RelDataType apply(RelDataTypeFactory a0) {
      return a0.builder().add("order_id", SqlTypeName.BIGINT)
          .add("site_id", SqlTypeName.INTEGER)
          .add("price", SqlTypeName.DOUBLE).build();
    }
  }.apply(BeamQueryPlanner.TYPE_FACTORY));
}
 
开发者ID:apache,项目名称:beam,代码行数:11,代码来源:BeamKafkaCSVTableTest.java


示例8: encodeAndDecode

import org.apache.calcite.rel.type.RelProtoDataType; //导入依赖的package包/类
@Test
public void encodeAndDecode() throws Exception {
  final RelProtoDataType protoRowType = new RelProtoDataType() {
    @Override
    public RelDataType apply(RelDataTypeFactory a0) {
      return a0.builder()
          .add("col_tinyint", SqlTypeName.TINYINT)
          .add("col_smallint", SqlTypeName.SMALLINT)
          .add("col_integer", SqlTypeName.INTEGER)
          .add("col_bigint", SqlTypeName.BIGINT)
          .add("col_float", SqlTypeName.FLOAT)
          .add("col_double", SqlTypeName.DOUBLE)
          .add("col_decimal", SqlTypeName.DECIMAL)
          .add("col_string_varchar", SqlTypeName.VARCHAR)
          .add("col_time", SqlTypeName.TIME)
          .add("col_timestamp", SqlTypeName.TIMESTAMP)
          .add("col_boolean", SqlTypeName.BOOLEAN)
          .build();
    }
  };

  BeamRecordSqlType beamSQLRowType = CalciteUtils.toBeamRowType(
      protoRowType.apply(new JavaTypeFactoryImpl(
          RelDataTypeSystem.DEFAULT)));

  GregorianCalendar calendar = new GregorianCalendar();
  calendar.setTime(new Date());
  BeamRecord row = new BeamRecord(beamSQLRowType
      , Byte.valueOf("1"), Short.valueOf("1"), 1, 1L, 1.1F, 1.1
      , BigDecimal.ZERO, "hello", calendar, new Date(), true);


  BeamRecordCoder coder = beamSQLRowType.getRecordCoder();
  CoderProperties.coderDecodeEncodeEqual(coder, row);
}
 
开发者ID:apache,项目名称:beam,代码行数:36,代码来源:BeamSqlRowCoderTest.java


示例9: create

import org.apache.calcite.rel.type.RelProtoDataType; //导入依赖的package包/类
public CsvTable create(SchemaPlus schema, String name,
    Map<String, Object> operand, RelDataType rowType) {
  String fileName = (String) operand.get("file");
  final File base =
      (File) operand.get(ModelHandler.ExtraOperand.BASE_DIRECTORY.camelName);
  final Source source = Sources.file(base, fileName);
  final RelProtoDataType protoRowType =
      rowType != null ? RelDataTypeImpl.proto(rowType) : null;
  return new CsvScannableTable(source, protoRowType);
}
 
开发者ID:apache,项目名称:calcite,代码行数:11,代码来源:CsvTableFactory.java


示例10: create

import org.apache.calcite.rel.type.RelProtoDataType; //导入依赖的package包/类
public CsvTable create(SchemaPlus schema, String name,
    Map<String, Object> operand, RelDataType rowType) {
  String fileName = (String) operand.get("file");
  File file = new File(fileName);
  final File base =
      (File) operand.get(ModelHandler.ExtraOperand.BASE_DIRECTORY.camelName);
  if (base != null && !file.isAbsolute()) {
    file = new File(base, fileName);
  }
  final Source source = Sources.of(file);
  final RelProtoDataType protoRowType =
      rowType != null ? RelDataTypeImpl.proto(rowType) : null;
  return new CsvStreamScannableTable(source, protoRowType);
}
 
开发者ID:apache,项目名称:calcite,代码行数:15,代码来源:CsvStreamTableFactory.java


示例11: MutableArrayTable

import org.apache.calcite.rel.type.RelProtoDataType; //导入依赖的package包/类
/** Creates a MutableArrayTable.
 *
 * @param name Name of table within its schema
 * @param protoStoredRowType Prototype of row type of stored columns (all
 *     columns except virtual columns)
 * @param protoRowType Prototype of row type (all columns)
 * @param initializerExpressionFactory How columns are populated
 */
MutableArrayTable(String name, RelProtoDataType protoStoredRowType,
    RelProtoDataType protoRowType,
    InitializerExpressionFactory initializerExpressionFactory) {
  super(name);
  this.protoStoredRowType = Preconditions.checkNotNull(protoStoredRowType);
  this.protoRowType = Preconditions.checkNotNull(protoRowType);
  this.initializerExpressionFactory =
      Preconditions.checkNotNull(initializerExpressionFactory);
}
 
开发者ID:apache,项目名称:calcite,代码行数:18,代码来源:SqlCreateTable.java


示例12: CassandraEnumerator

import org.apache.calcite.rel.type.RelProtoDataType; //导入依赖的package包/类
/** Creates a CassandraEnumerator.
 *
 * @param results Cassandra result set ({@link com.datastax.driver.core.ResultSet})
 * @param protoRowType The type of resulting rows
 */
CassandraEnumerator(ResultSet results, RelProtoDataType protoRowType) {
  this.iterator = results.iterator();
  this.current = null;

  final RelDataTypeFactory typeFactory =
      new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
  this.fieldTypes = protoRowType.apply(typeFactory).getFieldList();
}
 
开发者ID:apache,项目名称:calcite,代码行数:14,代码来源:CassandraEnumerator.java


示例13: FileTable

import org.apache.calcite.rel.type.RelProtoDataType; //导入依赖的package包/类
/** Creates a FileTable. */
private FileTable(Source source, String selector, Integer index,
    RelProtoDataType protoRowType, List<Map<String, Object>> fieldConfigs)
    throws Exception {
  super(Object[].class);

  this.protoRowType = protoRowType;
  this.reader = new FileReader(source, selector, index);
  this.converter = new FileRowConverter(this.reader, fieldConfigs);
}
 
开发者ID:apache,项目名称:calcite,代码行数:11,代码来源:FileTable.java


示例14: getRelDataType

import org.apache.calcite.rel.type.RelProtoDataType; //导入依赖的package包/类
RelProtoDataType getRelDataType(String catalogName, String schemaName,
    String tableName) throws SQLException {
  Connection connection = null;
  try {
    connection = dataSource.getConnection();
    DatabaseMetaData metaData = connection.getMetaData();
    return getRelDataType(metaData, catalogName, schemaName, tableName);
  } finally {
    close(connection, null, null);
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:12,代码来源:JdbcSchema.java


示例15: createCloneTable

import org.apache.calcite.rel.type.RelProtoDataType; //导入依赖的package包/类
@Deprecated // to be removed before 2.0
public static <T> Table createCloneTable(final JavaTypeFactory typeFactory,
    final RelProtoDataType protoRowType,
    final List<ColumnMetaData.Rep> repList,
    final Enumerable<T> source) {
  return createCloneTable(typeFactory, protoRowType,
      ImmutableList.<RelCollation>of(), repList, source);
}
 
开发者ID:apache,项目名称:calcite,代码行数:9,代码来源:CloneSchema.java


示例16: ListTable

import org.apache.calcite.rel.type.RelProtoDataType; //导入依赖的package包/类
/** Creates a ListTable. */
ListTable(
    Type elementType,
    RelProtoDataType protoRowType,
    Expression expression,
    List list) {
  super(elementType);
  this.protoRowType = protoRowType;
  this.expression = expression;
  this.list = list;
}
 
开发者ID:apache,项目名称:calcite,代码行数:12,代码来源:ListTable.java


示例17: ArrayTable

import org.apache.calcite.rel.type.RelProtoDataType; //导入依赖的package包/类
/** Creates an ArrayTable. */
ArrayTable(Type elementType, RelProtoDataType protoRowType,
    Supplier<Content> supplier) {
  super(elementType);
  this.protoRowType = protoRowType;
  this.supplier = supplier;
}
 
开发者ID:apache,项目名称:calcite,代码行数:8,代码来源:ArrayTable.java


示例18: TableFunctionReturnTypeInference

import org.apache.calcite.rel.type.RelProtoDataType; //导入依赖的package包/类
public TableFunctionReturnTypeInference(
    RelProtoDataType unexpandedOutputType,
    List<String> paramNames,
    boolean isPassthrough) {
  super(unexpandedOutputType);
  this.paramNames = paramNames;
  this.isPassthrough = isPassthrough;
}
 
开发者ID:apache,项目名称:calcite,代码行数:9,代码来源:TableFunctionReturnTypeInference.java


示例19: proto

import org.apache.calcite.rel.type.RelProtoDataType; //导入依赖的package包/类
/** Returns an implementation of
 * {@link RelProtoDataType}
 * that asks a given table for its row type with a given type factory. */
public static RelProtoDataType proto(final Table table) {
  return new RelProtoDataType() {
    public RelDataType apply(RelDataTypeFactory typeFactory) {
      return table.getRowType(typeFactory);
    }
  };
}
 
开发者ID:apache,项目名称:calcite,代码行数:11,代码来源:Schemas.java


示例20: ModifiableViewTable

import org.apache.calcite.rel.type.RelProtoDataType; //导入依赖的package包/类
/** Creates a ModifiableViewTable. */
public ModifiableViewTable(Type elementType, RelProtoDataType rowType,
    String viewSql, List<String> schemaPath, List<String> viewPath,
    Table table, Path tablePath, RexNode constraint,
    ImmutableIntList columnMapping) {
  super(elementType, rowType, viewSql, schemaPath, viewPath);
  this.table = table;
  this.tablePath = tablePath;
  this.constraint = constraint;
  this.columnMapping = columnMapping;
  this.initializerExpressionFactory = new ModifiableViewTableInitializerExpressionFactory();
}
 
开发者ID:apache,项目名称:calcite,代码行数:13,代码来源:ModifiableViewTable.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java CommandsManager类代码示例发布时间:2022-05-22
下一篇:
Java ExponentialBackoffDelayGenerator类代码示例发布时间: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