Search in sources :

Example 1 with AvroSchema

use of org.apache.pulsar.client.impl.schema.AvroSchema in project pulsar by yahoo.

the class TestAvroDecoder method testCyclicDefinitionDetect.

@Test(singleThreaded = true)
public void testCyclicDefinitionDetect() {
    AvroSchema cyclicSchema = AvroSchema.of(DecoderTestMessage.CyclicFoo.class);
    PrestoException exception = expectThrows(PrestoException.class, () -> {
        decoderFactory.extractColumnMetadata(topicName, cyclicSchema.getSchemaInfo(), PulsarColumnHandle.HandleKeyValueType.NONE);
    });
    assertEquals("Topic " + topicName.toString() + " schema may contains cyclic definitions.", exception.getMessage());
}
Also used : AvroSchema(org.apache.pulsar.client.impl.schema.AvroSchema) GenericAvroSchema(org.apache.pulsar.client.impl.schema.generic.GenericAvroSchema) PrestoException(io.prestosql.spi.PrestoException) DecoderTestMessage(org.apache.pulsar.sql.presto.decoder.DecoderTestMessage) Test(org.testng.annotations.Test)

Example 2 with AvroSchema

use of org.apache.pulsar.client.impl.schema.AvroSchema in project pulsar by apache.

the class TestAvroDecoder method testCyclicDefinitionDetect.

@Test(singleThreaded = true)
public void testCyclicDefinitionDetect() {
    AvroSchema cyclicSchema = AvroSchema.of(DecoderTestMessage.CyclicFoo.class);
    PrestoException exception = expectThrows(PrestoException.class, () -> {
        decoderFactory.extractColumnMetadata(topicName, cyclicSchema.getSchemaInfo(), PulsarColumnHandle.HandleKeyValueType.NONE);
    });
    assertEquals("Topic " + topicName.toString() + " schema may contains cyclic definitions.", exception.getMessage());
}
Also used : AvroSchema(org.apache.pulsar.client.impl.schema.AvroSchema) GenericAvroSchema(org.apache.pulsar.client.impl.schema.generic.GenericAvroSchema) PrestoException(io.prestosql.spi.PrestoException) DecoderTestMessage(org.apache.pulsar.sql.presto.decoder.DecoderTestMessage) Test(org.testng.annotations.Test)

Example 3 with AvroSchema

use of org.apache.pulsar.client.impl.schema.AvroSchema in project incubator-pulsar by apache.

the class TestAvroDecoder method testCyclicDefinitionDetect.

@Test(singleThreaded = true)
public void testCyclicDefinitionDetect() {
    AvroSchema cyclicSchema = AvroSchema.of(DecoderTestMessage.CyclicFoo.class);
    PrestoException exception = expectThrows(PrestoException.class, () -> {
        decoderFactory.extractColumnMetadata(topicName, cyclicSchema.getSchemaInfo(), PulsarColumnHandle.HandleKeyValueType.NONE);
    });
    assertEquals("Topic " + topicName.toString() + " schema may contains cyclic definitions.", exception.getMessage());
}
Also used : AvroSchema(org.apache.pulsar.client.impl.schema.AvroSchema) GenericAvroSchema(org.apache.pulsar.client.impl.schema.generic.GenericAvroSchema) PrestoException(io.prestosql.spi.PrestoException) DecoderTestMessage(org.apache.pulsar.sql.presto.decoder.DecoderTestMessage) Test(org.testng.annotations.Test)

Aggregations

PrestoException (io.prestosql.spi.PrestoException)3 AvroSchema (org.apache.pulsar.client.impl.schema.AvroSchema)3 GenericAvroSchema (org.apache.pulsar.client.impl.schema.generic.GenericAvroSchema)3 DecoderTestMessage (org.apache.pulsar.sql.presto.decoder.DecoderTestMessage)3 Test (org.testng.annotations.Test)3