当前位置: 首页>>代码示例>>Java>>正文


Java SchemaBuilder.float64方法代码示例

本文整理汇总了Java中org.apache.kafka.connect.data.SchemaBuilder.float64方法的典型用法代码示例。如果您正苦于以下问题:Java SchemaBuilder.float64方法的具体用法?Java SchemaBuilder.float64怎么用?Java SchemaBuilder.float64使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.kafka.connect.data.SchemaBuilder的用法示例。


在下文中一共展示了SchemaBuilder.float64方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convertFieldType

import org.apache.kafka.connect.data.SchemaBuilder; //导入方法依赖的package包/类
private SchemaBuilder convertFieldType(Schema.Type type) {
    switch (type) {
        case INT8:
            return SchemaBuilder.int8();
        case INT16:
            return SchemaBuilder.int16();
        case INT32:
            return SchemaBuilder.int32();
        case INT64:
            return SchemaBuilder.int64();
        case FLOAT32:
            return SchemaBuilder.float32();
        case FLOAT64:
            return SchemaBuilder.float64();
        case BOOLEAN:
            return SchemaBuilder.bool();
        case STRING:
            return SchemaBuilder.string();
        default:
            throw new DataException("Unexpected type in Cast transformation: " + type);
    }

}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:24,代码来源:Cast.java

示例2: testPutPrimitives

import org.apache.kafka.connect.data.SchemaBuilder; //导入方法依赖的package包/类
/** Tests that an exception is thrown when the schema of the value is not BYTES. */
@Test
public void testPutPrimitives() {
  task.start(props);
  SinkRecord record8 =
      new SinkRecord(null, -1, null, null, SchemaBuilder.int8(), (byte) 5, -1);
  SinkRecord record16 =
      new SinkRecord(null, -1, null, null, SchemaBuilder.int16(), (short) 5, -1);
  SinkRecord record32 =
      new SinkRecord(null, -1, null, null, SchemaBuilder.int32(), (int) 5, -1);
  SinkRecord record64 =
      new SinkRecord(null, -1, null, null, SchemaBuilder.int64(), (long) 5, -1);
  SinkRecord recordFloat32 =
      new SinkRecord(null, -1, null, null, SchemaBuilder.float32(), (float) 8, -1);
  SinkRecord recordFloat64 =
      new SinkRecord(null, -1, null, null, SchemaBuilder.float64(), (double) 8, -1);
  SinkRecord recordBool =
      new SinkRecord(null, -1, null, null, SchemaBuilder.bool(), true, -1);
  SinkRecord recordString =
      new SinkRecord(null, -1, null, null, SchemaBuilder.string(), "Test put.", -1);
  List<SinkRecord> list = new ArrayList<>();
  list.add(record8);
  list.add(record16);
  list.add(record32);
  list.add(record64);
  list.add(recordFloat32);
  list.add(recordFloat64);
  list.add(recordBool);
  list.add(recordString);
  task.put(list);
}
 
开发者ID:GoogleCloudPlatform,项目名称:pubsub,代码行数:32,代码来源:CloudPubSubSinkTaskTest.java

示例3: parseDoubleValueTest

import org.apache.kafka.connect.data.SchemaBuilder; //导入方法依赖的package包/类
@Test
public void parseDoubleValueTest(){

	Schema schema = SchemaBuilder.float64();
	ByteBuffer actual = DataUtility.parseValue(schema, (double) 2);
	ByteBuffer expected = ByteBuffer.allocate(8).putDouble((double) 2);
	
	Assert.assertTrue(actual.equals(expected));
	
}
 
开发者ID:awslabs,项目名称:kinesis-kafka-connector,代码行数:11,代码来源:DataUtilityTest.java


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