SQL

  1. bin/sql-client.sh

Explain 查看执行计划

抽象语法树、优化后执行计划、物理执行计划。

  1. explain SELECT ***;

结果显示

tablemode结果存到内存,显示标准表。changlog

  1. SET execution.result-mode=table
  2. SET execution.result-mode=changelog

执行

执行SQL会就向集群提交一个Job。

Environment Files

现在还不支持DDL,只能用yaml配置。
delay是毫秒

  1. tables:
  2. - name: foo
  3. type: source
  4. update-mode: append
  5. schema:
  6. - name: id
  7. type: LONG
  8. - name: ct
  9. type: TIMESTAMP
  10. rowtime:
  11. timestamps:
  12. type: "from-field"
  13. from: "eventTime"
  14. watermarks:
  15. type: "periodic-bounded"
  16. delay: "60000"
  17. - name: name
  18. type: STRING
  19. connector:
  20. property-version: 1
  21. type: kafka
  22. version: 2.2.0
  23. topic: foo-topic
  24. startup-mode: earliest-offset
  25. properties:
  26. - key: zookeeper.connect
  27. value: ${ZOOKEEPER}:2181
  28. - key: bootstrap.servers
  29. value: ${KAFKA}:9092
  30. - key: group.id
  31. value: foo-group
  32. format:
  33. property-version: 1
  34. type: json
  35. schema: "ROW(id LONG, ct TIMESTAMP, name STRING)"
  36. - name: bar
  37. type: sink
  38. update-mode: append
  39. schema:
  40. - name: id
  41. type: LONG
  42. connector:
  43. property-version: 1
  44. type: kafka
  45. version: 2.2.0
  46. topic: bar-topic
  47. startup-mode: earliest-offset
  48. properties:
  49. - key: zookeeper.connect
  50. value: zookeeper:2181
  51. - key: bootstrap.servers
  52. value: kafka:9092
  53. - key: group.id
  54. value: foo-topic
  55. format:
  56. property-version: 1
  57. type: json
  58. schema: "ROW(id LONG)"
  59. functions:
  60. - name: topN
  61. from: class
  62. class: org.foo.sql.udf.TopN