APISonar


io.confluent.ksql.serde.Format.JSON

> io > confluent > ksql > serde > Format > JSON
io APIs confluent APIs ksql APIs serde APIs Format APIs JSON APIs

Example 1
public void shouldReturnCorrectSerdeFactory() {
    // When:
    final KStreamHolder<Struct> result = selectKey.build(planBuilder);

    // Then:
    result.getKeySerdeFactory().buildKeySerde(
        FormatInfo.of(Format.JSON),
        PhysicalSchema.from(SCHEMA, SerdeOption.none()),
        queryContext
    );
    verify(queryBuilder).buildKeySerde(
        FormatInfo.of(Format.JSON),
        PhysicalSchema.from(SCHEMA, SerdeOption.none()),
        queryContext);
  }
Example 2
public void shouldBuildLeftSerdeCorrectly() {
    // Given:
    givenInnerJoin();

    // When:
    join.build(planBuilder);

    // Then:
    final QueryContext leftCtx = QueryContext.Stacker.of(CTX).push("Left").getQueryContext();
    verify(queryBuilder).buildValueSerde(FormatInfo.of(Format.JSON), LEFT_PHYSICAL, leftCtx);
  }
Example 3
public void testCreateTable() {
    // When:
    final CreateTable result = (CreateTable) KsqlParserTestUtil.buildSingleAst(
        "CREATE TABLE users (usertime bigint, userid varchar, regionid varchar, gender varchar) "
            + "WITH (kafka_topic='foo', value_format='json', key='userid');", metaStore).getStatement();

    // Then:
    assertThat(result.getName(), equalTo(SourceName.of("USERS")));
    assertThat(Iterables.size(result.getElements()), equalTo(4));
    assertThat(Iterables.get(result.getElements(), 0).getName(), equalTo(ColumnName.of("USERTIME")));
    assertThat(result.getProperties().getKafkaTopic(), equalTo("foo"));
    assertThat(result.getProperties().getValueFormat(), equalTo(Format.JSON));
    assertThat(result.getProperties().getKeyField(), equalTo(Optional.of(ColumnRef.withoutSource(ColumnName.of("USERID")))));
  }