nulls.td 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Use of this software is governed by the Business Source License
  4. # included in the LICENSE file at the root of this repository.
  5. #
  6. # As of the Change Date specified in that file, in accordance with
  7. # the Business Source License, use of this software will be governed
  8. # by the Apache License, Version 2.0.
  9. $ set-arg-default single-replica-cluster=quickstart
  10. $ set foo-schema={
  11. "name": "row",
  12. "type": "record",
  13. "fields": [
  14. {"name": "a", "type": ["null", "long"]}
  15. ]
  16. }
  17. $ kafka-create-topic topic=foo
  18. $ kafka-ingest format=avro topic=foo schema=${foo-schema} timestamp=1
  19. {"a": {"long": 1}}
  20. {"a": {"long": 2}}
  21. {"a": null}
  22. > CREATE CONNECTION kafka_conn
  23. TO KAFKA (BROKER '${testdrive.kafka-addr}', SECURITY PROTOCOL PLAINTEXT);
  24. > CREATE SOURCE foo
  25. IN CLUSTER ${arg.single-replica-cluster}
  26. FROM KAFKA CONNECTION kafka_conn (TOPIC 'testdrive-foo-${testdrive.seed}')
  27. FORMAT AVRO USING SCHEMA '${foo-schema}'
  28. > SELECT * FROM foo;
  29. 1
  30. 2
  31. <null>
  32. > CREATE MATERIALIZED VIEW test1 AS
  33. SELECT * FROM foo JOIN foo as foo2 USING (a);
  34. > SELECT * FROM test1;
  35. a
  36. ---
  37. 1
  38. 2
  39. #In the event of null payload, materialize should skip the entry and not panic
  40. $ kafka-create-topic topic=nullpayload
  41. $ kafka-ingest format=bytes key-format=bytes key-terminator=: topic=nullpayload timestamp=1
  42. :Sé
  43. :
  44. :así
  45. > CREATE SOURCE nullpayload (col)
  46. IN CLUSTER ${arg.single-replica-cluster}
  47. FROM KAFKA CONNECTION kafka_conn (TOPIC 'testdrive-nullpayload-${testdrive.seed}')
  48. FORMAT BYTES
  49. > SELECT col from nullpayload
  50. col
  51. ---
  52. "S\\xc3\\xa9"
  53. "as\\xc3\\xad"