nulls.td 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. > CREATE TABLE foo_tbl FROM SOURCE foo (REFERENCE "testdrive-foo-${testdrive.seed}")
  28. FORMAT AVRO USING SCHEMA '${foo-schema}'
  29. > SELECT * FROM foo_tbl;
  30. 1
  31. 2
  32. <null>
  33. > CREATE MATERIALIZED VIEW test1 AS
  34. SELECT * FROM foo_tbl JOIN foo_tbl as foo2 USING (a);
  35. > SELECT * FROM test1;
  36. a
  37. ---
  38. 1
  39. 2
  40. #In the event of null payload, materialize should skip the entry and not panic
  41. $ kafka-create-topic topic=nullpayload
  42. $ kafka-ingest format=bytes key-format=bytes key-terminator=: topic=nullpayload timestamp=1
  43. :Sé
  44. :
  45. :así
  46. > CREATE SOURCE nullpayload
  47. IN CLUSTER ${arg.single-replica-cluster}
  48. FROM KAFKA CONNECTION kafka_conn (TOPIC 'testdrive-nullpayload-${testdrive.seed}')
  49. > CREATE TABLE nullpayload_tbl (col) FROM SOURCE nullpayload (REFERENCE "testdrive-nullpayload-${testdrive.seed}")
  50. FORMAT BYTES
  51. > SELECT col from nullpayload_tbl
  52. col
  53. ---
  54. "S\\xc3\\xa9"
  55. "as\\xc3\\xad"