diff --git a/docs/1.7-SNAPSHOT/112.md b/docs/1.7-SNAPSHOT/112.md index 60efdf07936dd8981f14c4adfbe6ea1defa66935..84e58df516b351ba38564b223d871f3c084e4580 100644 --- a/docs/1.7-SNAPSHOT/112.md +++ b/docs/1.7-SNAPSHOT/112.md @@ -21,61 +21,17 @@ TaskManagers的配置文件可能不同,Flink不承担集群中的统一机器 | 键 | 默认 | 描述 | | --- | --- | --- | -| - -##### jobmanager.heap.size - - | “1024m” | JobManager的JVM堆大小. | -| - -##### taskmanager.heap.size - - | “1024m” | TaskManagers的JVM堆大小,它是系统的并行工作者.在YARN设置中,此值自动配置为TaskManager的YARN容器的大小,减去一定的容差值. | -| - -##### parallelism.default - - | 1 | | -| - -##### taskmanager.numberOfTaskSlots - - | 1 | 单个TaskManager可以运行的并行算子或用户函数实例的数量.如果此值大于1,则单个TaskManager将获取函数或 算子的多个实例.这样,TaskManager可以使用多个CPU内核,但同时,可用内存在不同的算子或函数实例之间划分.此值通常与TaskManager的计算机具有的物理CPU核心数成比例(例如,等于核心数,或核心数的一半). | -| - -##### state.backend - - | (none) | 状态后台用于存储和检查点状态. | -| - -##### state.checkpoints.dir - - | (none) | 用于在Flink支持的文件系统中存储检查点的数据文件和元数据的默认目录.必须可以从所有参与的进程/节点(即所有TaskManagers和JobManagers)访问存储路径. | -| - -##### state.savepoints.dir - - | (none) | 保存点的默认目录.由将后台写入文件系统的状态后台(MemoryStateBackend,FsStateBackend,RocksDBStateBackend)使用. | -| - -##### high-availability - - | “no / not” | 定义用于群集执行的高可用性模式.要启用高可用性,请将此模式设置为“ZOOKEEPER”. | -| - -##### high-availability.storageDir - - | (none) | 文件系统路径(URI)Flink在高可用性设置中持久保存元数据. | -| - -##### security.ssl.internal.enabled - - | false | 打开SSL以进行内部网络通信.可选地,特定组件可以通过它们自己的设置(rpc,数据传输,REST等)覆盖它. | -| - -##### security.ssl.rest.enabled - - | false | 通过REST端点打开SSL以进行外部通信. | +| `jobmanager.heap.size` | “1024m” | JobManager的JVM堆大小. | +| `taskmanager.heap.size` | “1024m” | TaskManagers的JVM堆大小,它是系统的并行工作者.在YARN设置中,此值自动配置为TaskManager的YARN容器的大小,减去一定的容差值. | +| `parallelism.default` | 1 | | +| `taskmanager.numberOfTaskSlots` | 1 | 单个TaskManager可以运行的并行算子或用户函数实例的数量.如果此值大于1,则单个TaskManager将获取函数或 算子的多个实例.这样,TaskManager可以使用多个CPU内核,但同时,可用内存在不同的算子或函数实例之间划分.此值通常与TaskManager的计算机具有的物理CPU核心数成比例(例如,等于核心数,或核心数的一半). | +| `state.backend` | (none) | 状态后台用于存储和检查点状态. | +| `state.checkpoints.dir` | (none) | 用于在Flink支持的文件系统中存储检查点的数据文件和元数据的默认目录.必须可以从所有参与的进程/节点(即所有TaskManagers和JobManagers)访问存储路径. | +| `state.savepoints.dir` | (none) | 保存点的默认目录.由将后台写入文件系统的状态后台(MemoryStateBackend,FsStateBackend,RocksDBStateBackend)使用. | +| `high-availability` | “no / not” | 定义用于群集执行的高可用性模式.要启用高可用性,请将此模式设置为“ZOOKEEPER”. | +| `high-availability.storageDir` | (none) | 文件系统路径(URI)Flink在高可用性设置中持久保存元数据. | +| `security.ssl.internal.enabled` | false | 打开SSL以进行内部网络通信.可选地,特定组件可以通过它们自己的设置(rpc,数据传输,REST等)覆盖它. | +| `security.ssl.rest.enabled` | false | 通过REST端点打开SSL以进行外部通信. | ## 完整参考 @@ -83,1421 +39,404 @@ TaskManagers的配置文件可能不同,Flink不承担集群中的统一机器 **注意:**不推荐使用这些Keys,建议使用环境变量配置Hadoop路径`HADOOP_CONF_DIR`. -这些参数配置Flink使用的默认HDFS.未指定HDFS配置的设置必须指定HDFS文件的完整路径(`hdfs://address:port/path/to/files`)文件也将使用默认HDFS参数(块大小,复制因子)编写. - -* `fs.hdfs.hadoopconf`:Hadoop文件系统(HDFS)配置**目录**的绝对路径(可选值).指定此值允许程序使用短URI引用HDFS文件(`hdfs:///path/to/files`不包括文件URI中NameNode的地址和端口).如果没有此选项,则可以访问HDFS文件,但需要完全限定的URI `hdfs://address:port/path/to/files`.此选项还会导致文件编写者获取HDFS的块大小和复制因子的默认值.Flink将在指定目录中查找“core-site.xml”和“hdfs-site.xml”文件. - -* `fs.hdfs.hdfsdefault`:Hadoop自己的配置文件“hdfs-default.xml”的绝对路径(DEFAULT:null). - -* `fs.hdfs.hdfssite`:Hadoop自己的配置文件“hdfs-site.xml”的绝对路径(DEFAULT:null). - -### 核心 - -| 键 | 默认 | 描述 | -| --- | --- | --- | -| - -##### classloader.parent-first-patterns.additional - - | (none) | 一个(以分号分隔的)模式列表,指定应始终首先通过父ClassLoader解析哪些类.模式是一个简单的前缀,它根据完全限定的类名进行检查.这些模式附加到“classloader.parent-first-patterns.default”. | -| - -##### classloader.parent-first-patterns.default - - | “java .; <wbr>scala .; <wbr>org.apache.flink .; <wbr>com.esotericsoftware.kryo; <wbr>org.apache.hadoop .; <wbr>javax.annotation .; <wbr>org.slf4j; <wbr>org.apache.log4j; <wbr>org.apache.logging; <wbr>org. apache.commons.logging; <wbr>ch.qos.logback“ | 一个(以分号分隔的)模式列表,指定应始终首先通过父ClassLoader解析哪些类.模式是一个简单的前缀,它根据完全限定的类名进行检查.通常不应修改此设置.要添加其他模式,我们建议使用“classloader.parent-first-patterns.additional”. | -| - -##### classloader.resolve-order - - | "child-first" | 从用户代码加载类时定义类解析策略,这意味着是首先检查用户代码jar(“child-first”)还是应用程序类路径(“parent-first”).默认设置指示首先从用户代码jar加载类,这意味着用户代码jar可以包含和加载不同于Flink使用的(依赖)依赖项. | -| - -##### io.tmp.dirs - - | YARN上的'LOCAL_DIRS'.Mesos上的'_FLINK_TMP_DIR'.独立的System.getProperty(“java.io.tmpdir”). | | -| - -##### mode - - | "new" | 切换到选择执行模式.可能的值为“new”和“legacy”. | -| - -##### parallelism.default - - | 1 | | - -### JobManager - -| 键 | 默认 | 描述 | -| --- | --- | --- | -| - -##### jobmanager.archive.fs.dir - - | (none) | | -| - -##### jobmanager.execution.attempts-history-size - - | 16 | 历史记录中保存的最大执行尝试次数. | -| - -##### jobmanager.execution.failover-strategy - - | “full” | 此选项指定作业计算如何从任务失败中恢复.可接受的值是: - -* 'full':重新启动所有任务. -* 'individual':仅重新启动失败的任务.仅当所有任务都是独立组件时才应使用. -* 'region':重新启动可能受任务失败影响的所有任务. - - | -| - -##### jobmanager.heap.size - - | “1024m” | JobManager的JVM堆大小. | -| - -##### jobmanager.resourcemanager.reconnect-interval - - | 2000 | 此选项指定在与资源管理器的连接丢失时触发资源管理器重新连接的时间间隔.此选项仅供内部使用. | -| - -##### jobmanager.rpc.address - - | (none) | config参数定义要连接的网络地址以与JobManager进行通信.此值仅在具有静态名称或地址的单个JobManager存在的设置中解释(简单的独立设置或具有动态服务名称解析的容器设置).当使用Leader选举服务(如ZooKeeper)从潜在的多个Slave JobManagers中选择和发现JobManagerLeader时,它不会在许多高可用性设置中使用. | -| - -##### jobmanager.rpc.port - - | 6123 | config参数定义要连接的网络端口以与JobManager进行通信.与jobmanager.rpc.address一样,此值仅在设置中解释,其中存在具有静态名称/地址和端口的单个JobManager(简单的独立设置或具有动态服务名称解析的容器设置).当使用Leader选举服务(如ZooKeeper)从潜在的多个Slave JobManagers中选择和发现JobManagerLeader时,此配置选项不会用于许多高可用性设置. | -| - -##### jobstore.cache-size - - | 52428800 | 作业存储缓存大小(以字节为单位),用于将已完成的作业保存在内存中. | -| - -##### jobstore.expiration-time - - | 3600 | 完成作业到期并从作业库中清除的时间(以秒为单位). | -| - -##### slot.idle.timeout - - | 50000 | Slot Pool中空闲槽的超时时间(以ms为单位). | -| - -##### slot.request.timeout - - | 300000 | 从Slot Pool请求插槽的超时(以ms为单位). | - -### TaskManager - -| 键 | 默认 | 描述 | -| --- | --- | --- | -| - -##### task.cancellation.interval - - | 30000 | 两次连续任务取消尝试之间的时间间隔(以ms为单位). | -| - -##### task.cancellation.timeout - - | 180000 | 超时(以ms为单位),在此之后任务取消超时并导致致命的TaskManager错误.值为0将禁用看门狗. | -| - -##### task.cancellation.timers.timeout - - | 7500 | | -| - -##### task.checkpoint.alignment.max-size - - | -1 | 检查点对齐可以缓冲的最大字节数.如果检查点对齐缓冲超过配置的数据量,则中止检查点(跳过).值-1表示没有限制. | -| - -##### taskmanager.data.port - - | 0 | TaskManager的端口用于数据交换 算子操作. | -| - -##### taskmanager.data.ssl.enabled - - | true | 为taskmanager数据传输启用SSL支持.仅当内部SSL的全局标志(security.ssl.internal.enabled)设置为true时,此选项才适用 | -| - -##### taskmanager.debug.memory.log - - | false | 指示是否启动线程的标志,该线程重复记录JVM的内存使用情况. | -| - -##### taskmanager.debug.memory.log-interval - - | 5000 | 日志线程记录当前内存使用情况的时间间隔(以ms为单位). | -| - -##### taskmanager.exit-on-fatal-akka-error - - | false | 是否应启动TaskManager的隔离监视器.如果隔离监视器检测到它已隔离另一个actor系统或者它已被另一个actor系统隔离,则会关闭该actor系统. | -| - -##### taskmanager.heap.size - - | “1024m” | TaskManagers的JVM堆大小,它是系统的并行工作者.在YARN设置中,此值自动配置为TaskManager的YARN容器的大小,减去一定的容差值. | -| - -##### taskmanager.host - - | (none) | TaskManager绑定到的网络接口的主机名.默认情况下,TaskManager搜索可以连接到JobManager和其他TaskManagers的网络接口.如果该策略由于某种原因失败,则此选项可用于定义主机名.由于不同的TaskManagers需要此选项的不同值,因此通常在其他非共享的特定于TaskManager的配置文件中指定. | -| - -##### taskmanager.jvm-exit-on-oom - - | false | 是否在任务线程抛出OutOfMemoryError时终止TaskManager. | -| - -##### taskmanager.memory.fraction - - | 0.7 | TaskManager为排序,哈希表和中间结果的缓存预留的相对内存量(在减去网络缓冲区使用的内存量之后).例如,值“0.8”表示TaskManager为内部数据缓冲区保存80%的内存,为TaskManager的堆留下20%的可用内存,用于由用户定义的函数创建的对象.仅当未设置taskmanager.memory.size时,才会评估此参数. | -| - -##### taskmanager.memory.off-heap - - | false | 内存分配方法(JVM堆或堆外),用于TaskManager的托管内存以及网络缓冲区. | -| - -##### taskmanager.memory.preallocate - - | false | 在TaskManager启动时是否应预先分配TaskManager托管内存. | -| - -##### taskmanager.memory.segment-size - - | “32KB” | 网络堆栈和内存管理器使用的内存缓冲区的大小. | -| - -##### taskmanager.memory.size - - | “0” | TaskManager的内存管理器分配的内存量.如果未设置,将分配相对分数. | -| - -##### taskmanager.network.detailed-metrics - - | false | 布尔标志,用于启用/禁用有关入站/出站网络队列长度的更详细指标. | -| - -##### taskmanager.network.memory.buffers-per-channel - - | 2 | 每个传出/传入通道(子分区/输入通道)使用的最大网络缓冲区数.在基于信用的流量控制模式下,这表示每个输入通道中有多少信用.它应配置至少2以获得良好的性能.1个缓冲区用于接收子分区中的飞行中数据,1个缓冲区用于并行序列化. | -| - -##### taskmanager.network.memory.floating-buffers-per-gate - - | 8 | 每个输出/输入门(结果分区/输入门)使用的额外网络缓冲区数.在基于信用的流量控制模式中,这表示在所有输入通道之间共享多少浮动信用.浮动缓冲区基于积压(子分区中的实时输出缓冲区)反馈来分布,并且可以帮助减轻由子分区之间的不平衡数据分布引起的背压.如果节点之间的往返时间较长和/或群集中的机器数量较多,则应增加此值. | -| - -##### taskmanager.network.memory.fraction - - | 0.1 | 用于网络缓冲区的JVM内存的分数.这决定了TaskManager可以同时拥有多少流数据交换通道以及通道缓冲的程度.如果作业被拒绝或者您收到系统没有足够缓冲区的警告,请增加此值或下面的最小/最大值.另请注意,“taskmanager.network.memory.min”和“taskmanager.network.memory.max”可能会覆盖此分数. | -| - -##### taskmanager.network.memory.max - - | “1GB” | 网络缓冲区的最大内存大小. | -| - -##### taskmanager.network.memory.min - - | “64MB” | 网络缓冲区的最小内存大小. | -| - -##### taskmanager.network.request-backoff.initial - - | 100 | 输入通道的分区请求的最小退避. | -| - -##### taskmanager.network.request-backoff.max - - | 10000 | 输入通道的分区请求的最大退避. | -| - -##### taskmanager.numberOfTaskSlots - - | 1 | 单个TaskManager可以运行的并行算子或用户函数实例的数量.如果此值大于1,则单个TaskManager将获取函数或 算子的多个实例.这样,TaskManager可以使用多个CPU内核,但同时,可用内存在不同的算子或函数实例之间划分.此值通常与TaskManager的计算机具有的物理CPU核心数成比例(例如,等于核心数,或核心数的一半). | -| - -##### taskmanager.registration.initial-backoff - - | “500ms” | 两次连续注册尝试之间的初始注册退避.每次新注册尝试的退避加倍,直到达到最大注册退避. | -| - -##### taskmanager.registration.max-backoff - - | “30s" | 两次连续注册尝试之间的最大注册退避.最大注册退避需要时间单位指定符(ms / s / min / h / d). | -| - -##### taskmanager.registration.refused-backoff - - | “10s" | 注册后的退避已被作业管理员拒绝,然后重试连接. | -| - -##### taskmanager.registration.timeout - - | “5m" | 定义TaskManager注册的超时.如果在未成功注册的情况下超过持续时间,则TaskManager将终止. | -| - -##### taskmanager.rpc.port - - | “0” | TaskManager的IPC端口.接受端口列表(“50100,50101”),范围(“50100-50200”)或两者的组合.建议在同一台计算机上运行多个TaskManagers时设置一系列端口以避免冲突. | - -### 分布式协调(通过Akka) - -| 键 | 默认 | 描述 | -| --- | --- | --- | -| - -##### akka.ask.timeout - - | “10s" | 超时用于所有期货并阻止Akka通话.如果Flink由于超时而失败,那么您应该尝试增加此值.超时可能是由于机器速度慢或网络拥挤造成的.超时值需要时间单位指定符(ms / s / min / h / d). | -| - -##### akka.client-socket-worker-pool.pool-size-factor - - | 1.0 | 池大小因子用于使用以下公式确定线程池大小:ceil(可用处理器*因子).然后,结果大小由pool-size-min和pool-size-max值限制. | -| - -##### akka.client-socket-worker-pool.pool-size-max - - | 2 | 将基于因子的数量限制为的最大线程数. | -| - -##### akka.client-socket-worker-pool.pool-size-min - - | 1 | 将基于因子的数量限制为的最小线程数. | -| - -##### akka.client.timeout - - | “60s" | 客户端的所有阻塞调用超时. | -| - -##### akka.fork-join-executor.parallelism-factor - - | 2.0 | 并行因子用于使用以下公式确定线程池大小:ceil(可用处理器*因子).然后,得到的大小受parallelism-min和parallelism-max值的限制. | -| - -##### akka.fork-join-executor.parallelism-max - - | 64 | 将基于因子的并行数量限制为的最大线程数. | -| - -##### akka.fork-join-executor.parallelism-min - - | 8 | 将基于因子的并行数量限制为的最小线程数. | -| - -##### akka.framesize - - | “10485760b” | 在JobManager和TaskManager之间发送的消息的最大大小.如果Flink由于消息超出此限制而失败,那么您应该增加它.邮件大小需要大小单位说明符. | -| - -##### akka.jvm-exit-on-fatal-error - - | true | 退出JVM致命的Akka错误. | -| - -##### akka.log.lifecycle.events - - | false | 打开Akka远程记录事件.在调试时将此值设置为“true”. | -| - -##### akka.lookup.timeout - - | “10s" | 用于查找JobManager的超时.超时值必须包含时间单位说明符(ms / s / min / h / d). | -| - -##### akka.retry-gate-closed-for - - | 50 | 断开远程连接后,应关闭门的ms数. | -| - -##### akka.server-socket-worker-pool.pool-size-factor - - | 1.0 | 池大小因子用于使用以下公式确定线程池大小:ceil(可用处理器*因子).然后,结果大小由pool-size-min和pool-size-max值限制. | -| - -##### akka.server-socket-worker-pool.pool-size-max - - | 2 | 将基于因子的数量限制为的最大线程数. | -| - -##### akka.server-socket-worker-pool.pool-size-min - - | 1 | 将基于因子的数量限制为的最小线程数. | -| - -##### akka.ssl.enabled - - | true | 为Akka的远程通信打开SSL.仅当全局ssl标志security.ssl.enabled设置为true时,这才适用. | -| - -##### akka.startup-timeout - - | (none) | 超时之后,远程组件的启动被视为失败. | -| - -##### akka.tcp.timeout - - | “20s" | 所有出站连接超时.如果由于网络速度较慢而导致连接到TaskManager时遇到问题,则应增加此值. | -| - -##### akka.throughput - - | 15 | 在将线程返回到池之前批处理的消息数.较低的值表示公平的调度,而较高的值可以以不公平为代价来提高性能. | -| - -##### akka.transport.heartbeat.interval - - | “1000s" | Akka传输故障检测器的心跳间隔.由于Flink使用TCP,因此不需要检测器.因此,通过将间隔设置为非常高的值来禁用检测器.如果您需要传输故障检测器,请将间隔设置为某个合理的值.间隔值需要时间单位指定符(ms / s / min / h / d). | -| - -##### akka.transport.heartbeat.pause - - | “6000s" | Akka的传输故障检测器可接受的心跳暂停.由于Flink使用TCP,因此不需要检测器.因此,通过将暂停设置为非常高的值来禁用检测器.如果您需要传输故障检测器,请将暂停设置为某个合理的值.暂停值需要时间单位指定符(ms / s / min / h / d). | -| - -##### akka.transport.threshold - - | 300.0 | 传输故障检测器的阈值.由于Flink使用TCP,因此检测器不是必需的,因此阈值被设置为高值. | -| - -##### akka.watch.heartbeat.interval - - | “10s" | Akka的DeathWatch机制检测死亡TaskManagers的心跳间隔.如果由于心跳消息丢失或延迟而导致TaskManagers被错误地标记为死亡,那么您应该减小此值或增加akka.watch.heartbeat.pause.可在[此处](http://doc.akka.io/docs/akka/snapshot/scala/remoting.html#failure-detector)找到Akka的DeathWatch的详尽描述[](http://doc.akka.io/docs/akka/snapshot/scala/remoting.html#failure-detector) | -| - -##### akka.watch.heartbeat.pause - - | “60s" | Akka的DeathWatch机制可接受的心跳暂停.较低的值不允许心律不齐.如果由于心跳消息丢失或延迟而导致TaskManagers被错误地标记为死亡,那么您应该增加此值或Reduceakka.watch.heartbeat.interval.较高的值会增加检测死的TaskManager的时间.可在[此处](http://doc.akka.io/docs/akka/snapshot/scala/remoting.html#failure-detector)找到Akka的DeathWatch的详尽描述[](http://doc.akka.io/docs/akka/snapshot/scala/remoting.html#failure-detector) | -| - -##### akka.watch.threshold - - | 12 | DeathWatch故障检测器的阈值.较低的值容易出现误报,而较高的值会增加检测死的TaskManager的时间.可在[此处](http://doc.akka.io/docs/akka/snapshot/scala/remoting.html#failure-detector)找到Akka的DeathWatch的详尽描述[](http://doc.akka.io/docs/akka/snapshot/scala/remoting.html#failure-detector) | - -### REST - -| 键 | 默认 | 描述 | -| --- | --- | --- | -| - -##### rest.address - - | (none) | 客户端应该用于连接到服务器的地址. | -| - -##### rest.await-leader-timeout - - | 30000 | 客户端等待Leader地址的时间(以ms为单位),例如Dispatcher或WebMonitorEndpoint | -| - -##### rest.bind-address - - | (none) | 服务器绑定自身的地址. | -| - -##### rest.client.max-content-length - - | 104857600 | 客户端将处理的最大内容长度(以字节为单位). | -| - -##### rest.connection-timeout - - | 15000 | 客户端建立TCP连接的最长时间(以ms为单位). | -| - -##### rest.port - - | 8081 | 服务器侦听的端口/客户端连接到的端口. | -| - -##### rest.retry.delay - - | 3000 | 客户端在重试之间等待的时间(以ms为单位)(另请参阅“rest.retry.max-attempts”). | -| - -##### rest.retry.max-attempts - - | 20 | 如果可重试 算子操作失败,客户端将尝试重试的次数. | -| - -##### rest.server.max-content-length - - | 104857600 | 服务器将处理的最大内容长度(以字节为单位). | - -### Blob服务器 - -| 键 | 默认 | 描述 | -| --- | --- | --- | -| - -##### blob.fetch.backlog - - | 1000 | config参数定义JobManager上BLOB提取的积压. | -| - -##### blob.fetch.num-concurrent - - | 50 | config参数定义JobManager服务的最大并发BLOB提取数. | -| - -##### blob.fetch.retries - - | 5 | config参数定义失败的BLOB提取的退出次数. | -| - -##### blob.offload.minsize - - | 1048576 | 要卸载到BlobServer的消息的最小大小. | -| - -##### blob.server.port - - | “0” | config参数定义blob服务的服务器端口. | -| - -##### blob.service.cleanup.interval - - | 3600 | TaskManager中blob缓存的清理间隔(以秒为单位). | -| - -##### blob.service.ssl.enabled - - | true | 用于覆盖blob服务传输的ssl支持的标志. | -| - -##### blob.storage.directory - - | (none) | config参数,用于定义blob服务器使用的存储目录. | - -### 心跳管理器 - -| 键 | 默认 | 描述 | -| --- | --- | --- | -| - -##### heartbeat.interval - - | 10000 | 从发送方请求心跳的时间间隔. | -| - -##### heartbeat.timeout - - | 50000 | 为发送方和接收方双方请求和接收心跳的超时. | - -### SSL设置 - -| 键 | 默认 | 描述 | -| --- | --- | --- | -| - -##### security.ssl.algorithms - - | “TLS_RSA_WITH_AES_128_CBC_SHA” | 要支持的标准SSL算法的逗号分隔列表.[在这里](http://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#ciphersuites)阅读更多[](http://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#ciphersuites) | -| - -##### security.ssl.internal.enabled - - | false | 打开SSL以进行内部网络通信.可选地,特定组件可以通过它们自己的设置(rpc,数据传输,REST等)覆盖它. | -| - -##### security.ssl.internal.key-password - - | (none) | 解密Keys库中Flink内部端点(rpc,数据传输,blob服务器)Keys的密钥. | -| - -##### security.ssl.internal.keystore - - | (none) | 带有SSLKeys和证书的JavaKeys库文件,用于Flink的内部端点(rpc,数据传输,blob服务器). | -| - -##### security.ssl.internal.keystore-password - - | (none) | 为Flink的内部端点(rpc,数据传输,blob服务器)解密Flink的Keys库文件的密钥. | -| - -##### security.ssl.internal.truststore - - | (none) | 包含公共CA证书的信任库文件,用于验证Flink内部端点(rpc,数据传输,blob服务器)的对等方. | -| - -##### security.ssl.internal.truststore-password - - | (none) | 用于解密Flink内部端点(rpc,数据传输,blob服务器)的信任库的密码. | -| - -##### security.ssl.key-password - - | (none) | 解密Keys库中的服务器Keys的密钥. | -| - -##### security.ssl.keystore - - | (none) | flink端点用于其SSLKeys和证书的JavaKeys库文件. | -| - -##### security.ssl.keystore-password - - | (none) | 解密Keys库文件的密钥. | -| - -##### security.ssl.protocol - - | “TLSv1.2” | ssl传输支持的SSL协议版本.请注意,它不支持以逗号分隔的列表. | -| - -##### security.ssl.rest.enabled - - | false | 通过REST端点打开SSL以进行外部通信. | -| - -##### security.ssl.rest.key-password - - | (none) | 解密Flink外部REST端点的Keys库中的Keys的密钥. | -| - -##### security.ssl.rest.keystore - - | (none) | 带有SSLKeys和证书的JavaKeys库文件,用于Flink的外部REST端点. | -| - -##### security.ssl.rest.keystore-password - - | (none) | 为Flink的外部REST端点解密Flink的Keys库文件的密钥. | -| - -##### security.ssl.rest.truststore - - | (none) | 包含公共CA证书的信任库文件,用于验证Flink的外部REST端点的对等方. | -| - -##### security.ssl.rest.truststore-password - - | (none) | 用于解密Flink外部REST端点的信任库的密码. | -| - -##### security.ssl.truststore - - | (none) | 信任库文件,包含flink端点用于验证对等方证书的公共CA证书. | -| - -##### security.ssl.truststore-password - - | (none) | 解密信任库的秘诀. | -| - -##### security.ssl.verify-hostname - - | true | 标记以在ssl握手期间启用对等方的主机名验证. | - -### 网络通讯(通过Netty) - -这些参数允许高级调整.在大型群集上运行并发高吞吐量作业时,默认值就足够了. - -| 键 | 默认 | 描述 | -| --- | --- | --- | -| - -##### taskmanager.network.netty.client.connectTimeoutSec - - | 120 | Netty客户端连接超时. | -| - -##### taskmanager.network.netty.client.numThreads - - | -1 | Netty客户端线程的数量. | -| - -##### taskmanager.network.netty.num-arenas - - | -1 | Netty竞技场的数量. | -| - -##### taskmanager.network.netty.sendReceiveBufferSize - - | 0 | Netty发送和接收缓冲区大小.这默认为系统缓冲区大小(cat / proc / sys / net / ipv4 / tcp_ [rw] mem),在现代Linux中为4 MiB. | -| - -##### taskmanager.network.netty.server.backlog - - | 0 | netty服务器连接积压. | -| - -##### taskmanager.network.netty.server.numThreads - - | -1 | Netty服务器线程数. | -| - -##### taskmanager.network.netty.transport - - | “nio” | Netty传输类型,“nio”或“epoll” | - -### Web前端 - -| 键 | 默认 | 描述 | -| --- | --- | --- | -| - -##### web.access-control-allow-origin - - | “*” | | -| - -##### web.address - - | (none) | | -| - -##### web.backpressure.cleanup-interval - - | 600000 | | -| - -##### web.backpressure.delay-between-samples - - | 50 | | -| - -##### web.backpressure.num-samples - - | 100 | | -| - -##### web.backpressure.refresh-interval - - | 60000 | | -| - -##### web.checkpoints.history - - | 10 | | -| - -##### web.history - - | 5 | | -| - -##### web.log.path - - | (none) | | -| - -##### web.refresh-interval - - | 3000 | | -| - -##### web.ssl.enabled - - | true | | -| - -##### web.submit.enable - - | true | | -| - -##### web.timeout - - | 10000 | | -| - -##### web.tmpdir - - | System.getProperty( “java.io.tmpdir”) | | -| - -##### web.upload.dir - - | (none) | | - -### 文件系统 - -| 键 | 默认 | 描述 | -| --- | --- | --- | -| - -##### fs.default-scheme - - | (none) | 默认文件系统方案,用于未明确声明方案的路径.可能包含权限,例如,在HDFS NameNode的情况下为host:port. | -| - -##### fs.output.always-create-directory - - | false | 以大于1的并行度运行的文件编写器为输出文件路径创建目录,并将不同的结果文件(每个并行编写器任务一个)放入该目录中.如果此选项设置为“true”,则并行度为1的编写器也将创建一个目录并将单个结果文件放入其中.如果该选项设置为“false”,则编写器将直接在输出路径上直接创建文件,而不创建包含目录. | -| - -##### fs.overwrite-files - - | false | 指定默认情况下文件输出编写器是否应覆盖现有文件.设置为“true”以默认覆盖,否则设置为“false”. | - -### 编译/优化 - -| 键 | 默认 | 描述 | -| --- | --- | --- | -| - -##### compiler.delimited-informat.max-line-samples - - | 10 | 编译器为分隔输入采用的最大行样本数.样本用于估计记录数.可以使用输入格式的参数覆盖特定输入的此值. | -| - -##### compiler.delimited-informat.max-sample-len - - | 2097152 | 编译器用于分隔输入的行样本的最大长度.如果单个样本的长度超过此值(可能是因为解析器配置错误),则取样将中止.可以使用输入格式的参数覆盖特定输入的此值. | -| - -##### compiler.delimited-informat.min-line-samples - - | 2 | 编译器为分隔输入采用的最小行样本数.样本用于估计记录数.可以使用输入格式的参数覆盖特定输入的此值 | - -### 运行时算法 - -| 键 | 默认 | 描述 | -| --- | --- | --- | -| - -##### taskmanager.runtime.hashjoin-bloom-filters - - | false | 用于在混合散列连接实现中激活/停用bloom过滤器的标志.如果散列连接需要溢出到磁盘(数据集大于保存的内存部分),这些布隆过滤器可以大大Reduce溢出记录的数量,但需要花费一些CPU周期. | -| - -##### taskmanager.runtime.max-fan - - | 128 | 外部合并的最大扇入连接和扇出用于溢出哈希表.限制每个 算子的文件句柄数,但如果设置得太小,可能会导致中间合并/分区. | -| +这些参数配置Flink使用的默认HDFS.未指定HDFS配置的设置必须指定HDFS文件的完整路径(`hdfs://address:port/path/to/files`)文件也将使用默认HDFS参数(块大小,复制因子)编写. -##### taskmanager.runtime.sort-spilling-threshold +* `fs.hdfs.hadoopconf`:Hadoop文件系统(HDFS)配置**目录**的绝对路径(可选值).指定此值允许程序使用短URI引用HDFS文件(`hdfs:///path/to/files`不包括文件URI中NameNode的地址和端口).如果没有此选项,则可以访问HDFS文件,但需要完全限定的URI `hdfs://address:port/path/to/files`.此选项还会导致文件编写者获取HDFS的块大小和复制因子的默认值.Flink将在指定目录中查找“core-site.xml”和“hdfs-site.xml”文件. - | 0.8 | 当这部分内存预算已满时,排序 算子操作开始溢出. | +* `fs.hdfs.hdfsdefault`:Hadoop自己的配置文件“hdfs-default.xml”的绝对路径(DEFAULT:null). -### Resource Manager +* `fs.hdfs.hdfssite`:Hadoop自己的配置文件“hdfs-site.xml”的绝对路径(DEFAULT:null). -本节中的配置键独立于使用的资源管理框架(YARN,Mesos,Standalone,...) +### 核心 | 键 | 默认 | 描述 | | --- | --- | --- | -| - -##### containerized.heap-cutoff-min +| `classloader.parent-first-patterns.additional` | (none) | 一个(以分号分隔的)模式列表,指定应始终首先通过父ClassLoader解析哪些类.模式是一个简单的前缀,它根据完全限定的类名进行检查.这些模式附加到“classloader.parent-first-patterns.default”. | +| `classloader.parent-first-patterns.default` | “java .; <wbr>scala .; <wbr>org.apache.flink .; <wbr>com.esotericsoftware.kryo; <wbr>org.apache.hadoop .; <wbr>javax.annotation .; <wbr>org.slf4j; <wbr>org.apache.log4j; <wbr>org.apache.logging; <wbr>org. apache.commons.logging; <wbr>ch.qos.logback“ | 一个(以分号分隔的)模式列表,指定应始终首先通过父ClassLoader解析哪些类.模式是一个简单的前缀,它根据完全限定的类名进行检查.通常不应修改此设置.要添加其他模式,我们建议使用“classloader.parent-first-patterns.additional”. | +| `classloader.resolve-order` | "child-first" | 从用户代码加载类时定义类解析策略,这意味着是首先检查用户代码jar(“child-first”)还是应用程序类路径(“parent-first”).默认设置指示首先从用户代码jar加载类,这意味着用户代码jar可以包含和加载不同于Flink使用的(依赖)依赖项. | +| `io.tmp.dirs` | YARN上的'LOCAL_DIRS'.Mesos上的'_FLINK_TMP_DIR'.独立的System.getProperty(“java.io.tmpdir”). | | +| `mode` | "new" | 切换到选择执行模式.可能的值为“new”和“legacy”. | +| `parallelism.default` | 1 | | - | 600 | 作为安全边际,要在容器中删除的最小堆内存量. | -| - -##### containerized.heap-cutoff-ratio - - | 0.25 | 要从容器中删除的堆空间百分比(YARN / Mesos),以补偿其他JVM内存使用情况. | -| - -##### local.number-resourcemanager +### JobManager - | 1 | | -| +| 键 | 默认 | 描述 | +| --- | --- | --- | +| `jobmanager.archive.fs.dir` | (none) | | +| `jobmanager.execution.attempts-history-size` | 16 | 历史记录中保存的最大执行尝试次数. | +| `jobmanager.execution.failover-strategy` | `full` | 此选项指定作业计算如何从任务失败中恢复.可接受的值是: | +| | | 'full':重新启动所有任务. | +| | | 'individual':仅重新启动失败的任务.仅当所有任务都是独立组件时才应使用. | +| | | 'region':重新启动可能受任务失败影响的所有任务. | +| `jobmanager.heap.size` | “1024m” | JobManager的JVM堆大小. | +| `jobmanager.resourcemanager.reconnect-interval` | 2000 | 此选项指定在与资源管理器的连接丢失时触发资源管理器重新连接的时间间隔.此选项仅供内部使用. | +| `jobmanager.rpc.address` | (none) | config参数定义要连接的网络地址以与JobManager进行通信.此值仅在具有静态名称或地址的单个JobManager存在的设置中解释(简单的独立设置或具有动态服务名称解析的容器设置).当使用Leader选举服务(如ZooKeeper)从潜在的多个Slave JobManagers中选择和发现JobManagerLeader时,它不会在许多高可用性设置中使用. | +| `jobmanager.rpc.port` | 6123 | config参数定义要连接的网络端口以与JobManager进行通信.与jobmanager.rpc.address一样,此值仅在设置中解释,其中存在具有静态名称/地址和端口的单个JobManager(简单的独立设置或具有动态服务名称解析的容器设置).当使用Leader选举服务(如ZooKeeper)从潜在的多个Slave JobManagers中选择和发现JobManagerLeader时,此配置选项不会用于许多高可用性设置. | +| `jobstore.cache-size` | 52428800 | 作业存储缓存大小(以字节为单位),用于将已完成的作业保存在内存中. | +| `jobstore.expiration-time` | 3600 | 完成作业到期并从作业库中清除的时间(以秒为单位). | +| `slot.idle.timeout` | 50000 | Slot Pool中空闲槽的超时时间(以ms为单位). | +| `slot.request.timeout` | 300000 | 从Slot Pool请求插槽的超时(以ms为单位). | -##### resourcemanager.job.timeout +### TaskManager - | “5m" | 没有TaskManager作为Leader的工作超时. | -| +| 键 | 默认 | 描述 | +| --- | --- | --- | +| `task.cancellation.interval` | 30000 | 两次连续任务取消尝试之间的时间间隔(以ms为单位). | +| `task.cancellation.timeout` | 180000 | 超时(以ms为单位),在此之后任务取消超时并导致致命的TaskManager错误.值为0将禁用看门狗. | +| `task.cancellation.timers.timeout` | 7500 | | +| `task.checkpoint.alignment.max-size` | -1 | 检查点对齐可以缓冲的最大字节数.如果检查点对齐缓冲超过配置的数据量,则中止检查点(跳过).值-1表示没有限制. | +| `taskmanager.data.port` | 0 | TaskManager的端口用于数据交换 算子操作. | +| `taskmanager.data.ssl.enabled` | true | 为taskmanager数据传输启用SSL支持.仅当内部SSL的全局标志(security.ssl.internal.enabled)设置为true时,此选项才适用 | +| `taskmanager.debug.memory.log` | false | 指示是否启动线程的标志,该线程重复记录JVM的内存使用情况. | +| `taskmanager.debug.memory.log-interval` | 5000 | 日志线程记录当前内存使用情况的时间间隔(以ms为单位). | +| `taskmanager.exit-on-fatal-akka-error` | false | 是否应启动TaskManager的隔离监视器.如果隔离监视器检测到它已隔离另一个actor系统或者它已被另一个actor系统隔离,则会关闭该actor系统. | +| `taskmanager.heap.size` | “1024m” | TaskManagers的JVM堆大小,它是系统的并行工作者.在YARN设置中,此值自动配置为TaskManager的YARN容器的大小,减去一定的容差值. | +| `taskmanager.host` | (none) | TaskManager绑定到的网络接口的主机名.默认情况下,TaskManager搜索可以连接到JobManager和其他TaskManagers的网络接口.如果该策略由于某种原因失败,则此选项可用于定义主机名.由于不同的TaskManagers需要此选项的不同值,因此通常在其他非共享的特定于TaskManager的配置文件中指定. | +| `taskmanager.jvm-exit-on-oom` | false | 是否在任务线程抛出OutOfMemoryError时终止TaskManager. | +| `taskmanager.memory.fraction` | 0.7 | TaskManager为排序,哈希表和中间结果的缓存预留的相对内存量(在减去网络缓冲区使用的内存量之后).例如,值“0.8”表示TaskManager为内部数据缓冲区保存80%的内存,为TaskManager的堆留下20%的可用内存,用于由用户定义的函数创建的对象.仅当未设置taskmanager.memory.size时,才会评估此参数. | +| `taskmanager.memory.off-heap` | false | 内存分配方法(JVM堆或堆外),用于TaskManager的托管内存以及网络缓冲区. | +| `taskmanager.memory.preallocate` | false | 在TaskManager启动时是否应预先分配TaskManager托管内存. | +| `taskmanager.memory.segment-size` | “32KB” | 网络堆栈和内存管理器使用的内存缓冲区的大小. | +| `taskmanager.memory.size` | “0” | TaskManager的内存管理器分配的内存量.如果未设置,将分配相对分数. | +| `taskmanager.network.detailed-metrics` | false | 布尔标志,用于启用/禁用有关入站/出站网络队列长度的更详细指标. | +| `taskmanager.network.memory.buffers-per-channel` | 2 | 每个传出/传入通道(子分区/输入通道)使用的最大网络缓冲区数.在基于信用的流量控制模式下,这表示每个输入通道中有多少信用.它应配置至少2以获得良好的性能.1个缓冲区用于接收子分区中的飞行中数据,1个缓冲区用于并行序列化. | +| `taskmanager.network.memory.floating-buffers-per-gate` | 8 | 每个输出/输入门(结果分区/输入门)使用的额外网络缓冲区数.在基于信用的流量控制模式中,这表示在所有输入通道之间共享多少浮动信用.浮动缓冲区基于积压(子分区中的实时输出缓冲区)反馈来分布,并且可以帮助减轻由子分区之间的不平衡数据分布引起的背压.如果节点之间的往返时间较长和/或群集中的机器数量较多,则应增加此值. | +| `taskmanager.network.memory.fraction` | 0.1 | 用于网络缓冲区的JVM内存的分数.这决定了TaskManager可以同时拥有多少流数据交换通道以及通道缓冲的程度.如果作业被拒绝或者您收到系统没有足够缓冲区的警告,请增加此值或下面的最小/最大值.另请注意,“taskmanager.network.memory.min”和“taskmanager.network.memory.max”可能会覆盖此分数. | +| `taskmanager.network.memory.max` | “1GB” | 网络缓冲区的最大内存大小. | +| `taskmanager.network.memory.min` | “64MB” | 网络缓冲区的最小内存大小. | +| `taskmanager.network.request-backoff.initial` | 100 | 输入通道的分区请求的最小退避. | +| `taskmanager.network.request-backoff.max` | 10000 | 输入通道的分区请求的最大退避. | +| `taskmanager.numberOfTaskSlots` | 1 | 单个TaskManager可以运行的并行算子或用户函数实例的数量.如果此值大于1,则单个TaskManager将获取函数或 算子的多个实例.这样,TaskManager可以使用多个CPU内核,但同时,可用内存在不同的算子或函数实例之间划分.此值通常与TaskManager的计算机具有的物理CPU核心数成比例(例如,等于核心数,或核心数的一半). | +| `taskmanager.registration.initial-backoff` | “500ms” | 两次连续注册尝试之间的初始注册退避.每次新注册尝试的退避加倍,直到达到最大注册退避. | +| `taskmanager.registration.max-backoff` | “30s" | 两次连续注册尝试之间的最大注册退避.最大注册退避需要时间单位指定符(ms / s / min / h / d). | +| `taskmanager.registration.refused-backoff` | “10s" | 注册后的退避已被作业管理员拒绝,然后重试连接. | +| `taskmanager.registration.timeout` | “5m" | 定义TaskManager注册的超时.如果在未成功注册的情况下超过持续时间,则TaskManager将终止. | +| `taskmanager.rpc.port` | “0” | TaskManager的IPC端口.接受端口列表(“50100,50101”),范围(“50100-50200”)或两者的组合.建议在同一台计算机上运行多个TaskManagers时设置一系列端口以避免冲突. | -##### resourcemanager.rpc.port +### 分布式协调(通过Akka) - | 0 | 定义要连接的网络端口以与资源管理器进行通信.默认情况下,JobManager的端口,因为使用了相同的ActorSystem.无法使用此配置键定义端口范围. | -| +| 键 | 默认 | 描述 | +| --- | --- | --- | +| `akka.ask.timeout` | “10s" | 超时用于所有期货并阻止Akka通话.如果Flink由于超时而失败,那么您应该尝试增加此值.超时可能是由于机器速度慢或网络拥挤造成的.超时值需要时间单位指定符(ms / s / min / h / d). | +| `akka.client-socket-worker-pool.pool-size-factor` | 1.0 | 池大小因子用于使用以下公式确定线程池大小:ceil(可用处理器*因子).然后,结果大小由pool-size-min和pool-size-max值限制. | +| `akka.client-socket-worker-pool.pool-size-max` | 2 | 将基于因子的数量限制为的最大线程数. | +| `akka.client-socket-worker-pool.pool-size-min` | 1 | 将基于因子的数量限制为的最小线程数. | +| `akka.client.timeout` | “60s" | 客户端的所有阻塞调用超时. | +| `akka.fork-join-executor.parallelism-factor` | 2.0 | 并行因子用于使用以下公式确定线程池大小:ceil(可用处理器*因子).然后,得到的大小受parallelism-min和parallelism-max值的限制. | +| `akka.fork-join-executor.parallelism-max` | 64 | 将基于因子的并行数量限制为的最大线程数. | +| `akka.fork-join-executor.parallelism-min` | 8 | 将基于因子的并行数量限制为的最小线程数. | +| `akka.framesize` | “10485760b” | 在JobManager和TaskManager之间发送的消息的最大大小.如果Flink由于消息超出此限制而失败,那么您应该增加它.邮件大小需要大小单位说明符. | +| `akka.jvm-exit-on-fatal-error` | true | 退出JVM致命的Akka错误. | +| `akka.log.lifecycle.events` | false | 打开Akka远程记录事件.在调试时将此值设置为“true”. | +| `akka.lookup.timeout` | “10s" | 用于查找JobManager的超时.超时值必须包含时间单位说明符(ms / s / min / h / d). | +| `akka.retry-gate-closed-for` | 50 | 断开远程连接后,应关闭门的ms数. | +| `akka.server-socket-worker-pool.pool-size-factor` | 1.0 | 池大小因子用于使用以下公式确定线程池大小:ceil(可用处理器*因子).然后,结果大小由pool-size-min和pool-size-max值限制. | +| `akka.server-socket-worker-pool.pool-size-max` | 2 | 将基于因子的数量限制为的最大线程数. | +| `akka.server-socket-worker-pool.pool-size-min` | 1 | 将基于因子的数量限制为的最小线程数. | +| `akka.ssl.enabled` | true | 为Akka的远程通信打开SSL.仅当全局ssl标志security.ssl.enabled设置为true时,这才适用. | +| `akka.startup-timeout` | (none) | 超时之后,远程组件的启动被视为失败. | +| `akka.tcp.timeout` | “20s" | 所有出站连接超时.如果由于网络速度较慢而导致连接到TaskManager时遇到问题,则应增加此值. | +| `akka.throughput` | 15 | 在将线程返回到池之前批处理的消息数.较低的值表示公平的调度,而较高的值可以以不公平为代价来提高性能. | +| `akka.transport.heartbeat.interval` | “1000s" | Akka传输故障检测器的心跳间隔.由于Flink使用TCP,因此不需要检测器.因此,通过将间隔设置为非常高的值来禁用检测器.如果您需要传输故障检测器,请将间隔设置为某个合理的值.间隔值需要时间单位指定符(ms / s / min / h / d). | +| `akka.transport.heartbeat.pause` | “6000s" | Akka的传输故障检测器可接受的心跳暂停.由于Flink使用TCP,因此不需要检测器.因此,通过将暂停设置为非常高的值来禁用检测器.如果您需要传输故障检测器,请将暂停设置为某个合理的值.暂停值需要时间单位指定符(ms / s / min / h / d). | +| `akka.transport.threshold` | 300.0 | 传输故障检测器的阈值.由于Flink使用TCP,因此检测器不是必需的,因此阈值被设置为高值. | +| `akka.watch.heartbeat.interval` | “10s" | Akka的DeathWatch机制检测死亡TaskManagers的心跳间隔.如果由于心跳消息丢失或延迟而导致TaskManagers被错误地标记为死亡,那么您应该减小此值或增加akka.watch.heartbeat.pause.可在[此处](http://doc.akka.io/docs/akka/snapshot/scala/remoting.html#failure-detector)找到Akka的DeathWatch的详尽描述[](http://doc.akka.io/docs/akka/snapshot/scala/remoting.html#failure-detector) | +| `akka.watch.heartbeat.pause` | “60s" | Akka的DeathWatch机制可接受的心跳暂停.较低的值不允许心律不齐.如果由于心跳消息丢失或延迟而导致TaskManagers被错误地标记为死亡,那么您应该增加此值或Reduceakka.watch.heartbeat.interval.较高的值会增加检测死的TaskManager的时间.可在[此处](http://doc.akka.io/docs/akka/snapshot/scala/remoting.html#failure-detector)找到Akka的DeathWatch的详尽描述[](http://doc.akka.io/docs/akka/snapshot/scala/remoting.html#failure-detector) | +| `akka.watch.threshold` | 12 | DeathWatch故障检测器的阈值.较低的值容易出现误报,而较高的值会增加检测死的TaskManager的时间.可在[此处](http://doc.akka.io/docs/akka/snapshot/scala/remoting.html#failure-detector)找到Akka的DeathWatch的详尽描述[](http://doc.akka.io/docs/akka/snapshot/scala/remoting.html#failure-detector) | -##### resourcemanager.taskmanager-timeout +### REST - | 30000 | 释放空闲TaskManager的超时. | +| 键 | 默认 | 描述 | +| --- | --- | --- | +| `rest.address` | (none) | 客户端应该用于连接到服务器的地址. | +| `rest.await-leader-timeout` | 30000 | 客户端等待Leader地址的时间(以ms为单位),例如Dispatcher或WebMonitorEndpoint | +| `rest.bind-address` | (none) | 服务器绑定自身的地址. | +| `rest.client.max-content-length` | 104857600 | 客户端将处理的最大内容长度(以字节为单位). | +| `rest.connection-timeout` | 15000 | 客户端建立TCP连接的最长时间(以ms为单位). | +| `rest.port` | 8081 | 服务器侦听的端口/客户端连接到的端口. | +| `rest.retry.delay` | 3000 | 客户端在重试之间等待的时间(以ms为单位)(另请参阅“rest.retry.max-attempts”). | +| `rest.retry.max-attempts` | 20 | 如果可重试 算子操作失败,客户端将尝试重试的次数. | +| `rest.server.max-content-length` | 104857600 | 服务器将处理的最大内容长度(以字节为单位). | -### YARN +### Blob服务器 | 键 | 默认 | 描述 | | --- | --- | --- | -| +| `blob.fetch.backlog` | 1000 | config参数定义JobManager上BLOB提取的积压. | +| `blob.fetch.num-concurrent` | 50 | config参数定义JobManager服务的最大并发BLOB提取数. | +| `blob.fetch.retries` | 5 | config参数定义失败的BLOB提取的退出次数. | +| `blob.offload.minsize` | 1048576 | 要卸载到BlobServer的消息的最小大小. | +| `blob.server.port` | “0” | config参数定义blob服务的服务器端口. | +| `blob.service.cleanup.interval` | 3600 | TaskManager中blob缓存的清理间隔(以秒为单位). | +| `blob.service.ssl.enabled` | true | 用于覆盖blob服务传输的ssl支持的标志. | +| `blob.storage.directory` | (none) | config参数,用于定义blob服务器使用的存储目录. | -##### yarn.application-attempts +### 心跳管理器 - | (none) | ApplicationMaster重启次数.请注意,整个Flink群集将重新启动,YARN客户端将断开连接.此外,JobManager地址将更改,您需要手动设置JM主机:port.建议将此选项保存为1. | -| +| 键 | 默认 | 描述 | +| --- | --- | --- | +| `heartbeat.interval` | 10000 | 从发送方请求心跳的时间间隔. | +| `heartbeat.timeout` | 50000 | 为发送方和接收方双方请求和接收心跳的超时. | -##### yarn.application-master.port +### SSL设置 - | “0” | 使用此配置选项,用户可以为Application Master(和JobManager)RPC端口指定端口,一系列端口或端口列表.默认情况下,我们建议使用默认值(0)让 算子操作系统选择适当的端口.特别是当多个AM在同一物理主机上运行时,固定端口分配会阻止AM启动.例如,在具有限制性防火墙的环境中在YARN上运行Flink时,此选项允许指定一系列允许的端口. | -| +| 键 | 默认 | 描述 | +| --- | --- | --- | +| `security.ssl.algorithms` | “TLS_RSA_WITH_AES_128_CBC_SHA” | 要支持的标准SSL算法的逗号分隔列表.[在这里](http://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#ciphersuites)阅读更多[](http://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#ciphersuites) | +| `security.ssl.internal.enabled` | false | 打开SSL以进行内部网络通信.可选地,特定组件可以通过它们自己的设置(rpc,数据传输,REST等)覆盖它. | +| `security.ssl.internal.key-password` | (none) | 解密Keys库中Flink内部端点(rpc,数据传输,blob服务器)Keys的密钥. | +| `security.ssl.internal.keystore` | (none) | 带有SSLKeys和证书的JavaKeys库文件,用于Flink的内部端点(rpc,数据传输,blob服务器). | +| `security.ssl.internal.keystore-password` | (none) | 为Flink的内部端点(rpc,数据传输,blob服务器)解密Flink的Keys库文件的密钥. | +| `security.ssl.internal.truststore` | (none) | 包含公共CA证书的信任库文件,用于验证Flink内部端点(rpc,数据传输,blob服务器)的对等方. | +| `security.ssl.internal.truststore-password` | (none) | 用于解密Flink内部端点(rpc,数据传输,blob服务器)的信任库的密码. | +| `security.ssl.key-password` | (none) | 解密Keys库中的服务器Keys的密钥. | +| `security.ssl.keystore` | (none) | flink端点用于其SSLKeys和证书的JavaKeys库文件. | +| `security.ssl.keystore-password` | (none) | 解密Keys库文件的密钥. | +| `security.ssl.protocol` | “TLSv1.2” | ssl传输支持的SSL协议版本.请注意,它不支持以逗号分隔的列表. | +| `security.ssl.rest.enabled` | false | 通过REST端点打开SSL以进行外部通信. | +| `security.ssl.rest.key-password` | (none) | 解密Flink外部REST端点的Keys库中的Keys的密钥. | +| `security.ssl.rest.keystore` | (none) | 带有SSLKeys和证书的JavaKeys库文件,用于Flink的外部REST端点. | +| `security.ssl.rest.keystore-password` | (none) | 为Flink的外部REST端点解密Flink的Keys库文件的密钥. | +| `security.ssl.rest.truststore` | (none) | 包含公共CA证书的信任库文件,用于验证Flink的外部REST端点的对等方. | +| `security.ssl.rest.truststore-password` | (none) | 用于解密Flink外部REST端点的信任库的密码. | +| `security.ssl.truststore` | (none) | 信任库文件,包含flink端点用于验证对等方证书的公共CA证书. | +| `security.ssl.truststore-password` | (none) | 解密信任库的秘诀. | +| `security.ssl.verify-hostname` | true | 标记以在ssl握手期间启用对等方的主机名验证. | -##### yarn.appmaster.rpc.address +### 网络通讯(通过Netty) - | (none) | 应用程序主RPC系统正在侦听的主机名或地址. | -| +这些参数允许高级调整.在大型群集上运行并发高吞吐量作业时,默认值就足够了. -##### yarn.appmaster.rpc.port +| 键 | 默认 | 描述 | +| --- | --- | --- | +| `taskmanager.network.netty.client.connectTimeoutSec` | 120 | Netty客户端连接超时. | +| `taskmanager.network.netty.client.numThreads` | -1 | Netty客户端线程的数量. | +| `taskmanager.network.netty.num-arenas` | -1 | Netty竞技场的数量. | +| `taskmanager.network.netty.sendReceiveBufferSize` | 0 | Netty发送和接收缓冲区大小.这默认为系统缓冲区大小(cat / proc / sys / net / ipv4 / tcp_ [rw] mem),在现代Linux中为4 MiB. | +| `taskmanager.network.netty.server.backlog` | 0 | netty服务器连接积压. | +| `taskmanager.network.netty.server.numThreads` | -1 | Netty服务器线程数. | +| `taskmanager.network.netty.transport` | “nio” | Netty传输类型,“nio”或“epoll” | - | -1 | 应用程序主RPC系统正在侦听的端口. | -| +### Web前端 -##### yarn.containers.vcores +| 键 | 默认 | 描述 | +| --- | --- | --- | +| `web.access-control-allow-origin` | “*” | | +| `web.address` | (none) | | +| `web.backpressure.cleanup-interval` | 600000 | | +| `web.backpressure.delay-between-samples` | 50 | | +| `web.backpressure.num-samples` | 100 | | +| `web.backpressure.refresh-interval` | 60000 | | +| `web.checkpoints.history` | 10 | | +| `web.history` | 5 | | +| `web.log.path` | (none) | | +| `web.refresh-interval` | 3000 | | +| `web.ssl.enabled` | true | | +| `web.submit.enable` | true | | +| `web.timeout` | 10000 | | +| `web.tmpdir` | System.getProperty( “java.io.tmpdir”) | | +| `web.upload.dir` | (none) | | - | -1 | 每个YARN容器的虚拟核心数(vcores).默认情况下,vcores的数量设置为每个TaskManager的插槽数(如果已设置),或者设置为1,否则设置为1.为了使用此参数,您的群集必须启用CPU调度.您可以通过设置来完成此 算子操作`org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler`. | -| +### 文件系统 -##### yarn.heartbeat-delay +| 键 | 默认 | 描述 | +| --- | --- | --- | +| `fs.default-scheme` | (none) | 默认文件系统方案,用于未明确声明方案的路径.可能包含权限,例如,在HDFS NameNode的情况下为host:port. | +| `fs.output.always-create-directory` | false | 以大于1的并行度运行的文件编写器为输出文件路径创建目录,并将不同的结果文件(每个并行编写器任务一个)放入该目录中.如果此选项设置为“true”,则并行度为1的编写器也将创建一个目录并将单个结果文件放入其中.如果该选项设置为“false”,则编写器将直接在输出路径上直接创建文件,而不创建包含目录. | +| `fs.overwrite-files` | false | 指定默认情况下文件输出编写器是否应覆盖现有文件.设置为“true”以默认覆盖,否则设置为“false”. | - | 5 | 使用ResourceManager的心跳之间的时间,以秒为单位. | -| +### 编译/优化 -##### yarn.maximum-failed-containers +| 键 | 默认 | 描述 | +| --- | --- | --- | +| `compiler.delimited-informat.max-line-samples` | 10 | 编译器为分隔输入采用的最大行样本数.样本用于估计记录数.可以使用输入格式的参数覆盖特定输入的此值. | +| `compiler.delimited-informat.max-sample-len` | 2097152 | 编译器用于分隔输入的行样本的最大长度.如果单个样本的长度超过此值(可能是因为解析器配置错误),则取样将中止.可以使用输入格式的参数覆盖特定输入的此值. | +| `compiler.delimited-informat.min-line-samples` | 2 | 编译器为分隔输入采用的最小行样本数.样本用于估计记录数.可以使用输入格式的参数覆盖特定输入的此值 | - | (none) | 系统在发生故障时将重新分配的最大容器数. | -| +### 运行时算法 -##### yarn.per-job-cluster.include-user-jar +| 键 | 默认 | 描述 | +| --- | --- | --- | +| `taskmanager.runtime.hashjoin-bloom-filters` | false | 用于在混合散列连接实现中激活/停用bloom过滤器的标志.如果散列连接需要溢出到磁盘(数据集大于保存的内存部分),这些布隆过滤器可以大大Reduce溢出记录的数量,但需要花费一些CPU周期. | +| `taskmanager.runtime.max-fan` | 128 | 外部合并的最大扇入连接和扇出用于溢出哈希表.限制每个 算子的文件句柄数,但如果设置得太小,可能会导致中间合并/分区. | +| `taskmanager.runtime.sort-spilling-threshold` | 0.8 | 当这部分内存预算已满时,排序 算子操作开始溢出. | - | “ORDER” | 定义用户jar是否包含在每个作业集群的系统类路径中以及它们在路径中的位置.它们可以位于开头(“FIRST”),末尾(“LAST”),或者根据其名称(“ORDER”)定位.将此参数设置为“DISABLED”会导致jar包含在用户类路径中. | -| +### Resource Manager -##### yarn.properties-file.location +本节中的配置键独立于使用的资源管理框架(YARN,Mesos,Standalone,...) - | (none) | 将Flink作业提交给YARN时,JobManager的主机和可用处理槽的数量将写入属性文件,以便Flink客户端能够选择这些详细信息.此配置参数允许更改该文件的默认位置(例如,对于在用户之间共享Flink安装的环境). | -| +| 键 | 默认 | 描述 | +| --- | --- | --- | +| `containerized.heap-cutoff-min` | 600 | 作为安全边际,要在容器中删除的最小堆内存量. | +| `containerized.heap-cutoff-ratio` | 0.25 | 要从容器中删除的堆空间百分比(YARN / Mesos),以补偿其他JVM内存使用情况. | +| `local.number-resourcemanager` | 1 | | +| `resourcemanager.job.timeout` | “5m" | 没有TaskManager作为Leader的工作超时. | +| `resourcemanager.rpc.port` | 0 | 定义要连接的网络端口以与资源管理器进行通信.默认情况下,JobManager的端口,因为使用了相同的ActorSystem.无法使用此配置键定义端口范围. | +| `resourcemanager.taskmanager-timeout` | 30000 | 释放空闲TaskManager的超时. | -##### yarn.tags +### YARN - | (none) | 要应用于Flink YARN应用程序的以逗号分隔的标记列表. | +| 键 | 默认 | 描述 | +| --- | --- | --- | +| `yarn.application-attempts` | (none) | ApplicationMaster重启次数.请注意,整个Flink群集将重新启动,YARN客户端将断开连接.此外,JobManager地址将更改,您需要手动设置JM主机:port.建议将此选项保存为1. | +| `yarn.application-master.port` | “0” | 使用此配置选项,用户可以为Application Master(和JobManager)RPC端口指定端口,一系列端口或端口列表.默认情况下,我们建议使用默认值(0)让 算子操作系统选择适当的端口.特别是当多个AM在同一物理主机上运行时,固定端口分配会阻止AM启动.例如,在具有限制性防火墙的环境中在YARN上运行Flink时,此选项允许指定一系列允许的端口. | +| `yarn.appmaster.rpc.address` | (none) | 应用程序主RPC系统正在侦听的主机名或地址. | +| `yarn.appmaster.rpc.port` | -1 | 应用程序主RPC系统正在侦听的端口. | +| `yarn.containers.vcores` | -1 | 每个YARN容器的虚拟核心数(vcores).默认情况下,vcores的数量设置为每个TaskManager的插槽数(如果已设置),或者设置为1,否则设置为1.为了使用此参数,您的群集必须启用CPU调度.您可以通过设置来完成此 算子操作`org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler`. | +| `yarn.heartbeat-delay` | 5 | 使用ResourceManager的心跳之间的时间,以秒为单位. | +| `yarn.maximum-failed-containers` | (none) | 系统在发生故障时将重新分配的最大容器数. | +| `yarn.per-job-cluster.include-user-jar` | “ORDER” | 定义用户jar是否包含在每个作业集群的系统类路径中以及它们在路径中的位置.它们可以位于开头(“FIRST”),末尾(“LAST”),或者根据其名称(“ORDER”)定位.将此参数设置为“DISABLED”会导致jar包含在用户类路径中. | +| `yarn.properties-file.location` | (none) | 将Flink作业提交给YARN时,JobManager的主机和可用处理槽的数量将写入属性文件,以便Flink客户端能够选择这些详细信息.此配置参数允许更改该文件的默认位置(例如,对于在用户之间共享Flink安装的环境). | +| `yarn.tags` | (none) | 要应用于Flink YARN应用程序的以逗号分隔的标记列表. | ### Mesos | 键 | 默认 | 描述 | | --- | --- | --- | -| - -##### mesos.failover-timeout - - | 604800 | Mesos调度程序的故障转移超时(以秒为单位),之后将自动关闭正在运行的任务. | -| - -##### mesos.initial-tasks - - | 0 | 最初的工人在主人开始时提出来.除非Flink处于[传统模式,](#legacy)否则将忽略此选项. | -| - -##### mesos.master - - | (none) | Mesos主URL.该值应采用以下形式之一: - -* 主持人:port -* ZK://主机1:端口1,主机2:端口2,... /路径 -* ZK://用户名:密码@主机1:端口1,主机2:端口2,... /路径 -* 文件:///路径/到/文件 - - | -| - -##### mesos.maximum-failed-tasks - - | -1 | 群集失败前失败的最大工作数.可以设置为-1以禁用此函数.除非Flink处于[传统模式,](#legacy)否则将忽略此选项. | -| - -##### mesos.resourcemanager.artifactserver.port - - | 0 | config参数定义要使用的Mesos工件服务器端口.将端口设置为0将允许 算子操作系统选择可用端口. | -| - -##### mesos.resourcemanager.artifactserver.ssl.enabled - - | true | 为Flink工件服务器启用SSL.请注意,security.ssl.enabled也需要设置为true加密才能启用加密. | -| - -##### mesos.resourcemanager.framework.name - - | “Flink” | Mesos框架名称 | -| - -##### mesos.resourcemanager.framework.principal - - | (none) | Mesos框架主体 | -| - -##### mesos.resourcemanager.framework.role - - | “*” | Mesos框架角色定义 | -| - -##### mesos.resourcemanager.framework.secret - - | (none) | Mesos框架密钥 | -| - -##### mesos.resourcemanager.framework.user - - | (none) | Mesos框架用户 | -| - -##### mesos.resourcemanager.tasks.port-assignments - - | (none) | 以逗号分隔的配置键列表,表示可配置端口.所有端口Keys将动态获取通过Mesos分配的端口. | +| `mesos.failover-timeout` | 604800 | Mesos调度程序的故障转移超时(以秒为单位),之后将自动关闭正在运行的任务. | +| `mesos.initial-tasks` | 0 | 最初的工人在主人开始时提出来.除非Flink处于[传统模式,](#legacy)否则将忽略此选项. | +| `mesos.master` | (none) | Mesos主URL.该值应采用以下形式之一: | +| | | 主持人:port | +| | | ZK://主机1:端口1,主机2:端口2,... /路径 | +| | | ZK://用户名:密码@主机1:端口1,主机2:端口2,... /路径 | +| | | 文件:///路径/到/文件 | +| `mesos.maximum-failed-tasks` | -1 | 群集失败前失败的最大工作数.可以设置为-1以禁用此函数.除非Flink处于[传统模式,](#legacy)否则将忽略此选项. | +| `mesos.resourcemanager.artifactserver.port` | 0 | config参数定义要使用的Mesos工件服务器端口.将端口设置为0将允许 算子操作系统选择可用端口. | +| `mesos.resourcemanager.artifactserver.ssl.enabled` | true | 为Flink工件服务器启用SSL.请注意,security.ssl.enabled也需要设置为true加密才能启用加密. | +| `mesos.resourcemanager.framework.name` | “Flink” | Mesos框架名称 | +| `mesos.resourcemanager.framework.principal` | (none) | Mesos框架主体 | +| `mesos.resourcemanager.framework.role` | “*” | Mesos框架角色定义 | +| `mesos.resourcemanager.framework.secret` | (none) | Mesos框架密钥 | +| `mesos.resourcemanager.framework.user` | (none) | Mesos框架用户 | +| `mesos.resourcemanager.tasks.port-assignments` | (none) | 以逗号分隔的配置键列表,表示可配置端口.所有端口Keys将动态获取通过Mesos分配的端口. | #### Mesos TaskManager | 键 | 默认 | 描述 | | --- | --- | --- | -| - -##### mesos.constraints.hard.hostattribute - - | (none) | 基于代理属性在Mesos上放置任务的约束.采用逗号分隔的键:值对列表,对应于目标介质代理公开的属性.示例:az:eu-west-1a,系列:t2 | -| - -##### mesos.resourcemanager.tasks.bootstrap-cmd - - | (none) | 在TaskManager启动之前执行的命令. | -| - -##### mesos.resourcemanager.tasks.container.docker.force-pull-image - - | false | 指示docker containerizer强制拉动镜像,而不是重用缓存版本. | -| - -##### mesos.resourcemanager.tasks.container.docker.parameters - - | (none) | 使用docker容器时,要传递给docker run命令的自定义参数.逗号分隔的“key = value”对列表.“值”可能包含“=”. | -| - -##### mesos.resourcemanager.tasks.container.image.name - - | (none) | 用于容器的映像名称. | -| - -##### mesos.resourcemanager.tasks.container.type - - | “mesos” | 使用的集装箱类型:“mesos”或“docker”. | -| - -##### mesos.resourcemanager.tasks.container.volumes - - | (none) | 逗号分隔的[host_path:] container_path [:RO | RW]列表.这允许将额外的卷安装到容器中. | -| - -##### mesos.resourcemanager.tasks.cpus - - | 0.0 | 要分配给Mesos工作者的CPU. | -| - -##### mesos.resourcemanager.tasks.gpus - - | 0 | 要分配给Mesos工作者的GPU. | -| - -##### mesos.resourcemanager.tasks.hostname - - | (none) | 用于定义TaskManager主机名的可选值.模式_TASK_由Mesos任务的实际ID替换.这可用于配置TaskManager以使用Mesos DNS(例如_TASK_.flink-service.mesos)进行名称查找. | -| - -##### mesos.resourcemanager.tasks.mem - - | 1024 | 要以MB为单位分配给Mesos worker的内存. | -| - -##### mesos.resourcemanager.tasks.taskmanager-cmd - - | "$FLINK_HOME/bin/mesos-taskmanager.sh" | | -| - -##### mesos.resourcemanager.tasks.uris - - | (none) | 以逗号分隔的自定义工件URI列表,这些URI将下载到Mesos工作者的沙箱中. | -| - -##### taskmanager.numberOfTaskSlots - - | 1 | 单个TaskManager可以运行的并行算子或用户函数实例的数量.如果此值大于1,则单个TaskManager将获取函数或 算子的多个实例.这样,TaskManager可以使用多个CPU内核,但同时,可用内存在不同的算子或函数实例之间划分.此值通常与TaskManager的计算机具有的物理CPU核心数成比例(例如,等于核心数,或核心数的一半). | +| `mesos.constraints.hard.hostattribute` | (none) | 基于代理属性在Mesos上放置任务的约束.采用逗号分隔的键:值对列表,对应于目标介质代理公开的属性.示例:az:eu-west-1a,系列:t2 | +| `mesos.resourcemanager.tasks.bootstrap-cmd` | (none) | 在TaskManager启动之前执行的命令. | +| `mesos.resourcemanager.tasks.container.docker.force-pull-image` | false | 指示docker containerizer强制拉动镜像,而不是重用缓存版本. | +| `mesos.resourcemanager.tasks.container.docker.parameters` | (none) | 使用docker容器时,要传递给docker run命令的自定义参数.逗号分隔的“key = value”对列表.“值”可能包含“=”. | +| `mesos.resourcemanager.tasks.container.image.name` | (none) | 用于容器的映像名称. | +| `mesos.resourcemanager.tasks.container.type` | “mesos” | 使用的集装箱类型:“mesos”或“docker”. | +| `mesos.resourcemanager.tasks.container.volumes` | (none) | 逗号分隔的[host_path:] container_path [:RO | RW]列表.这允许将额外的卷安装到容器中. | +| `mesos.resourcemanager.tasks.cpus` | 0.0 | 要分配给Mesos工作者的CPU. | +| `mesos.resourcemanager.tasks.gpus` | 0 | 要分配给Mesos工作者的GPU. | +| `mesos.resourcemanager.tasks.hostname` | (none) | 用于定义TaskManager主机名的可选值.模式_TASK_由Mesos任务的实际ID替换.这可用于配置TaskManager以使用Mesos DNS(例如_TASK_.flink-service.mesos)进行名称查找. | +| `mesos.resourcemanager.tasks.mem` | 1024 | 要以MB为单位分配给Mesos worker的内存. | +| `mesos.resourcemanager.tasks.taskmanager-cmd` | "$FLINK_HOME/bin/mesos-taskmanager.sh" | | +| `mesos.resourcemanager.tasks.uris` | (none) | 以逗号分隔的自定义工件URI列表,这些URI将下载到Mesos工作者的沙箱中. | +| `taskmanager.numberOfTaskSlots` | 1 | 单个TaskManager可以运行的并行算子或用户函数实例的数量.如果此值大于1,则单个TaskManager将获取函数或 算子的多个实例.这样,TaskManager可以使用多个CPU内核,但同时,可用内存在不同的算子或函数实例之间划分.此值通常与TaskManager的计算机具有的物理CPU核心数成比例(例如,等于核心数,或核心数的一半). | ### 高可用性(HA) | 键 | 默认 | 描述 | | --- | --- | --- | -| - -##### high-availability - - | “NONE” | 定义用于群集执行的高可用性模式.要启用高可用性,请将此模式设置为“ZOOKEEPER”. | -| - -##### high-availability.cluster-id - - | “/default” | Flink集群的ID,用于将多个Flink集群彼此分开.需要为独立群集设置,但在YARN和Mesos中自动推断. | -| - -##### high-availability.job.delay - - | (none) | 故障转移后JobManager之前的时间恢复当前作业. | -| - -##### high-availability.jobmanager.port - - | “0” | JobManager在高可用性模式下使用的可选端口(范围). | -| - -##### high-availability.storageDir - - | (none) | 文件系统路径(URI)Flink在高可用性设置中持久保存元数据. | +| `high-availability` | “NONE” | 定义用于群集执行的高可用性模式.要启用高可用性,请将此模式设置为“ZOOKEEPER”. | +| `high-availability.cluster-id` | “/default” | Flink集群的ID,用于将多个Flink集群彼此分开.需要为独立群集设置,但在YARN和Mesos中自动推断. | +| `high-availability.job.delay` | (none) | 故障转移后JobManager之前的时间恢复当前作业. | +| `high-availability.jobmanager.port` | “0” | JobManager在高可用性模式下使用的可选端口(范围). | +| `high-availability.storageDir` | (none) | 文件系统路径(URI)Flink在高可用性设置中持久保存元数据. | #### 基于ZooKeeper的HA模式 | 键 | 默认 | 描述 | | --- | --- | --- | -| - -##### high-availability.zookeeper.client.acl - - | “open” | 定义要在ZK节点上配置的ACL(open | creator).如果ZooKeeper服务器配置将“authProvider”属性映射为使用SASLAuthenticationProvider并且群集配置为以安全模式(Kerberos)运行,则可以将配置值设置为“creator”. | -| - -##### high-availability.zookeeper.client.connection-timeout - - | 15000 | 定义ZooKeeper的连接超时(以ms为单位). | -| - -##### high-availability.zookeeper.client.max-retry-attempts - - | 3 | 定义客户端放弃之前的连接重试次数. | -| - -##### high-availability.zookeeper.client.retry-wait - - | 5000 | 定义以ms为单位的连续重试之间的暂停. | -| - -##### high-availability.zookeeper.client.session-timeout - - | 60000 | 以ms为单位定义ZooKeeper会话的会话超时. | -| - -##### high-availability.zookeeper.path.checkpoint-counter - - | “/checkpoint-counter” | ZooKeeper根路径(ZNode)用于检查点计数器. | -| - -##### high-availability.zookeeper.path.checkpoints - - | “/checkpoints” | 已完成检查点的ZooKeeper根路径(ZNode). | -| - -##### high-availability.zookeeper.path.jobgraphs - - | “/jobgraphs” | 作业图的ZooKeeper根路径(ZNode) | -| - -##### high-availability.zookeeper.path.latch - - | “/leaderlatch” | 定义用于选择Leader的Leader锁存器的znode. | -| - -##### high-availability.zookeeper.path.leader - - | “/leader” | 定义Leader的znode,其中包含Leader的URL和当前Leader会话ID. | -| - -##### high-availability.zookeeper.path.mesos工 - - | “/mesos-workers” | ZooKeeper根路径,用于保存Mesos工作者信息. | -| - -##### high-availability.zookeeper.path.root - - | “/flink” | Flink在ZooKeeper中存储其条目的根路径. | -| - -##### high-availability.zookeeper.path.running的注册表 - - | “/running_job_registry/” | | -| - -##### high-availability.zookeeper.quorum - - | (none) | 使用ZooKeeper在高可用性模式下运行Flink时要使用的ZooKeeper quorum. | +| `high-availability.zookeeper.client.acl` | “open” | 定义要在ZK节点上配置的ACL(open | creator).如果ZooKeeper服务器配置将“authProvider”属性映射为使用SASLAuthenticationProvider并且群集配置为以安全模式(Kerberos)运行,则可以将配置值设置为“creator”. | +| `high-availability.zookeeper.client.connection-timeout` | 15000 | 定义ZooKeeper的连接超时(以ms为单位). | +| `high-availability.zookeeper.client.max-retry-attempts` | 3 | 定义客户端放弃之前的连接重试次数. | +| `high-availability.zookeeper.client.retry-wait` | 5000 | 定义以ms为单位的连续重试之间的暂停. | +| `high-availability.zookeeper.client.session-timeout` | 60000 | 以ms为单位定义ZooKeeper会话的会话超时. | +| `high-availability.zookeeper.path.checkpoint-counter` | “/checkpoint-counter” | ZooKeeper根路径(ZNode)用于检查点计数器. | +| `high-availability.zookeeper.path.checkpoints` | “/checkpoints” | 已完成检查点的ZooKeeper根路径(ZNode). | +| `high-availability.zookeeper.path.jobgraphs` | “/jobgraphs” | 作业图的ZooKeeper根路径(ZNode) | +| `high-availability.zookeeper.path.latch` | “/leaderlatch” | 定义用于选择Leader的Leader锁存器的znode. | +| `high-availability.zookeeper.path.leader` | “/leader” | 定义Leader的znode,其中包含Leader的URL和当前Leader会话ID. | +| `high-availability.zookeeper.path.mesos工` | “/mesos-workers” | ZooKeeper根路径,用于保存Mesos工作者信息. | +| `high-availability.zookeeper.path.root` | “/flink” | Flink在ZooKeeper中存储其条目的根路径. | +| `high-availability.zookeeper.path.running的注册表` | “/running_job_registry/” | | +| `high-availability.zookeeper.quorum` | (none) | 使用ZooKeeper在高可用性模式下运行Flink时要使用的ZooKeeper quorum. | ### ZooKeeper安全 | 键 | 默认 | 描述 | | --- | --- | --- | -| - -##### zookeeper.sasl.disable - - | false | | -| - -##### zookeeper.sasl.login-context-name - - | “Client” | | -| - -##### zookeeper.sasl.service-name - - | “zookeeper” | | +| `zookeeper.sasl.disable` | false | | +| `zookeeper.sasl.login-context-name` | “Client” | | +| `zookeeper.sasl.service-name` | “zookeeper” | | ### 基于Kerberos的安全性 | 键 | 默认 | 描述 | | --- | --- | --- | -| - -##### security.kerberos.login.contexts - - | (none) | 以逗号分隔的登录上下文列表,用于提供Kerberos凭据(例如,`Client,KafkaClient`使用凭证进行ZooKeeper身份验证和Kafka身份验证) | -| - -##### security.kerberos.login.keytab - - | (none) | 包含用户凭据的KerberosKeys表文件的绝对路径. | -| - -##### security.kerberos.login.principal - - | (none) | 与keytab关联的Kerberos主体名称. | -| - -##### security.kerberos.login.use-ticket-cache - - | true | 指示是否从Kerberos票证缓存中读取. | +| `security.kerberos.login.contexts` | (none) | 以逗号分隔的登录上下文列表,用于提供Kerberos凭据(例如,`Client,KafkaClient`使用凭证进行ZooKeeper身份验证和Kafka身份验证) | +| `security.kerberos.login.keytab` | (none) | 包含用户凭据的KerberosKeys表文件的绝对路径. | +| `security.kerberos.login.principal` | (none) | 与keytab关联的Kerberos主体名称. | +| `security.kerberos.login.use-ticket-cache` | true | 指示是否从Kerberos票证缓存中读取. | ### 环境 | 键 | 默认 | 描述 | | --- | --- | --- | -| - -##### env.hadoop.conf.dir - - | (none) | hadoop配置目录的路径.需要读取HDFS和/或YARN配置.您也可以通过环境变量进行设置. | -| - -##### env.java.opts - - | (none) | | -| - -##### env.java.opts.jobmanager - - | (none) | | -| - -##### env.java.opts.taskmanager - - | (none) | | -| - -##### env.log.dir - - | (none) | 定义保存Flink日志的目录.它必须是一条绝对的道路.(默认为Flink主页下的日志目录) | -| - -##### env.log.max - - | 5 | 要保存的最大旧日志文件数. | -| - -##### env.ssh.opts - - | (none) | 启动或停止JobManager,TaskManager和Zookeeper服务时,其他命令行选项传递给SSH客户端(start-cluster.sh,stop-cluster.sh,start-zookeeper-quorum.sh,stop-zookeeper-quorum.sh). | -| - -##### env.yarn.conf.dir - - | (none) | YARN配置目录的路径.它需要在YARN上运行flink.您也可以通过环境变量进行设置. | +| `env.hadoop.conf.dir` | (none) | hadoop配置目录的路径.需要读取HDFS和/或YARN配置.您也可以通过环境变量进行设置. | +| `env.java.opts` | (none) | | +| `env.java.opts.jobmanager` | (none) | | +| `env.java.opts.taskmanager` | (none) | | +| `env.log.dir` | (none) | 定义保存Flink日志的目录.它必须是一条绝对的道路.(默认为Flink主页下的日志目录) | +| `env.log.max` | 5 | 要保存的最大旧日志文件数. | +| `env.ssh.opts` | (none) | 启动或停止JobManager,TaskManager和Zookeeper服务时,其他命令行选项传递给SSH客户端(start-cluster.sh,stop-cluster.sh,start-zookeeper-quorum.sh,stop-zookeeper-quorum.sh). | +| `env.yarn.conf.dir` | (none) | YARN配置目录的路径.它需要在YARN上运行flink.您也可以通过环境变量进行设置. | ### 检查点 | 键 | 默认 | 描述 | | --- | --- | --- | -| - -##### state.backend - - | (none) | 状态后台用于存储和检查点状态. | -| - -##### state.backend.async - - | true | 选择状态后台是否应在可能和可配置的情况下使用异步SNAPSHOT方法.某些状态后台可能不支持异步SNAPSHOT,或者仅支持异步SNAPSHOT,并忽略此选项. | -| - -##### state.backend.fs.memory-threshold - - | 1024 | 状态数据文件的最小大小.小于该值的所有状态块都内联存储在根检查点元数据文件中. | -| - -##### state.backend.incremental - - | false | 如果可能,选择状态后台是否应创建增量检查点.对于增量检查点,仅存储来自先前检查点的差异,而不是完整的检查点状态.某些状态后台可能不支持增量检查点并忽略此选项. | -| - -##### state.backend.local-recovery - - | false | | -| - -##### state.checkpoints.dir - - | (none) | 用于在Flink支持的文件系统中存储检查点的数据文件和元数据的默认目录.必须可以从所有参与的进程/节点(即所有TaskManagers和JobManagers)访问存储路径. | -| - -##### state.checkpoints.num-retained - - | 1 | 要保存的已完成检查点的最大数量. | -| - -##### state.savepoints.dir - - | (none) | 保存点的默认目录.由将后台写入文件系统的状态后台(MemoryStateBackend,FsStateBackend,RocksDBStateBackend)使用. | -| - -##### taskmanager.state.local.root-dirs - - | (none) | | +| `state.backend` | (none) | 状态后台用于存储和检查点状态. | +| `state.backend.async` | true | 选择状态后台是否应在可能和可配置的情况下使用异步SNAPSHOT方法.某些状态后台可能不支持异步SNAPSHOT,或者仅支持异步SNAPSHOT,并忽略此选项. | +| `state.backend.fs.memory-threshold` | 1024 | 状态数据文件的最小大小.小于该值的所有状态块都内联存储在根检查点元数据文件中. | +| `state.backend.incremental` | false | 如果可能,选择状态后台是否应创建增量检查点.对于增量检查点,仅存储来自先前检查点的差异,而不是完整的检查点状态.某些状态后台可能不支持增量检查点并忽略此选项. | +| `state.backend.local-recovery` | false | | +| `state.checkpoints.dir` | (none) | 用于在Flink支持的文件系统中存储检查点的数据文件和元数据的默认目录.必须可以从所有参与的进程/节点(即所有TaskManagers和JobManagers)访问存储路径. | +| `state.checkpoints.num-retained` | 1 | 要保存的已完成检查点的最大数量. | +| `state.savepoints.dir` | (none) | 保存点的默认目录.由将后台写入文件系统的状态后台(MemoryStateBackend,FsStateBackend,RocksDBStateBackend)使用. | +| `taskmanager.state.local.root-dirs` | (none) | | ### 可查询状态 | 键 | 默认 | 描述 | | --- | --- | --- | -| - -##### query.client.network-threads - - | 0 | 网络数(Netty的事件循环)可查询状态客户端的线程. | -| - -##### query.proxy.network-threads - - | 0 | 网络数(Netty的事件循环)可查询状态代理的线程. | -| - -##### query.proxy.ports - - | “9069” | 可查询状态代理的端口范围.指定范围可以是单个端口:“9123”,一系列端口:“50100-50200”,或范围和端口列表:“50100-50200,50300-50400,51234”. | -| - -##### query.proxy.query-threads - - | 0 | 可查询状态代理的查询线程数.如果设置为0,则使用插槽数. | -| - -##### query.server.network-threads - - | 0 | 网络数(Netty的事件循环)可查询状态服务器的线程. | -| - -##### query.server.ports - - | “9067” | 可查询状态服务器的端口范围.指定范围可以是单个端口:“9123”,一系列端口:“50100-50200”,或范围和端口列表:“50100-50200,50300-50400,51234”. | -| - -##### query.server.query-threads - - | 0 | 可查询状态服务器的查询线程数.如果设置为0,则使用插槽数. | +| `query.client.network-threads` | 0 | 网络数(Netty的事件循环)可查询状态客户端的线程. | +| `query.proxy.network-threads` | 0 | 网络数(Netty的事件循环)可查询状态代理的线程. | +| `query.proxy.ports` | “9069” | 可查询状态代理的端口范围.指定范围可以是单个端口:“9123”,一系列端口:“50100-50200”,或范围和端口列表:“50100-50200,50300-50400,51234”. | +| `query.proxy.query-threads` | 0 | 可查询状态代理的查询线程数.如果设置为0,则使用插槽数. | +| `query.server.network-threads` | 0 | 网络数(Netty的事件循环)可查询状态服务器的线程. | +| `query.server.ports` | “9067” | 可查询状态服务器的端口范围.指定范围可以是单个端口:“9123”,一系列端口:“50100-50200”,或范围和端口列表:“50100-50200,50300-50400,51234”. | +| `query.server.query-threads` | 0 | 可查询状态服务器的查询线程数.如果设置为0,则使用插槽数. | ### 度量 | 键 | 默认 | 描述 | | --- | --- | --- | -| - -##### metrics.latency.granularity - - | “operator” | 定义延迟指标的粒度.可接受的值是: - -* 单一 - 跟踪延迟,无需区分源和子任务. -* operator - 跟踪延迟,同时区分源,但不区分子任务. -* 子任务 - 在区分源和子任务时跟踪延迟. - - | -| - -##### metrics.latency.history-size - - | 128 | 定义每个算子维护的测量延迟数. | -| - -##### metrics.latency.interval - - | 0 | 定义从源发出延迟跟踪标记的间隔.如果设置为0或负值,则禁用延迟跟踪.启用此函数会显着影响群集的性能. | -| - -##### metrics.reporter.<name> .<parameter> - - | (none) | 为名为<name>的报告器配置参数<parameter>. | -| - -##### metrics.reporter.<name>.class - - | (none) | 报告类用于为报告命名<name>. | -| - -##### metrics.reporter.<name>.interval - - | (none) | 报告间隔用于报告名为<name>. | -| - -##### metrics.reporters - - | (none) | | -| - -##### metrics.scope.delimiter - - | “” | | -| - -##### metrics.scope.jm - - | “<host> .jobmanager” | 定义应用于作用于JobManager的所有度量标准的范围格式字符串. | -| - -##### metrics.scope.jm.job - - | “<host> .jobmanager.<job_name>” | 定义范围格式字符串,该字符串应用于作用于JobManager上作业的所有度量标准. | -| - -##### metrics.scope.operator - - | “<host> .taskmanager.<tm_id> <job_name> <operator_name> <subtask_index>” | 定义应用于作用于 算子的所有度量标准的范围格式字符串. | -| - -##### metrics.scope.task - - | “<host> .taskmanager.<tm_id> <job_name> <task_name> <subtask_index>” | 定义应用于作用于任务的所有度量标准的范围格式字符串. | -| - -##### metrics.scope.tm - - | “<host> .taskmanager.<tm_id>” | 定义应用于作用于TaskManager的所有度量标准的范围格式字符串. | -| - -##### metrics.scope.tm.job - - | “<host> .taskmanager.<tm_id> <job_name>” | 定义范围格式字符串,该字符串应用于作用于TaskManager上作业的所有度量标准. | -| - -##### metrics.system-resource - - | false | | -| - -##### metrics.system-resource-probing-interval - - | 5000 | | +| `metrics.latency.granularity` | “operator” | 定义延迟指标的粒度.可接受的值是: | +| | | 单一 - 跟踪延迟,无需区分源和子任务. | +| | | operator - 跟踪延迟,同时区分源,但不区分子任务. | +| | | 子任务 - 在区分源和子任务时跟踪延迟. | +| `metrics.latency.history-size` | 128 | 定义每个算子维护的测量延迟数. | +| `metrics.latency.interval` | 0 | 定义从源发出延迟跟踪标记的间隔.如果设置为0或负值,则禁用延迟跟踪.启用此函数会显着影响群集的性能. | +| `metrics.reporter.<name> .<parameter>` | (none) | 为名为<name>的报告器配置参数<parameter>. | +| `metrics.reporter.<name>.class` | (none) | 报告类用于为报告命名<name>. | +| `metrics.reporter.<name>.interval` | (none) | 报告间隔用于报告名为<name>. | +| `metrics.reporters` | (none) | | +| `metrics.scope.delimiter` | “” | | +| `metrics.scope.jm` | “<host> .jobmanager” | 定义应用于作用于JobManager的所有度量标准的范围格式字符串. | +| `metrics.scope.jm.job` | “<host> .jobmanager.<job_name>” | 定义范围格式字符串,该字符串应用于作用于JobManager上作业的所有度量标准. | +| `metrics.scope.operator` | “<host> .taskmanager.<tm_id> <job_name> <operator_name> <subtask_index>” | 定义应用于作用于 算子的所有度量标准的范围格式字符串. | +| `metrics.scope.task` | “<host> .taskmanager.<tm_id> <job_name> <task_name> <subtask_index>” | 定义应用于作用于任务的所有度量标准的范围格式字符串. | +| `metrics.scope.tm` | “<host> .taskmanager.<tm_id>” | 定义应用于作用于TaskManager的所有度量标准的范围格式字符串. | +| `metrics.scope.tm.job` | “<host> .taskmanager.<tm_id> <job_name>” | 定义范围格式字符串,该字符串应用于作用于TaskManager上作业的所有度量标准. | +| `metrics.system-resource` | false | | +| `metrics.system-resource-probing-interval` | 5000 | | ### 历史服务器 @@ -1507,41 +446,13 @@ TaskManagers的配置文件可能不同,Flink不承担集群中的统一机器 | 键 | 默认 | 描述 | | --- | --- | --- | -| - -##### historyserver.archive.fs.dir - - | (none) | 以逗号分隔的目录列表,用于从中获取已归档的作业.历史服务器将监视这些目录以获取已存档的作业.您可以将JobManager配置为通过`jobmanager.archive.fs.dir`将作业存档到目录. | -| - -##### historyserver.archive.fs.refresh-interval - - | 10000 | 刷新已归档作业目录的时间间隔(以ms为单位). | -| - -##### historyserver.web.address - - | (none) | HistoryServer的Web界面的地址. | -| - -##### historyserver.web.port - - | 8082 | HistoryServers的Web界面的端口. | -| - -##### historyserver.web.refresh-interval - - | 10000 | | -| - -##### historyserver.web.ssl.enabled - - | false | 启用对HistoryServer Web前端的HTTP访问.仅当全局SSL标志security.ssl.enabled设置为true时,此选项才适用. | -| - -##### historyserver.web.tmpdir - - | (none) | 此配置参数允许定义历史服务器Web界面使用的Flink Web目录.Web界面将其静态文件复制到目录中. | +| `historyserver.archive.fs.dir` | (none) | 以逗号分隔的目录列表,用于从中获取已归档的作业.历史服务器将监视这些目录以获取已存档的作业.您可以将JobManager配置为通过`jobmanager.archive.fs.dir`将作业存档到目录. | +| `historyserver.archive.fs.refresh-interval` | 10000 | 刷新已归档作业目录的时间间隔(以ms为单位). | +| `historyserver.web.address` | (none) | HistoryServer的Web界面的地址. | +| `historyserver.web.port` | 8082 | HistoryServers的Web界面的端口. | +| `historyserver.web.refresh-interval` | 10000 | | +| `historyserver.web.ssl.enabled` | false | 启用对HistoryServer Web前端的HTTP访问.仅当全局SSL标志security.ssl.enabled设置为true时,此选项才适用. | +| `historyserver.web.tmpdir` | (none) | 此配置参数允许定义历史服务器Web界面使用的Flink Web目录.Web界面将其静态文件复制到目录中. | ## 留存 diff --git a/docs/1.7-SNAPSHOT/120.md b/docs/1.7-SNAPSHOT/120.md index 9d9e73072c1fbc017edcb516b36e27566de98050..4eb88fcce0b9e2d65f742fccba0b657461440478 100644 --- a/docs/1.7-SNAPSHOT/120.md +++ b/docs/1.7-SNAPSHOT/120.md @@ -687,31 +687,11 @@ Flink度量标准类型映射到Prometheus度量标准类型,如下所示: | 键 | 默认 | 描述 | | --- | --- | --- | -| - -##### deleteOnShutdown - - | true | 指定是否在关闭时从PushGateway中删除指标。 | -| - -##### Host - - | (none) | PushGateway服务器主机。 | -| - -##### jobName - - | (none) | 将推送指标的作业名称 | -| - -##### port - - | -1 | PushGateway服务器端口。 | -| - -##### randomJobNameSuffix - - | true | 指定是否应将随机后缀附加到作业名称。 | +| `deleteOnShutdown` | true | 指定是否在关闭时从PushGateway中删除指标。 | +| `Host` | (none) | PushGateway服务器主机。 | +| `jobName` | (none) | 将推送指标的作业名称 | +| `port` | -1 | PushGateway服务器端口。 | +| `randomJobNameSuffix` | true | 指定是否应将随机后缀附加到作业名称。 | 配置示例: diff --git a/docs/1.7-SNAPSHOT/62.md b/docs/1.7-SNAPSHOT/62.md index 28b2abd221f990a83b94ef3759c6a8883f1498de..83ff3f80a272ea8fdc4fdbcda5dfee63995341ea 100644 --- a/docs/1.7-SNAPSHOT/62.md +++ b/docs/1.7-SNAPSHOT/62.md @@ -19,5067 +19,686 @@ Flink Table API和SQL为用户提供了一组用于数据转换的内置函数 | 比较函数 | 描述 | | --- | --- | -| - -<figure class="highlight"> - -``` -value1 = value2 -``` - -</figure> - - | 如果_value1_等于_value2_,则返回TRUE ; 如果_value1_或_value2_为NULL,则返回UNKNOWN 。 | -| - -<figure class="highlight"> - -``` -value1 <> value2 -``` - -</figure> - - | 如果_value1_不等于_value2_,则返回TRUE ; 如果_value1_或_value2_为NULL,则返回UNKNOWN 。 | -| - -<figure class="highlight"> - -``` -value1 > value2 -``` - -</figure> - - | 如果_value1_大于_value2_,则返回TRUE ; 如果_value1_或_value2_为NULL,则返回UNKNOWN 。 | -| - -<figure class="highlight"> - -``` -value1 >= value2 -``` - -</figure> - - | 如果_value1_大于或等于_value2_,则返回TRUE ; 如果_value1_或_value2_为NULL,则返回UNKNOWN 。 | -| - -<figure class="highlight"> - -``` -value1 < value2 -``` - -</figure> - - | 如果_value1_小于_value2_,则返回TRUE ; 如果_value1_或_value2_为NULL,则返回UNKNOWN 。 | -| - -<figure class="highlight"> - -``` -value1 <= value2 -``` - -</figure> - - | 如果_value1_小于或等于_value2_,则返回TRUE ; 如果_value1_或_value2_为NULL,则返回UNKNOWN 。 | -| - -<figure class="highlight"> - -``` -value IS NULL -``` - -</figure> - - | 如果_value_为NULL,则返回TRUE 。 | -| - -<figure class="highlight"> - -``` -value IS NOT NULL -``` - -</figure> - - | 如果_value_不为NULL,则返回TRUE 。 | -| - -<figure class="highlight"> - -``` -value1 IS DISTINCT FROM value2 -``` - -</figure> - - | 如果两个值不相等,则返回TRUE。NULL值在此处视为相同。例如,`1 IS DISTINCT FROM NULL`返回TRUE; `NULL IS DISTINCT FROM NULL`返回FALSE。 | -| - -<figure class="highlight"> - -``` -value1 IS NOT DISTINCT FROM value2 -``` - -</figure> - - | 如果两个值相等,则返回TRUE。NULL值在此处视为相同。例如,`1 IS NOT DISTINCT FROM NULL`返回FALSE; `NULL IS NOT DISTINCT FROM NULL`返回TRUE。 | -| - -<figure class="highlight"> - -``` -value1 BETWEEN [ ASYMMETRIC | SYMMETRIC ] value2 AND value3 -``` - -</figure> - - | 默认情况下(或使用ASYMMETRIC关键字),如果_value1_大于或等于_value2_且小于或等于_value3_,则返回TRUE 。使用SYMMETRIC关键字,如果_value1_包含在_value2_和_value3_之间,则返回TRUE 。当_value2_或_value3_为NULL时,返回FALSE或UNKNOWN。例如,`12 BETWEEN 15 AND 12`返回FALSE; `12 BETWEEN SYMMETRIC 15 AND 12`返回TRUE; `12 BETWEEN 10 AND NULL`返回UNKNOWN; `12 BETWEEN NULL AND 10`返回FALSE; `12 BETWEEN SYMMETRIC NULL AND 12`返回UNKNOWN。 | -| - -<figure class="highlight"> - -``` -value1 NOT BETWEEN [ ASYMMETRIC | SYMMETRIC ] value2 AND value3 -``` - -</figure> - - | 默认情况下(或使用ASYMMETRIC关键字),如果_value1_小于_value2_或大于_value3_,则返回TRUE 。使用SYMMETRIC关键字,如果_value1_不包含在_value2_和_value3_之间,则返回TRUE 。当_value2_或_value3_为NULL时,返回TRUE或UNKNOWN。例如,`12 NOT BETWEEN 15 AND 12`返回TRUE; `12 NOT BETWEEN SYMMETRIC 15 AND 12`返回FALSE; `12 NOT BETWEEN NULL AND 15`返回UNKNOWN; `12 NOT BETWEEN 15 AND NULL`返回TRUE; `12 NOT BETWEEN SYMMETRIC 12 AND NULL`返回UNKNOWN。 | -| - -<figure class="highlight"> - -``` -string1 LIKE string2 [ ESCAPE char ] -``` - -</figure> - - | 如果_string1_匹配模式_string2_,则返回TRUE ; 如果_string1_或_string2_为NULL,则返回UNKNOWN 。如有必要,可以定义转义字符。**注意:**尚未支持转义字符。 | -| - -<figure class="highlight"> - -``` -string1 NOT LIKE string2 [ ESCAPE char ] -``` - -</figure> - - | 如果_string1_与模式_string2_不匹配,则返回TRUE ; 如果_string1_或_string2_为NULL,则返回UNKNOWN 。如有必要,可以定义转义字符。**注意:**尚未支持转义字符。 | -| - -<figure class="highlight"> - -``` -string1 SIMILAR TO string2 [ ESCAPE char ] -``` - -</figure> - - | 如果_string1_匹配SQL正则表达式_string2_,则返回TRUE ; 如果_string1_或_string2_为NULL,则返回UNKNOWN 。如有必要,可以定义转义字符。**注意:**尚未支持转义字符。 | -| - -<figure class="highlight"> - -``` -string1 NOT SIMILAR TO string2 [ ESCAPE char ] -``` - -</figure> - - | 如果_string1_与SQL正则表达式_string2_不匹配,则返回TRUE ; 如果_string1_或_string2_为NULL,则返回UNKNOWN 。如有必要,可以定义转义字符。**注意:**尚未支持转义字符。 | -| - -<figure class="highlight"> - -``` -value1 IN (value2 [, value3]* ) -``` - -</figure> - - | 如果给定列表中存在_value1_ _(value2,value3,...),_则返回TRUE 。当_(value2,value3,...)_。包含NULL,如果可以找到该数据元则返回TRUE,否则返回UNKNOWN。如果_value1_为NULL,则始终返回UNKNOWN 。例如,`4 IN (1, 2, 3)`返回FALSE; `1 IN (1, 2, NULL)`返回TRUE; `4 IN (1, 2, NULL)`返回UNKNOWN。 | -| - -<figure class="highlight"> - -``` -value1 NOT IN (value2 [, value3]* ) -``` - -</figure> - - | 如果给定列表中不存在_value1_ _(value2,value3,...),_则返回TRUE 。当_(value2,value3,...)_。包含NULL,如果可以找到_value1_则返回FALSE ,否则返回UNKNOWN。如果_value1_为NULL,则始终返回UNKNOWN 。例如,`4 NOT IN (1, 2, 3)`返回TRUE; `1 NOT IN (1, 2, NULL)`返回FALSE; `4 NOT IN (1, 2, NULL)`返回UNKNOWN。 | -| - -<figure class="highlight"> - -``` -EXISTS (sub-query) -``` - -</figure> - - | 如果_子查询_返回至少一行,则返回TRUE 。仅在可以在连接和组 算子操作中重写 算子操作时才支持。**注意:**对于流式查询, 算子操作将在连接和组 算子操作中重写。计算查询结果所需的状态可能会无限增长,具体取决于不同输入行的数量。请提供具有有效保存间隔的查询配置,以防止过大的状态。有关详细信息,请参阅[Streaming Concepts](streaming.html)。 | -| - -<figure class="highlight"> - -``` -value IN (sub-query) -``` - -</figure> - - | 如果_value_等于子查询返回的行,则返回TRUE 。**注意:**对于流式查询, 算子操作将在连接和组 算子操作中重写。计算查询结果所需的状态可能会无限增长,具体取决于不同输入行的数量。请提供具有有效保存间隔的查询配置,以防止过大的状态。有关详细信息,请参阅[Streaming Concepts](streaming.html)。 | -| - -<figure class="highlight"> - -``` -value NOT IN (sub-query) -``` - -</figure> - - | 如果_value_不等于_子查询_返回的每一行,则返回TRUE 。**注意:**对于流式查询, 算子操作将在连接和组 算子操作中重写。计算查询结果所需的状态可能会无限增长,具体取决于不同输入行的数量。请提供具有有效保存间隔的查询配置,以防止过大的状态。有关详细信息,请参阅[Streaming Concepts](streaming.html)。 | +| `value1 = value2` | 如果_value1_等于_value2_,则返回TRUE ; 如果_value1_或_value2_为NULL,则返回UNKNOWN 。 | +| `value1 <> value2` | 如果_value1_不等于_value2_,则返回TRUE ; 如果_value1_或_value2_为NULL,则返回UNKNOWN 。 | +| `value1 > value2` | 如果_value1_大于_value2_,则返回TRUE ; 如果_value1_或_value2_为NULL,则返回UNKNOWN 。 | +| `value1 >= value2` | 如果_value1_大于或等于_value2_,则返回TRUE ; 如果_value1_或_value2_为NULL,则返回UNKNOWN 。 | +| `value1 < value2` | 如果_value1_小于_value2_,则返回TRUE ; 如果_value1_或_value2_为NULL,则返回UNKNOWN 。 | +| `value1 <= value2` | 如果_value1_小于或等于_value2_,则返回TRUE ; 如果_value1_或_value2_为NULL,则返回UNKNOWN 。 | +| `value IS NULL` | 如果_value_为NULL,则返回TRUE 。 | +| `value IS NOT NULL` | 如果_value_不为NULL,则返回TRUE 。 | +| `value1 IS DISTINCT FROM value2` | 如果两个值不相等,则返回TRUE。NULL值在此处视为相同。例如,`1 IS DISTINCT FROM NULL`返回TRUE; `NULL IS DISTINCT FROM NULL`返回FALSE。 | +| `value1 IS NOT DISTINCT FROM value2` | 如果两个值相等,则返回TRUE。NULL值在此处视为相同。例如,`1 IS NOT DISTINCT FROM NULL`返回FALSE; `NULL IS NOT DISTINCT FROM NULL`返回TRUE。 | +| `value1 BETWEEN [ ASYMMETRIC | SYMMETRIC ] value2 AND value3` | 默认情况下(或使用ASYMMETRIC关键字),如果_value1_大于或等于_value2_且小于或等于_value3_,则返回TRUE 。使用SYMMETRIC关键字,如果_value1_包含在_value2_和_value3_之间,则返回TRUE 。当_value2_或_value3_为NULL时,返回FALSE或UNKNOWN。例如,`12 BETWEEN 15 AND 12`返回FALSE; `12 BETWEEN SYMMETRIC 15 AND 12`返回TRUE; `12 BETWEEN 10 AND NULL`返回UNKNOWN; `12 BETWEEN NULL AND 10`返回FALSE; `12 BETWEEN SYMMETRIC NULL AND 12`返回UNKNOWN。 | +| `value1 NOT BETWEEN [ ASYMMETRIC | SYMMETRIC ] value2 AND value3` | 默认情况下(或使用ASYMMETRIC关键字),如果_value1_小于_value2_或大于_value3_,则返回TRUE 。使用SYMMETRIC关键字,如果_value1_不包含在_value2_和_value3_之间,则返回TRUE 。当_value2_或_value3_为NULL时,返回TRUE或UNKNOWN。例如,`12 NOT BETWEEN 15 AND 12`返回TRUE; `12 NOT BETWEEN SYMMETRIC 15 AND 12`返回FALSE; `12 NOT BETWEEN NULL AND 15`返回UNKNOWN; `12 NOT BETWEEN 15 AND NULL`返回TRUE; `12 NOT BETWEEN SYMMETRIC 12 AND NULL`返回UNKNOWN。 | +| `string1 LIKE string2 [ ESCAPE char ]` | 如果_string1_匹配模式_string2_,则返回TRUE ; 如果_string1_或_string2_为NULL,则返回UNKNOWN 。如有必要,可以定义转义字符。**注意:**尚未支持转义字符。 | +| `string1 NOT LIKE string2 [ ESCAPE char ]` | 如果_string1_与模式_string2_不匹配,则返回TRUE ; 如果_string1_或_string2_为NULL,则返回UNKNOWN 。如有必要,可以定义转义字符。**注意:**尚未支持转义字符。 | +| `string1 SIMILAR TO string2 [ ESCAPE char ]` | 如果_string1_匹配SQL正则表达式_string2_,则返回TRUE ; 如果_string1_或_string2_为NULL,则返回UNKNOWN 。如有必要,可以定义转义字符。**注意:**尚未支持转义字符。 | +| `string1 NOT SIMILAR TO string2 [ ESCAPE char ]` | 如果_string1_与SQL正则表达式_string2_不匹配,则返回TRUE ; 如果_string1_或_string2_为NULL,则返回UNKNOWN 。如有必要,可以定义转义字符。**注意:**尚未支持转义字符。 | +| `value1 IN (value2 [, value3]* )` | 如果给定列表中存在_value1_ _(value2,value3,...),_则返回TRUE 。当_(value2,value3,...)_。包含NULL,如果可以找到该数据元则返回TRUE,否则返回UNKNOWN。如果_value1_为NULL,则始终返回UNKNOWN 。例如,`4 IN (1, 2, 3)`返回FALSE; `1 IN (1, 2, NULL)`返回TRUE; `4 IN (1, 2, NULL)`返回UNKNOWN。 | +| `value1 NOT IN (value2 [, value3]* )` | 如果给定列表中不存在_value1_ _(value2,value3,...),_则返回TRUE 。当_(value2,value3,...)_。包含NULL,如果可以找到_value1_则返回FALSE ,否则返回UNKNOWN。如果_value1_为NULL,则始终返回UNKNOWN 。例如,`4 NOT IN (1, 2, 3)`返回TRUE; `1 NOT IN (1, 2, NULL)`返回FALSE; `4 NOT IN (1, 2, NULL)`返回UNKNOWN。 | +| `EXISTS (sub-query)` | 如果_子查询_返回至少一行,则返回TRUE 。仅在可以在连接和组 算子操作中重写 算子操作时才支持。**注意:**对于流式查询, 算子操作将在连接和组 算子操作中重写。计算查询结果所需的状态可能会无限增长,具体取决于不同输入行的数量。请提供具有有效保存间隔的查询配置,以防止过大的状态。有关详细信息,请参阅[Streaming Concepts](streaming.html)。 | +| `value IN (sub-query)` | 如果_value_等于子查询返回的行,则返回TRUE 。**注意:**对于流式查询, 算子操作将在连接和组 算子操作中重写。计算查询结果所需的状态可能会无限增长,具体取决于不同输入行的数量。请提供具有有效保存间隔的查询配置,以防止过大的状态。有关详细信息,请参阅[Streaming Concepts](streaming.html)。 | +| `value NOT IN (sub-query)` | 如果_value_不等于_子查询_返回的每一行,则返回TRUE 。**注意:**对于流式查询, 算子操作将在连接和组 算子操作中重写。计算查询结果所需的状态可能会无限增长,具体取决于不同输入行的数量。请提供具有有效保存间隔的查询配置,以防止过大的状态。有关详细信息,请参阅[Streaming Concepts](streaming.html)。 | | Comparison functions | Description | | --- | --- | -| - -<figure class="highlight"> - -``` -ANY1 === ANY2 -``` - -</figure> - - | Returns TRUE if _ANY1_ is equal to _ANY2_; returns UNKNOWN if _ANY1_ or _ANY2_ is NULL. | -| - -<figure class="highlight"> - -``` -ANY1 !== ANY2 -``` - -</figure> - - | Returns TRUE if _ANY1_ is not equal to _ANY2_; returns UNKNOWN if _ANY1_ or _ANY2_ is NULL. | -| - -<figure class="highlight"> - -``` -ANY1 > ANY2 -``` - -</figure> - - | Returns TRUE if _ANY1_ is greater than _ANY2_; returns UNKNOWN if _ANY1_ or _ANY2_ is NULL. | -| +| `ANY1 === ANY2` | Returns TRUE if _ANY1_ is equal to _ANY2_; returns UNKNOWN if _ANY1_ or _ANY2_ is NULL. | +| `ANY1 !== ANY2` | Returns TRUE if _ANY1_ is not equal to _ANY2_; returns UNKNOWN if _ANY1_ or _ANY2_ is NULL. | +| `ANY1 > ANY2` | Returns TRUE if _ANY1_ is greater than _ANY2_; returns UNKNOWN if _ANY1_ or _ANY2_ is NULL. | +| `ANY1 >= ANY2` | Returns TRUE if _ANY1_ is greater than or equal to _ANY2_; returns UNKNOWN if _ANY1_ or _ANY2_ is NULL. | +| `ANY1 < ANY2` | Returns TRUE if _ANY1_ is less than _ANY2_; returns UNKNOWN if _ANY1_ or _ANY2_ is NULL. | +| `ANY1 <= ANY2` | Returns TRUE if _ANY1_ is less than or equal to _ANY2_; returns UNKNOWN if _ANY1_ or _ANY2_ is NULL. | +| `ANY.isNull` | Returns TRUE if _ANY_ is NULL. | +| `ANY.isNotNull` | Returns TRUE if _ANY_ is not NULL. | +| `STRING1.like(STRING2)` | Returns TRUE if _STRING1_ matches pattern _STRING2_; returns UNKNOWN if _STRING1_ or _STRING2_ is NULL.E.g., `"JoKn".like("Jo_n%")` returns TRUE. | +| `STRING.similar(STRING)` | Returns TRUE if _STRING1_ matches SQL regular expression _STRING2_; returns UNKNOWN if _STRING1_ or _STRING2_ is NULL.E.g., `"A".similar("A+")` returns TRUE. | +| `ANY1.in(ANY2, ANY3, ...)` | Returns TRUE if _ANY1_ exists in a given list _(ANY2, ANY3, ...)_. When _(ANY2, ANY3, ...)_. contains NULL, returns TRUE if the element can be found and UNKNOWN otherwise. Always returns UNKNOWN if _ANY1_ is NULL.E.g., `4.in(1, 2, 3)` returns FALSE. | +| `ANY.in(TABLE)` | Returns TRUE if _ANY_ is equal to a row returned by sub-query _TABLE_.**Note:** For streaming queries the operation is rewritten in a join and group operation. The required state to compute the query result might grow infinitely depending on the number of distinct input rows. Please provide a query configuration with valid retention interval to prevent excessive state size. See [Streaming Concepts](streaming.html) for details. | +| `ANY1.between(ANY2, ANY3)` | Returns TRUE if _ANY1_ is greater than or equal to _ANY2_ and less than or equal to _ANY3_. When either _ANY2_ or _ANY3_ is NULL, returns FALSE or UNKNOWN.E.g., `12.between(15, 12)` returns FALSE; `12.between(10, Null(INT))` returns UNKNOWN; `12.between(Null(INT), 10)` returns FALSE. | +| `ANY1.notBetween(ANY2, ANY3)` | Returns TRUE if _ANY1_ is less than _ANY2_ or greater than _ANY3_. When either _ANY2_ or _ANY3_ is NULL, returns TRUE or UNKNOWN.E.g., `12.notBetween(15, 12)` returns TRUE; `12.notBetween(Null(INT), 15)` returns UNKNOWN; `12.notBetween(15, Null(INT))` returns TRUE. | -<figure class="highlight"> - -``` -ANY1 >= ANY2 -``` - -</figure> - - | Returns TRUE if _ANY1_ is greater than or equal to _ANY2_; returns UNKNOWN if _ANY1_ or _ANY2_ is NULL. | -| - -<figure class="highlight"> - -``` -ANY1 < ANY2 -``` - -</figure> - - | Returns TRUE if _ANY1_ is less than _ANY2_; returns UNKNOWN if _ANY1_ or _ANY2_ is NULL. | -| - -<figure class="highlight"> - -``` -ANY1 <= ANY2 -``` - -</figure> - - | Returns TRUE if _ANY1_ is less than or equal to _ANY2_; returns UNKNOWN if _ANY1_ or _ANY2_ is NULL. | -| - -<figure class="highlight"> - -``` -ANY.isNull -``` - -</figure> - - | Returns TRUE if _ANY_ is NULL. | -| - -<figure class="highlight"> - -``` -ANY.isNotNull -``` - -</figure> - - | Returns TRUE if _ANY_ is not NULL. | -| - -<figure class="highlight"> - -``` -STRING1.like(STRING2) -``` - -</figure> - - | Returns TRUE if _STRING1_ matches pattern _STRING2_; returns UNKNOWN if _STRING1_ or _STRING2_ is NULL.E.g., `"JoKn".like("Jo_n%")` returns TRUE. | -| - -<figure class="highlight"> - -``` -STRING.similar(STRING) -``` +| Comparison functions | Description | +| --- | --- | +| `ANY1 === ANY2` | Returns TRUE if _ANY1_ is equal to _ANY2_; returns UNKNOWN if _ANY1_ or _ANY2_ is NULL. | +| `ANY1 !== ANY2` | Returns TRUE if _ANY1_ is not equal to _ANY2_; returns UNKNOWN if _ANY1_ or _ANY2_ is NULL. | +| `ANY1 > ANY2` | Returns TRUE if _ANY1_ is greater than _ANY2_; returns UNKNOWN if _ANY1_ or _ANY2_ is NULL. | +| `ANY1 >= ANY2` | Returns TRUE if _ANY1_ is greater than or equal to _ANY2_; returns UNKNOWN if _ANY1_ or _ANY2_ is NULL. | +| `ANY1 < ANY2` | Returns TRUE if _ANY1_ is less than _ANY2_; returns UNKNOWN if _ANY1_ or _ANY2_ is NULL. | +| `ANY1 <= ANY2` | Returns TRUE if _ANY1_ is less than or equal to _ANY2_; returns UNKNOWN if _ANY1_ or _ANY2_ is NULL. | +| `ANY.isNull` | Returns TRUE if _ANY_ is NULL. | +| `ANY.isNotNull` | Returns TRUE if _ANY_ is not NULL. | +| `STRING1.like(STRING2)` | Returns TRUE if _STRING1_ matches pattern _STRING2_; returns UNKNOWN if _STRING1_ or _STRING2_ is NULL.E.g., `"JoKn".like("Jo_n%")` returns TRUE. | +| `STRING1.similar(STRING2)` | Returns TRUE if _STRING1_ matches SQL regular expression _STRING2_; returns UNKNOWN if _STRING1_ or _STRING2_ is NULL.E.g., `"A".similar("A+")` returns TRUE. | +| `ANY1.in(ANY2, ANY3, ...)` | Returns TRUE if _ANY1_ exists in a given list _(ANY2, ANY3, ...)_. When _(ANY2, ANY3, ...)_. contains NULL, returns TRUE if the element can be found and UNKNOWN otherwise. Always returns UNKNOWN if _ANY1_ is NULL.E.g., `4.in(1, 2, 3)` returns FALSE. | +| `ANY.in(TABLE)` | Returns TRUE if _ANY_ is equal to a row returned by sub-query _TABLE_.**Note:** For streaming queries the operation is rewritten in a join and group operation. The required state to compute the query result might grow infinitely depending on the number of distinct input rows. Please provide a query configuration with valid retention interval to prevent excessive state size. See [Streaming Concepts](streaming.html) for details. | +| `ANY1.between(ANY2, ANY3)` | Returns TRUE if _ANY1_ is greater than or equal to _ANY2_ and less than or equal to _ANY3_. When either _ANY2_ or _ANY3_ is NULL, returns FALSE or UNKNOWN.E.g., `12.between(15, 12)` returns FALSE; `12.between(10, Null(Types.INT))` returns UNKNOWN; `12.between(Null(Types.INT), 10)` returns FALSE. | +| `ANY1.notBetween(ANY2, ANY3)` | Returns TRUE if _ANY1_ is less than _ANY2_ or greater than _ANY3_. When either _ANY2_ or _ANY3_ is NULL, returns TRUE or UNKNOWN.E.g., `12.notBetween(15, 12)` returns TRUE; `12.notBetween(Null(Types.INT), 15)` returns UNKNOWN; `12.notBetween(15, Null(Types.INT))` returns TRUE. | -</figure> +### 逻辑函数 - | Returns TRUE if _STRING1_ matches SQL regular expression _STRING2_; returns UNKNOWN if _STRING1_ or _STRING2_ is NULL.E.g., `"A".similar("A+")` returns TRUE. | -| +* [**SQL**](#tab_SQL_1) +* [**Java**](#tab_java_1) +* [**Scala**](#tab_scala_1) -<figure class="highlight"> +| 逻辑函数 | 描述 | +| --- | --- | +| `boolean1 OR boolean2` | 如果_boolean1_为TRUE或_boolean2_为TRUE,则返回TRUE。支持三值逻辑。例如,`TRUE OR UNKNOWN`返回TRUE。 | +| `boolean1 AND boolean2` | 如果_boolean1_和_boolean2_都为TRUE,则返回TRUE。支持三值逻辑。例如,`TRUE AND UNKNOWN`返回UNKNOWN。 | +| `NOT boolean` | 如果_boolean_为FALSE,则返回TRUE ; 否则返回TRUE 。如果_boolean_为TRUE,则返回FALSE ; 如果_布尔_值为UNKNOWN,则返回UNKNOWN。 | +| `boolean IS FALSE` | 如果_boolean_为FALSE,则返回TRUE ; 否则返回TRUE 。如果_boolean_为TRUE或UNKNOWN,则返回FALSE 。 | +| `boolean IS NOT FALSE` | 如果_boolean_为TRUE或UNKNOWN,则返回TRUE;否则返回TRUE 。如果_boolean_为FALSE,则返回FALSE。 | +| `boolean IS TRUE` | 如果_boolean_为TRUE,则返回TRUE; 如果_boolean_为FALSE或UNKNOWN,则返回FALSE 。 | +| `boolean IS NOT TRUE` | 如果_boolean_为FALSE或UNKNOWN,则返回TRUE;否则返回TRUE 。如果_boolean_为FALSE,则返回FALSE。 | +| `boolean IS UNKNOWN` | 如果_boolean_是UNKNOWN,则返回TRUE ; 否则返回TRUE 。如果_boolean_为TRUE或FALSE,则返回FALSE。 | +| `boolean IS NOT UNKNOWN` | 如果_boolean_为TRUE或FALSE,则返回TRUE;否则返回TRUE 。如果_布尔_值为UNKNOWN,则返回FALSE 。 | -``` -ANY1.in(ANY2, ANY3, ...) -``` +| Logical functions | Description | +| --- | --- | +| `BOOLEAN1 || BOOLEAN2` | Returns TRUE if _BOOLEAN1_ is TRUE or _BOOLEAN2_ is TRUE. Supports three-valued logic.E.g., `true || Null(BOOLEAN)` returns TRUE. | +| `BOOLEAN1 && BOOLEAN2` | Returns TRUE if _BOOLEAN1_ and _BOOLEAN2_ are both TRUE. Supports three-valued logic.E.g., `true && Null(BOOLEAN)` returns UNKNOWN. | +| `!BOOLEAN` | Returns TRUE if _BOOLEAN_ is FALSE; returns FALSE if _BOOLEAN_ is TRUE; returns UNKNOWN if _BOOLEAN_ is UNKNOWN. | +| `BOOLEAN.isTrue` | Returns TRUE if _BOOLEAN_ is TRUE; returns FALSE if _BOOLEAN_ is FALSE or UNKNOWN. | +| `BOOLEAN.isFalse` | Returns TRUE if _BOOLEAN_ is FALSE; returns FALSE if _BOOLEAN_ is TRUE or UNKNOWN. | +| `BOOLEAN.isNotTrue` | Returns TRUE if _BOOLEAN_ is FALSE or UNKNOWN; returns FALSE if _BOOLEAN_ is FALSE. | +| `BOOLEAN.isNotFalse` | Returns TRUE if _BOOLEAN_ is TRUE or UNKNOWN; returns FALSE if _BOOLEAN_ is FALSE. | -</figure> +| Logical functions | Description | +| --- | --- | +| `BOOLEAN1 || BOOLEAN2` | Returns TRUE if _BOOLEAN1_ is TRUE or _BOOLEAN2_ is TRUE. Supports three-valued logic.E.g., `true || Null(Types.BOOLEAN)` returns TRUE. | +| `BOOLEAN1 && BOOLEAN2` | Returns TRUE if _BOOLEAN1_ and _BOOLEAN2_ are both TRUE. Supports three-valued logic.E.g., `true && Null(Types.BOOLEAN)` returns UNKNOWN. | +| `!BOOLEAN` | Returns TRUE if _BOOLEAN_ is FALSE; returns FALSE if _BOOLEAN_ is TRUE; returns UNKNOWN if _BOOLEAN_ is UNKNOWN. | +| `BOOLEAN.isTrue` | Returns TRUE if _BOOLEAN_ is TRUE; returns FALSE if _BOOLEAN_ is FALSE or UNKNOWN. | +| `BOOLEAN.isFalse` | Returns TRUE if _BOOLEAN_ is FALSE; returns FALSE if _BOOLEAN_ is TRUE or UNKNOWN. | +| `BOOLEAN.isNotTrue` | Returns TRUE if _BOOLEAN_ is FALSE or UNKNOWN; returns FALSE if _BOOLEAN_ is FALSE. | +| `BOOLEAN.isNotFalse` | Returns TRUE if _BOOLEAN_ is TRUE or UNKNOWN; returns FALSE if _BOOLEAN_ is FALSE. | - | Returns TRUE if _ANY1_ exists in a given list _(ANY2, ANY3, ...)_. When _(ANY2, ANY3, ...)_. contains NULL, returns TRUE if the element can be found and UNKNOWN otherwise. Always returns UNKNOWN if _ANY1_ is NULL.E.g., `4.in(1, 2, 3)` returns FALSE. | -| +### 算术函数 -<figure class="highlight"> +* [**SQL**](#tab_SQL_2) +* [**Java**](#tab_java_2) +* [**Scala**](#tab_scala_2) -``` -ANY.in(TABLE) -``` +| 算术函数 | 描述 | +| --- | --- | +| `+ numeric` | 返回_数字_。 | +| `- numeric` | 返回负_数字_。 | +| `numeric1 + numeric2` | 返回_numeric1_加上_numeric2_。 | +| `numeric1 - numeric2` | 返回_numeric1_减去_numeric2_。 | +| `numeric1 * numeric2` | 返回_numeric1_乘以_numeric2_。 | +| `numeric1 / numeric2` | 返回_numeric1_除以_numeric2_。 | +| `POWER(numeric1, numeric2)` | 返回_numeric1_上升到_numeric2的幂_。 | +| `ABS(numeric)` | 返回_numeric_的绝对值。 | +| `MOD(numeric1, numeric2)` | 返回_numeric1_的余数(模数)除以_numeric2_。仅当_numeric1_为负数时,结果才为负数。 | +| `SQRT(numeric)` | 返回_数字的_平方根。 | +| `LN(numeric)` | 返回的自然对数(以e为底)_的数字_。 | +| `LOG10(numeric)` | 返回_数字_的基数10对数。 | +| `LOG2(numeric)` | 返回_数字_的基数2对数。 | +| `LOG(numeric2)` | 使用一个参数调用时,返回_numeric2_的自然对数。当使用两个参数调用时,此函数将_numeric2_的对数返回到基数_numeric1_。**注意:**目前,_numeric2_必须大于0且_numeric1_必须大于1。 | +| `LOG(numeric1, numeric2)` | | +| `EXP(numeric)` | 返回e提升到_数字_的幂。 | +| `CEIL(numeric)` | 将_数字_向上舍入,并返回大于或等于_numeric_的最小_数字_。 | +| `CEILING(numeric)` | | +| `FLOOR(numeric)` | 将_数字_向下舍入,并返回小于或等于_numeric_的最大_数字_。 | +| `SIN(numeric)` | 返回_数字_的正弦值。 | +| `COS(numeric)` | 返回_数字_的余弦值。 | +| `TAN(numeric)` | 返回_数字_的正切值。 | +| `COT(numeric)` | 返回_数字_的余切。 | +| `ASIN(numeric)` | 返回_数字的_反正弦值。 | +| `ACOS(numeric)` | 返回_数字的反_余弦值。 | +| `ATAN(numeric)` | 返回_数字的_反正切。 | +| `ATAN2(numeric1, numeric2)` | 返回坐标_(numeric1,numeric2)的_反正切。 | +| `DEGREES(numeric)` | 返回弧度_数字_的度数表示。 | +| `RADIANS(numeric)` | 返回度数_数字_的弧度表示。 | +| `SIGN(numeric)` | 返回_数字_的符号。 | +| `ROUND(numeric, integer)` | 返回舍入为_数字的__整数_小数_位数_。 | +| `PI` | 返回比pi更接近任何其他值的值。 | +| `E()` | 返回比e的任何其他值更接近的值。 | +| `RAND()` | 返回介于0.0(包括)和1.0(不包括)之间的伪随机双精度值。 | +| `RAND(integer)` | 使用初始种子_整数_返回介于0.0(含)和1.0(不包含)之间的伪随机双精度值。如果两个RAND函数具有相同的初始种子,则它们将返回相同的数字序列。 | +| `RAND_INTEGER(integer)` | 返回0(包括)和_整数_(不包括)之间的伪随机整数值。 | +| `RAND_INTEGER(integer1, integer2)` | 返回0(包括)之间的伪随机整数值和具有初始种子的指定值(不包括)。如果两个RAND_INTEGER函数具有相同的初始种子和绑定,则它们将返回相同的数字序列。 | +| `UUID()` | 根据RFC 4122类型4(伪随机生成的)UUID返回UUID(通用唯一标识符)字符串(例如,“3d3c68f7-f608-473f-b60c-b0c44ad4cc4e”)。使用加密强伪随机数生成器生成UUID。 | +| `BIN(integer)` | 以二进制格式返回_整数_的字符串表示形式。如果_integer_为NULL,则返回NULL。例如,`BIN(4)`返回'100'并`BIN(12)`返回'1100'。 | +| `HEX(numeric)` | 返回整数_数值_的字符串表示形式或十六进制格式的_字符串_。如果参数为NULL,则返回NULL。例如,数字20导致“14”,数字100导致“64”,字符串“hello,world”导致“68656C6C6F2C776F726C64”。 | +| `HEX(string) ` | | -</figure> +| Arithmetic functions | Description | +| --- | --- | +| `+ NUMERIC` | Returns _NUMERIC_. | +| `- NUMERIC` | Returns negative _NUMERIC_. | +| `NUMERIC1 + NUMERIC2` | Returns _NUMERIC1_ plus _NUMERIC2_. | +| `NUMERIC1 - NUMERIC2` | Returns _NUMERIC1_ minus _NUMERIC2_. | +| `NUMERIC1 * NUMERIC2` | Returns _NUMERIC1_ multiplied by _NUMERIC2_. | +| `NUMERIC1 / NUMERIC2` | Returns _NUMERIC1_ divided by _NUMERIC2_. | +| `NUMERIC1.power(NUMERIC2)` | Returns _NUMERIC1_ raised to the power of _NUMERIC2_. | +| `NUMERIC.abs()` | Returns the absolute value of _NUMERIC_. | +| `NUMERIC1 % NUMERIC2` | Returns the remainder (modulus) of _NUMERIC1_ divided by _NUMERIC2_. The result is negative only if _numeric1_ is negative. | +| `NUMERIC.sqrt()` | Returns the square root of _NUMERIC_. | +| `NUMERIC.ln()` | Returns the natural logarithm (base e) of _NUMERIC_. | +| `NUMERIC.log10()` | Returns the base 10 logarithm of _NUMERIC_. | +| `NUMERIC.log2()` | Returns the base 2 logarithm of _NUMERIC_. | +| `NUMERIC1.log()` | When called without argument, returns the natural logarithm of _NUMERIC1_. When called with an argument, returns the logarithm of _NUMERIC1_ to the base _NUMERIC2_.**Note:** Currently, _NUMERIC1_ must be greater than 0 and _NUMERIC2_ must be greater than 1. | +| `NUMERIC1.log(NUMERIC2)` | | +| `NUMERIC.exp()` | Returns e raised to the power of _NUMERIC_. | +| `NUMERIC.ceil()` | Rounds _NUMERIC_ up, and returns the smallest number that is greater than or equal to _NUMERIC_. | +| `NUMERIC.floor()` | Rounds _NUMERIC_ down, and returns the largest number that is less than or equal to _NUMERIC_. | +| `NUMERIC.sin()` | Returns the sine of _NUMERIC_. | +| `NUMERIC.cos()` | Returns the cosine of _NUMERIC_. | +| `NUMERIC.tan()` | Returns the tangent of _NUMERIC_. | +| `NUMERIC.cot()` | Returns the cotangent of a _NUMERIC_. | +| `NUMERIC.asin()` | Returns the arc sine of _NUMERIC_. | +| `NUMERIC.acos()` | Returns the arc cosine of _NUMERIC_. | +| `NUMERIC.atan()` | Returns the arc tangent of _NUMERIC_. | +| `atan2(NUMERIC1, NUMERIC2)` | Returns the arc tangent of a coordinate _(NUMERIC1, NUMERIC2)_. | +| `NUMERIC.degrees()` | Returns the degree representation of a radian _NUMERIC_. | +| `NUMERIC.radians()` | Returns the radian representation of a degree _NUMERIC_. | +| `NUMERIC.sign()` | Returns the signum of _NUMERIC_. | +| `NUMERIC.round(INT)` | Returns a number rounded to _INT_ decimal places for _NUMERIC_. | +| `pi()` | Returns a value that is closer than any other values to pi. | +| `e()` | Returns a value that is closer than any other values to e. | +| `rand()` | Returns a pseudorandom double value between 0.0 (inclusive) and 1.0 (exclusive). | +| `rand(INTEGER)` | Returns a pseudorandom double value between 0.0 (inclusive) and 1.0 (exclusive) with an initial seed _INTEGER_. Two RAND functions will return identical sequences of numbers if they have the same initial seed. | +| `randInteger(INTEGER)` | Returns a pseudorandom integer value between 0 (inclusive) and _INTEGER_ (exclusive). | +| `randInteger(INTEGER1, INTEGER2)` | Returns a pseudorandom integer value between 0 (inclusive) and _INTEGER2_ (exclusive) with an initial seed _INTEGER1_. Two randInteger functions will return identical sequences of numbers if they have same initial seed and bound. | +| `uuid()` | Returns an UUID (Universally Unique Identifier) string (e.g., "3d3c68f7-f608-473f-b60c-b0c44ad4cc4e") according to RFC 4122 type 4 (pseudo randomly generated) UUID. The UUID is generated using a cryptographically strong pseudo random number generator. | +| `INTEGER.bin()` | Returns a string representation of _INTEGER_ in binary format. Returns NULL if _INTEGER_ is NULL.E.g., `4.bin()` returns "100" and `12.bin()` returns "1100". | +| `NUMERIC.hex()` | Returns a string representation of an integer _NUMERIC_ value or a _STRING_ in hex format. Returns NULL if the argument is NULL.E.g. a numeric 20 leads to "14", a numeric 100 leads to "64", a string "hello,world" leads to "68656C6C6F2C776F726C64". | +| `STRING.hex()` | | - | Returns TRUE if _ANY_ is equal to a row returned by sub-query _TABLE_.**Note:** For streaming queries the operation is rewritten in a join and group operation. The required state to compute the query result might grow infinitely depending on the number of distinct input rows. Please provide a query configuration with valid retention interval to prevent excessive state size. See [Streaming Concepts](streaming.html) for details. | -| +| Arithmetic functions | Description | +| --- | --- | +| `+ NUMERIC` | Returns _NUMERIC_. | +| `- NUMERIC` | Returns negative _NUMERIC_. | +| `NUMERIC1 + NUMERIC2` | Returns _NUMERIC1_ plus _NUMERIC2_. | +| `NUMERIC1 - NUMERIC2` | Returns _NUMERIC1_ minus _NUMERIC2_. | +| `NUMERIC1 * NUMERIC2` | Returns _NUMERIC1_ multiplied by _NUMERIC2_. | +| `NUMERIC1 / NUMERIC2` | Returns _NUMERIC1_ divided by _NUMERIC2_. | +| `NUMERIC1.power(NUMERIC2)` | Returns _NUMERIC1_ raised to the power of _NUMERIC2_. | +| `NUMERIC.abs()` | Returns the absolute value of _NUMERIC_. | +| `NUMERIC1 % NUMERIC2` | Returns the remainder (modulus) of _NUMERIC1_ divided by _NUMERIC2_. The result is negative only if _numeric1_ is negative. | +| `NUMERIC.sqrt()` | Returns the square root of _NUMERIC_. | +| `NUMERIC.ln()` | Returns the natural logarithm (base e) of _NUMERIC_. | +| `NUMERIC.log10()` | Returns the base 10 logarithm of _NUMERIC_. | +| `NUMERIC.log2()` | Returns the base 2 logarithm of _NUMERIC_. | +| `NUMERIC1.log()` | When called without argument, returns the natural logarithm of _NUMERIC1_. When called with an argument, returns the logarithm of _NUMERIC1_ to the base _NUMERIC2_.**Note:** Currently, _NUMERIC1_ must be greater than 0 and _NUMERIC2_ must be greater than 1. | +| `NUMERIC1.log(NUMERIC2)` | | +| `NUMERIC.exp()` | Returns e raised to the power of _NUMERIC_. | +| `NUMERIC.ceil()` | Rounds _NUMERIC_ up, and returns the smallest number that is greater than or equal to _NUMERIC_. | +| `NUMERIC.floor()` | Rounds _NUMERIC_ down, and returns the largest number that is less than or equal to _NUMERIC_. | +| `NUMERIC.sin()` | Returns the sine of _NUMERIC_. | +| `NUMERIC.cos()` | Returns the cosine of _NUMERIC_. | +| `NUMERIC.tan()` | Returns the tangent of _NUMERIC_. | +| `NUMERIC.cot()` | Returns the cotangent of a _NUMERIC_. | +| `NUMERIC.asin()` | Returns the arc sine of _NUMERIC_. | +| `NUMERIC.acos()` | Returns the arc cosine of _NUMERIC_. | +| `NUMERIC.atan()` | Returns the arc tangent of _NUMERIC_. | +| `atan2(NUMERIC1, NUMERIC2)` | Returns the arc tangent of a coordinate _(NUMERIC1, NUMERIC2)_. | +| `NUMERIC.degrees()` | Returns the degree representation of a radian _NUMERIC_. | +| `NUMERIC.radians()` | Returns the radian representation of a degree _NUMERIC_. | +| `NUMERIC.sign()` | Returns the signum of _NUMERIC_. | +| `NUMERIC.round(INT)` | Returns a number rounded to _INT_ decimal places for _NUMERIC_. | +| `pi()` | Returns a value that is closer than any other values to pi. | +| `e()` | Returns a value that is closer than any other values to e. | +| `rand()` | Returns a pseudorandom double value between 0.0 (inclusive) and 1.0 (exclusive). | +| `rand(INTEGER)` | Returns a pseudorandom double value between 0.0 (inclusive) and 1.0 (exclusive) with an initial seed _INTEGER_. Two RAND functions will return identical sequences of numbers if they have the same initial seed. | +| `randInteger(INTEGER)` | Returns a pseudorandom integer value between 0 (inclusive) and _INTEGER_ (exclusive). | +| `randInteger(INTEGER1, INTEGER2)` | Returns a pseudorandom integer value between 0 (inclusive) and _INTEGER2_ (exclusive) with an initial seed _INTEGER1_. Two randInteger functions will return identical sequences of numbers if they have same initial seed and bound. | +| `uuid()` | Returns an UUID (Universally Unique Identifier) string (e.g., "3d3c68f7-f608-473f-b60c-b0c44ad4cc4e") according to RFC 4122 type 4 (pseudo randomly generated) UUID. The UUID is generated using a cryptographically strong pseudo random number generator. | +| `INTEGER.bin()` | Returns a string representation of _INTEGER_ in binary format. Returns NULL if _INTEGER_ is NULL.E.g., `4.bin()` returns "100" and `12.bin()` returns "1100". | +| `NUMERIC.hex()` | Returns a string representation of an integer _NUMERIC_ value or a _STRING_ in hex format. Returns NULL if the argument is NULL.E.g. a numeric 20 leads to "14", a numeric 100 leads to "64", a string "hello,world" leads to "68656C6C6F2C776F726C64". | +| `STRING.hex()` | | -<figure class="highlight"> +### 字符串函数 -``` -ANY1.between(ANY2, ANY3) -``` +* [**SQL**](#tab_SQL_3) +* [**Java**](#tab_java_3) +* [**Scala**](#tab_scala_3) -</figure> +| 字符串函数 | 描述 | +| --- | --- | +| `string1 || string2` | 返回_string1_和_string2_的串联。 | +| `CHAR_LENGTH(string)` | 返回_string中_的字符数。 | +| `CHARACTER_LENGTH(string)` | | +| `UPPER(string)` | 以大写形式返回_字符串_。 | +| `LOWER(string)` | 以小写形式返回_字符串_。 | +| `POSITION(string1 IN string2)` | 返回的第一次出现的位置(从1开始)_字符串1_在_字符串2_ ; 如果在_string2中_找不到_string1,_则返回0 。 | +| `TRIM([ BOTH | LEADING | TRAILING ] string1 FROM string2)` | 返回一个字符串,用于从_string2_中删除前导和/或尾随字符_string1_。默认情况下,两侧的空格都被删除。 | +| `LTRIM(string)` | 返回一个字符串,从去除左空格_的字符串_。例如,`LTRIM(' This is a test String.')`返回“This is a test String。”。 | +| `RTRIM(string)` | 返回一个字符串,从去除右方的空格_字符串_。例如,`RTRIM('This is a test String. ')`返回“This is a test String。”。 | +| `REPEAT(string, integer)` | 返回一个重复基本_字符串_ _整_数倍的_字符串_。例如,`REPEAT('This is a test String.', 2)`返回“这是一个测试字符串。这是一个测试字符串。”。 | +| `OVERLAY(string1 PLACING string2 FROM integer1 [ FOR integer2 ])` | 返回替换字符串_整数2_(_字符串2_通过默认的长度)的字符_字符串1_与_字符串2_从位置_整数1_。例如,`OVERLAY('This is an old string' PLACING ' new' FROM 10 FOR 5)`返回“这是一个新字符串” | +| `SUBSTRING(string FROM integer1 [ FOR integer2 ])` | 返回从位置_integer1_开始的_字符串_的子_字符串_,其长度为_integer2_(默认情况下为结尾)。 | +| `INITCAP(string)` | 返回一种新形式的_字符串_,每个单词的第一个字符转换为大写,其余字符转换为小写。这里的单词意味着一系列字母数字字符。 | +| `CONCAT(string1, string2,...)` | 返回连接_string1,string2,..._的字符串。如果任何参数为NULL,则返回NULL。例如,`CONCAT('AA', 'BB', 'CC')`返回“AABBCC”。 | +| `CONCAT_WS(string1, string2, string3,...)` | 返回一个字符串,用于将_string2,string3,..._与分隔符_string1连接起来_。在要连接的字符串之间添加分隔符。返回NULL如果_string1_为NULL。与之相比`CONCAT()`,`CONCAT_WS()`自动跳过NULL参数。例如,`CONCAT_WS('~', 'AA', NULL, 'BB', '', 'CC')`返回“AA~BB ~~ CC”。 | +| `LPAD(string1, integer, string2)` | 返回从_string1_左侧填充_string2_到_整数_字符长度的新字符串。如果_string1_的长度小于_整数_,则返回_string1_缩短为_整数_字符。例如,`LPAD('hi',4,'??')`返回“?? hi”; `LPAD('hi',1,'??')`返回“h”。 | +| `RPAD(string1, integer, string2)` | 返回从_string1_右侧填充_string2_到_整数_字符长度的新字符串。如果_string1_的长度小于_整数_,则返回_string1_缩短为_整数_字符。例如,`RPAD('hi',4,'??')`返回“hi ??”,`RPAD('hi',1,'??')`返回“h”。 | +| `FROM_BASE64(string)` | 返回_string_的base64解码结果; 如果_string_为NULL,则返回NULL。例如,`FROM_BASE64('aGVsbG8gd29ybGQ=')`返回“hello world”。 | +| `TO_BASE64(string)` | 从_string_返回base64编码的结果; 如果_string_为NULL,则返回NULL。例如,`TO_BASE64('hello world')`返回“aGVsbG8gd29ybGQ =”。 | - | Returns TRUE if _ANY1_ is greater than or equal to _ANY2_ and less than or equal to _ANY3_. When either _ANY2_ or _ANY3_ is NULL, returns FALSE or UNKNOWN.E.g., `12.between(15, 12)` returns FALSE; `12.between(10, Null(INT))` returns UNKNOWN; `12.between(Null(INT), 10)` returns FALSE. | -| +| String functions | Description | +| --- | --- | +| `STRING1 + STRING2` | Returns the concatenation of _STRING1_ and _STRING2_. | +| `STRING.charLength()` | Returns the number of characters in _STRING_. | +| `STRING.upperCase()` | Returns _STRING_ in uppercase. | +| `STRING.lowerCase()` | Returns _STRING_ in lowercase. | +| `STRING1.position(STRING2)` | Returns the position (start from 1) of the first occurrence of _STRING1_ in _STRING2_; returns 0 if _STRING1_ cannot be found in _STRING2_. | +| `STRING1.trim(LEADING, STRING2)` | Returns a string that removes leading and/or trailing characters _STRING2_ from _STRING1_. By default, whitespaces at both sides are removed. | +| `STRING1.trim(TRAILING, STRING2)` | | +| `STRING1.trim(BOTH, STRING2)` | | +| `STRING1.trim(BOTH)` | | +| `STRING1.trim()` | | +| `STRING.ltrim()` | Returns a string that removes the left whitespaces from _STRING_.E.g., `' This is a test String.'.ltrim()` returns "This is a test String.". | +| `STRING.rtrim()` | Returns a string that removes the right whitespaces from _STRING_.E.g., `'This is a test String. '.rtrim()` returns "This is a test String.". | +| `STRING.repeat(INT)` | Returns a string that repeats the base _STRING_ _INT_ times.E.g., `'This is a test String.'.repeat(2)` returns "This is a test String.This is a test String.". | +| `STRING1.overlay(STRING2, INT1)` | Returns a string that replaces _INT2_ (_STRING2_'s length by default) characters of _STRING1_ with _STRING2_ from position _INT1_.E.g., `'xxxxxtest'.overlay('xxxx', 6)` returns "xxxxxxxxx"; `'xxxxxtest'.overlay('xxxx', 6, 2)` returns "xxxxxxxxxst". | +| `STRING1.overlay(STRING2, INT1, INT2)` | | +| `STRING.substring(INT1)` | Returns a substring of _STRING_ starting from position _INT1_ with length _INT2_ (to the end by default). | +| `STRING.substring(INT1, INT2)` | | +| `STRING.initCap()` | Returns a new form of _STRING_ with the first character of each word converted to uppercase and the rest characters to lowercase. Here a word means a sequences of alphanumeric characters. | +| `concat(STRING1, STRING2, ...)` | Returns a string that concatenates _STRING1, STRING2, ..._. Returns NULL if any argument is NULL.E.g., `concat('AA', 'BB', 'CC')` returns "AABBCC". | +| `concat_ws(STRING1, STRING2, STRING3, ...)` | Returns a string that concatenates _STRING2, STRING3, ..._ with a separator _STRING1_. The separator is added between the strings to be concatenated. Returns NULL If _STRING1_ is NULL. Compared with `concat()`, `concat_ws()` automatically skips NULL arguments.E.g., `concat_ws('~', 'AA', Null(STRING), 'BB', '', 'CC')` returns "AA~BB~~CC". | +| `STRING1.lpad(INT, STRING2)` | Returns a new string from _STRING1_ left-padded with _STRING2_ to a length of _INT_ characters. If the length of _STRING1_ is shorter than _INT_, returns _STRING1_ shortened to _INT_ characters.E.g., `'hi'.lpad(4, '??')` returns "??hi"; `'hi'.lpad(1, '??')` returns "h". | +| `STRING1.rpad(INT, STRING2)` | Returns a new string from _STRING1_ right-padded with _STRING2_ to a length of _INT_ characters. If the length of _STRING1_ is shorter than _INT_, returns _STRING1_ shortened to _INT_ characters.E.g., `'hi'.rpad(4, '??')` returns "hi??"; `'hi'.rpad(1, '??')` returns "h". | +| `STRING.fromBase64()` | Returns the base64-decoded result from _STRING_; returns NULL if _STRING_ is NULL.E.g., `'aGVsbG8gd29ybGQ='.fromBase64()` returns "hello world". | +| `STRING.toBase64()` | Returns the base64-encoded result from _STRING_; returns NULL if _STRING_ is NULL.E.g., `'hello world'.toBase64()` returns "aGVsbG8gd29ybGQ=". | -<figure class="highlight"> +| String functions | Description | +| --- | --- | +| `STRING1 + STRING2` | Returns the concatenation of _STRING1_ and _STRING2_. | +| `STRING.charLength()` | Returns the number of characters in _STRING_. | +| `STRING.upperCase()` | Returns _STRING_ in uppercase. | +| `STRING.lowerCase()` | Returns _STRING_ in lowercase. | +| `STRING1.position(STRING2)` | Returns the position (start from 1) of the first occurrence of _STRING1_ in _STRING2_; returns 0 if _STRING1_ cannot be found in _STRING2_. | +| `STRING.trim(leading = true, trailing = true, character = " ")` | Returns a string that removes leading and/or trailing characters from _STRING_. | +| `STRING.ltrim()` | Returns a string that removes the left whitespaces from _STRING_.E.g., `" This is a test String.".ltrim()` returns "This is a test String.". | +| `STRING.rtrim()` | Returns a string that removes the right whitespaces from _STRING_.E.g., `"This is a test String. ".rtrim()` returns "This is a test String.". | +| `STRING.repeat(INT)` | Returns a string that repeats the base _STRING_ _INT_ times.E.g., `"This is a test String.".repeat(2)` returns "This is a test String.This is a test String.". | +| `STRING1.overlay(STRING2, INT1)` | Returns a string that replaces _INT2_ (_STRING2_'s length by default) characters of _STRING1_ with _STRING2_ from position _INT1_.E.g., `"xxxxxtest".overlay("xxxx", 6)` returns "xxxxxxxxx"; `"xxxxxtest".overlay("xxxx", 6, 2)` returns "xxxxxxxxxst". | +| `STRING1.overlay(STRING2, INT1, INT2)` | | +| `STRING.substring(INT1)` | Returns a substring of _STRING_ starting from position _INT1_ with length _INT2_ (to the end by default). | +| `STRING.substring(INT1, INT2)` | | +| `STRING.initCap()` | Returns a new form of _STRING_ with the first character of each word converted to uppercase and the rest characters to lowercase. Here a word means a sequences of alphanumeric characters. | +| `concat(STRING1, STRING2, ...)` | Returns a string that concatenates _STRING1, STRING2, ..._. Returns NULL if any argument is NULL.E.g., `concat("AA", "BB", "CC")` returns "AABBCC". | +| `concat_ws(STRING1, STRING2, STRING3, ...)` | Returns a string that concatenates _STRING2, STRING3, ..._ with a separator _STRING1_. The separator is added between the strings to be concatenated. Returns NULL If _STRING1_ is NULL. Compared with `concat()`, `concat_ws()` automatically skips NULL arguments.E.g., `concat_ws("~", "AA", Null(Types.STRING), "BB", "", "CC")` returns "AA~BB~~CC". | +| `STRING1.lpad(INT, STRING2)` | Returns a new string from _STRING1_ left-padded with _STRING2_ to a length of _INT_ characters. If the length of _STRING1_ is shorter than _INT_, returns _STRING1_ shortened to _INT_ characters.E.g., `"hi".lpad(4, "??")` returns "??hi"; `"hi".lpad(1, "??")` returns "h". | +| `STRING1.rpad(INT, STRING2)` | Returns a new string from _STRING1_ right-padded with _STRING2_ to a length of _INT_ characters. If the length of _STRING1_ is shorter than _INT_, returns _STRING1_ shortened to _INT_ characters.E.g., `"hi".rpad(4, "??")` returns "hi??"; `"hi".rpad(1, "??")` returns "h". | +| `STRING.fromBase64()` | Returns the base64-decoded result from _STRING_; returns null If _STRING_ is NULL.E.g., `"aGVsbG8gd29ybGQ=".fromBase64()` returns "hello world". | +| `STRING.toBase64()` | Returns the base64-encoded result from _STRING_; returns NULL if _STRING_ is NULL.E.g., `"hello world".toBase64()` returns "aGVsbG8gd29ybGQ=". | -``` -ANY1.notBetween(ANY2, ANY3) -``` +### 时间函数 -</figure> +* [**SQL**](#tab_SQL_4) +* [**Java**](#tab_java_4) +* [**Scala**](#tab_scala_4) - | Returns TRUE if _ANY1_ is less than _ANY2_ or greater than _ANY3_. When either _ANY2_ or _ANY3_ is NULL, returns TRUE or UNKNOWN.E.g., `12.notBetween(15, 12)` returns TRUE; `12.notBetween(Null(INT), 15)` returns UNKNOWN; `12.notBetween(15, Null(INT))` returns TRUE. | +| 时间函数 | 描述 | +| --- | --- | +| `DATE string` | 返回以“yyyy-MM-dd”形式从_字符串_解析的SQL日期。 | +| `TIME string` | 返回以“HH:mm:ss”形式从_字符串_解析的SQL时间。 | +| `TIMESTAMP string` | 返回以_字符串_形式解析的SQL时间戳,格式为“yyyy-MM-dd HH:mm:ss [.SSS]”。 | +| `INTERVAL string range` | 对于SQL间隔为毫秒,以“dd hh:mm:ss.fff”形式解析间隔_字符串_,对于SQL间隔月,解析“yyyy-mm”。的间隔范围可以是`DAY`,`MINUTE`,`DAY TO HOUR`,或`DAY TO SECOND`的毫秒时间间隔; `YEAR`或`YEAR TO MONTH`间隔数月。例如`INTERVAL '10 00:00:00.004' DAY TO SECOND`,`INTERVAL '10' DAY`或者`INTERVAL '2-10' YEAR TO MONTH`返回的时间间隔。 | +| `CURRENT_DATE` | 返回UTC时区中的当前SQL日期。 | +| `CURRENT_TIME` | 返回UTC时区中的当前SQL时间。 | +| `CURRENT_TIMESTAMP` | 返回UTC时区中的当前SQL时间戳。 | +| `LOCALTIME` | 返回本地时区的当前SQL时间。 | +| `LOCALTIMESTAMP` | 返回本地时区的当前SQL时间戳。 | +| `EXTRACT(timeintervalunit FROM temporal)` | 返回从_temporal_的_timeintervalitit_部分提取的long值。例如,`EXTRACT(DAY FROM DATE '2006-06-05')`返回5。 | +| `YEAR(date)` | 返回SQL日期_日期_的年份。相当于EXTRACT(从日期开始)。例如,`YEAR(DATE '1994-09-27')`返回1994年。 | +| `QUARTER(date)` | 从SQL返回日期一年的季度(1和4之间的整数)_日期_。相当于`EXTRACT(QUARTER FROM date)`。例如,`QUARTER(DATE '1994-09-27')`返回3。 | +| `MONTH(date)` | 从SQL日期_日期_返回一年中的月份(1到12之间的整数)。相当于`EXTRACT(MONTH FROM date)`。例如,`MONTH(DATE '1994-09-27')`返回9。 | +| `WEEK(date)` | 从SQL date _日期_返回一年中的一周(1到53之间的整数)。相当于`EXTRACT(WEEK FROM date)`。例如,`WEEK(DATE '1994-09-27')`返回39。 | +| `DAYOFYEAR(date)` | 返回一年的从SQL日期当天(1和366之间的整数)_日期_。相当于`EXTRACT(DOY FROM date)`。例如,`DAYOFYEAR(DATE '1994-09-27')`返回270。 | +| `DAYOFMONTH(date)` | 从SQL日期_日期_返回一个月中的某一天(1到31之间的整数)。相当于`EXTRACT(DAY FROM date)`。例如,`DAYOFMONTH(DATE '1994-09-27')`返回27。 | +| `DAYOFWEEK(date)` | 从SQL date _date_返回一周中的星期几(1到7之间的整数;星期日= 1)`EXTRACT(DOW FROM date)`。等效于。例如,`DAYOFWEEK(DATE '1994-09-27')`返回3。 | +| `HOUR(timestamp)` | 从SQL时间_戳记时间戳_返回一天中的小时(0到23之间的整数)。相当于`EXTRACT(HOUR FROM timestamp)`。例如,`HOUR(TIMESTAMP '1994-09-27 13:14:15')`返回13。 | +| `MINUTE(timestamp)` | 从SQL时间_戳记时间戳_返回一小时的分钟(0到59之间的整数)。相当于`EXTRACT(MINUTE FROM timestamp)`。例如,`MINUTE(TIMESTAMP '1994-09-27 13:14:15')`返回14。 | +| `SECOND(timestamp)` | 从SQL时间戳返回第二分钟(0到59之间的整数)。相当于`EXTRACT(SECOND FROM timestamp)`。例如,`SECOND(TIMESTAMP '1994-09-27 13:14:15')`返回15。 | +| `FLOOR(timepoint TO timeintervalunit)` | 返回将_时间点_向下_舍_入到时间单位_timeintervalunit的值_。例如,`FLOOR(TIME '12:44:31' TO MINUTE)`返回12:44:00。 | +| `CEIL(timepoint TO timeintervalunit)` | 返回一个将_时间点__舍_入到时间单位_timeintervalunit的值_。例如,`CEIL(TIME '12:44:31' TO MINUTE)`返回12:45:00。 | +| `(timepoint1, temporal1) OVERLAPS (timepoint2, temporal2)` | 如果由(_timepoint1_,_temporal1_)和(_timepoint2_,_temporal2_)定义的两个时间间隔重叠,则返回TRUE 。时间值可以是时间点或时间间隔。例如,`(TIME '2:55:00', INTERVAL '1' HOUR) OVERLAPS (TIME '3:30:00', INTERVAL '2' HOUR)`返回TRUE; `(TIME '9:00:00', TIME '10:00:00') OVERLAPS (TIME '10:15:00', INTERVAL '3' HOUR)`返回FALSE。 | +| `DATE_FORMAT(timestamp, string)` | 返回使用指定格式_字符串_格式化_时间戳的__字符串_。格式规范在[Date Format Specifier表中给出](#date-format-specifiers)。 | +| `TIMESTAMPADD(unit, interval, timevalue)` | 返回一个新的时间值,它将(带符号)整数时间间隔添加到_timevalue_。为单位_的时间间隔_是由单元参数,它应为以下值中的一个给定的:`SECOND`,`MINUTE`,`HOUR`,`DAY`,`WEEK`,`MONTH`,`QUARTER`,或`YEAR`。例如,`TIMESTAMPADD(WEEK, 1, DATE '2003-01-02')`退货`2003-01-09`。 | -| Comparison functions | Description | +| Temporal functions | Description | | --- | --- | -| +| `STRING.toDate()` | Returns a SQL date parsed from _STRING_ in form of "yyyy-MM-dd". | +| `STRING.toTime()` | Returns a SQL time parsed from _STRING_ in form of "HH:mm:ss". | +| `STRING.toTimestamp()` | Returns a SQL timestamp parsed from _STRING_ in form of "yyyy-MM-dd HH:mm:ss[.SSS]". | +| `NUMERIC.year` | Creates an interval of months for _NUMERIC_ years. | +| `NUMERIC.years` | | +| `NUMERIC.month` | Creates an interval of _NUMERIC_ months. | +| `NUMERIC.months` | | +| `NUMERIC.day` | Creates an interval of milliseconds for _NUMERIC_ days. | +| `NUMERIC.days` | | +| `NUMERIC.hour` | Creates an interval of milliseconds for _NUMERIC_ hours. | +| `NUMERIC.hours` | | +| `NUMERIC.minute` | Creates an interval of milliseconds for _NUMERIC_ minutes. | +| `NUMERIC.minutes` | | +| `NUMERIC.second` | Creates an interval of milliseconds for _NUMERIC_ seconds. | +| `NUMERIC.seconds` | | +| `NUMERIC.milli` | Creates an interval of _NUMERIC_ milliseconds. | +| `NUMERIC.millis` | | +| `currentDate()` | Returns the current SQL date in the UTC time zone. | +| `currentTime()` | Returns the current SQL time in the UTC time zone. | +| `currentTimestamp()` | Returns the current SQL timestamp in the UTC time zone. | +| `localTime()` | Returns the current SQL time in local time zone. | +| `localTimestamp()` | Returns the current SQL timestamp in local time zone. | +| `TEMPORAL.extract(TIMEINTERVALUNIT)` | Returns a long value extracted from the _TIMEINTERVALUNIT_ part of _temporal_.E.g., `'2006-06-05'.toDate.extract(DAY)` returns 5; `'2006-06-05'.toDate.extract(QUARTER)` returns 2. | +| `TIMEPOINT.floor(TIMEINTERVALUNIT)` | Returns a value that rounds _TIMEPOINT_ down to the time unit _TIMEINTERVALUNIT_.E.g., `'12:44:31'.toDate.floor(MINUTE)` returns 12:44:00. | +| `TIMEPOINT.ceil(TIMEINTERVALUNIT)` | Returns a value that rounds _TIMEPOINT_ up to the time unit _TIMEINTERVALUNIT_.E.g., `'12:44:31'.toTime.floor(MINUTE)` returns 12:45:00. | +| `temporalOverlaps(TIMEPOINT1, TEMPORAL1, TIMEPOINT2, TEMPORAL2)` | Returns TRUE if two time intervals defined by (_TIMEPOINT1_, _TEMPORAL1_) and (_TIMEPOINT2_, _TEMPORAL2_) overlap. The temporal values could be either a time point or a time interval.E.g., `temporalOverlaps('2:55:00'.toTime, 1.hour, '3:30:00'.toTime, 2.hour)` returns TRUE. | +| `dateFormat(TIMESTAMP, STRING)` | Returns a string that formats _TIMESTAMP_ with a specified format _STRING_. The format specification is given in the [Date Format Specifier table](#date-format-specifiers).E.g., `dateFormat(ts, '%Y, %d %M')` results in strings formatted as "2017, 05 May". | -<figure class="highlight"> +| Temporal functions | Description | +| --- | --- | +| `STRING.toDate` | Returns a SQL date parsed from _STRING_ in form of "yyyy-MM-dd". | +| `STRING.toTime` | Returns a SQL time parsed from _STRING_ in form of "HH:mm:ss". | +| `STRING.toTimestamp` | Returns a SQL timestamp parsed from _STRING_ in form of "yyyy-MM-dd HH:mm:ss[.SSS]". | +| `NUMERIC.year` | Creates an interval of months for _NUMERIC_ years. | +| `NUMERIC.years` | | +| `NUMERIC.month` | Creates an interval of _NUMERIC_ months. | +| `NUMERIC.months` | | +| `NUMERIC.day` | Creates an interval of milliseconds for _NUMERIC_ days. | +| `NUMERIC.days` | | +| `NUMERIC.hour` | Creates an interval of milliseconds for _NUMERIC_ hours. | +| `NUMERIC.hours` | | +| `NUMERIC.minute` | Creates an interval of milliseconds for _NUMERIC_ minutes. | +| `NUMERIC.minutes` | | +| `NUMERIC.second` | Creates an interval of milliseconds for _NUMERIC_ seconds. | +| `NUMERIC.seconds` | | +| `NUMERIC.milli` | Creates an interval of _NUMERIC_ milliseconds. | +| `NUMERIC.millis` | | +| `currentDate()` | Returns the current SQL date in the UTC time zone. | +| `currentTime()` | Returns the current SQL time in the UTC time zone. | +| `currentTimestamp()` | Returns the current SQL timestamp in the UTC time zone. | +| `localTime()` | Returns the current SQL time in local time zone. | +| `localTimestamp()` | Returns the current SQL timestamp in local time zone. | +| `TEMPORAL.extract(TIMEINTERVALUNIT)` | Returns a long value extracted from the _TIMEINTERVALUNIT_ part of _temporal_.E.g., `"2006-06-05".toDate.extract(TimeIntervalUnit.DAY)` returns 5; `"2006-06-05".toDate.extract(QUARTER)` returns 2. | +| `TIMEPOINT.floor(TIMEINTERVALUNIT)` | Returns a value that rounds _TIMEPOINT_ down to the time unit _TIMEINTERVALUNIT_.E.g., `"12:44:31".toDate.floor(TimeIntervalUnit.MINUTE)` returns 12:44:00. | +| `TIMEPOINT.ceil(TIMEINTERVALUNIT)` | Returns a value that rounds _TIMEPOINT_ up to the time unit _TIMEINTERVALUNIT_.E.g., `"12:44:31".toTime.floor(TimeIntervalUnit.MINUTE)` returns 12:45:00. | +| `temporalOverlaps(TIMEPOINT1, TEMPORAL1, TIMEPOINT2, TEMPORAL2)` | Returns TRUE if two time intervals defined by (_TIMEPOINT1_, _TEMPORAL1_) and (_TIMEPOINT2_, _TEMPORAL2_) overlap. The temporal values could be either a time point or a time interval.E.g., `temporalOverlaps("2:55:00".toTime, 1.hour, "3:30:00".toTime, 2.hour)` returns TRUE. | +| `dateFormat(TIMESTAMP, STRING)` | Returns a string that formats _TIMESTAMP_ with a specified format _STRING_. The format specification is given in the [Date Format Specifier table](#date-format-specifiers).E.g., `dateFormat('ts, "%Y, %d %M")` results in strings formatted as "2017, 05 May". | -``` -ANY1 === ANY2 -``` +### 条件函数 -</figure> +* [**SQL**](#tab_SQL_5) +* [**Java**](#tab_java_5) +* [**Scala**](#tab_scala_5) - | Returns TRUE if _ANY1_ is equal to _ANY2_; returns UNKNOWN if _ANY1_ or _ANY2_ is NULL. | -| +| 条件函数 | 描述 | +| --- | --- | +| CASE value
WHEN value1_1 [, value1_2 ]* THEN result1
[ WHEN value2_1 [, value2_2 ]* THEN result2 ]*
[ ELSE resultZ ]
END
| 当第一个时间_值_包含在(_valueX_1,valueX_2,..._)中时返回_resultX_。如果没有值匹配,则返回_resultZ(_如果已提供),否则返回NULL。 | +| CASE
WHEN condition1 THEN result1
[ WHEN condition2 THEN result2 ]*
[ ELSE resultZ ]
END
| 满足第一个_conditionX_时返回_resultX_。如果没有满足条件,则返回_resultZ(_如果已提供),否则返回NULL。 | +| `NULLIF(value1, value2)` | 如果_value1_等于_value2_,则返回NULL ; 否则返回_value1_。例如,`NULLIF(5, 5)`返回NULL; `NULLIF(5, 0)`返回5。 | +| `COALESCE(value1, value2 [, value3 ]* )` | 从_value1,value2,..._返回非NULL的第一个值。例如,`COALESCE(NULL, 5)`返回5。 | -<figure class="highlight"> +| Conditional functions | Description | +| --- | --- | +| `BOOLEAN.?(VALUE1, VALUE2)` | Returns _VALUE1_ if _BOOLEAN_ evaluates to TRUE; returns _VALUE2_ otherwise.E.g., `(42 > 5).?('A', 'B')` returns "A". | -``` -ANY1 !== ANY2 -``` +| Conditional functions | Description | +| --- | --- | +| `BOOLEAN.?(VALUE1, VALUE2)` | Returns _VALUE1_ if _BOOLEAN_ evaluates to TRUE; returns _VALUE2_ otherwise.E.g., `(42 > 5).?("A", "B")` returns "A". | -</figure> +### 类型转换函数 - | Returns TRUE if _ANY1_ is not equal to _ANY2_; returns UNKNOWN if _ANY1_ or _ANY2_ is NULL. | -| +* [**SQL**](#tab_SQL_6) +* [**Java**](#tab_java_6) +* [**Scala**](#tab_scala_6) -<figure class="highlight"> +| 类型转换函数 | 描述 | +| --- | --- | +| `CAST(value AS type)` | 返回要转换为类型_类型_的新_值_。请在[此处](sql.html#data-types)查看支持的类型。[](sql.html#data-types)例如,`CAST('42' AS INT)`返回42。 | -``` -ANY1 > ANY2 -``` +| Type conversion functions | Description | +| --- | --- | +| `ANY.cast(TYPE)` | Returns a new _ANY_ being cast to type _TYPE_. See the supported types [here](tableApi.html#data-types).E.g., `'42'.cast(INT)` returns 42. | -</figure> +| Type conversion functions | Description | +| --- | --- | +| `ANY.cast(TYPE)` | Returns a new _ANY_ being cast to type _TYPE_. See the supported types [here](tableApi.html#data-types).E.g., `"42".cast(Types.INT)` returns 42. | - | Returns TRUE if _ANY1_ is greater than _ANY2_; returns UNKNOWN if _ANY1_ or _ANY2_ is NULL. | -| +### 收集函数 -<figure class="highlight"> +* [**SQL**](#tab_SQL_7) +* [**Java**](#tab_java_7) +* [**Scala**](#tab_scala_7) -``` -ANY1 >= ANY2 -``` +| 收集函数 | 描述 | +| --- | --- | +| `CARDINALITY(array)` | 返回_数组中_的数据元数。 | +| `array ‘[’ integer ‘]’` | 在返回位置处的数据元_整数_在_阵列_。索引从1开始。 | +| `ELEMENT(array)` | 返回_数组_的唯一数据元(其基数应为1); 如果_数组_为空,则返回NULL 。如果_数组_有多个数据元,则抛出异常。 | +| `CARDINALITY(map)` | 返回_map中_的条目数。 | +| `map ‘[’ value ‘]’` | 返回键指定的值,_值_的_Map_。 | -</figure> +| Collection functions | Description | +| --- | --- | +| `ARRAY.cardinality()` | Returns the number of elements in _ARRAY_. | +| `ARRAY.at(INT)` | Returns the element at position _INT_ in _ARRAY_. The index starts from 1. | +| `ARRAY.element()` | Returns the sole element of _ARRAY_ (whose cardinality should be one); returns NULL if _ARRAY_ is empty. Throws an exception if _ARRAY_ has more than one element. | +| `MAP.cardinality()` | Returns the number of entries in _MAP_. | +| `MAP.at(ANY)` | Returns the value specified by key _ANY_ in _MAP_. | - | Returns TRUE if _ANY1_ is greater than or equal to _ANY2_; returns UNKNOWN if _ANY1_ or _ANY2_ is NULL. | -| +| Collection functions | Description | +| --- | --- | +| `ARRAY.cardinality()` | Returns the number of elements in _ARRAY_. | +| `ARRAY.at(INT)` | Returns the element at position _INT_ in _ARRAY_. The index starts from 1. | +| `ARRAY.element()` | Returns the sole element of _ARRAY_ (whose cardinality should be one); returns NULL if _ARRAY_ is empty. Throws an exception if _ARRAY_ has more than one element. | +| `MAP.cardinality()` | Returns the number of entries in _MAP_. | +| `MAP.at(ANY)` | Returns the value specified by key _ANY_ in _MAP_. | -<figure class="highlight"> +### Value构建函数 -``` -ANY1 < ANY2 -``` +* [**SQL**](#tab_SQL_8) +* [**Java**](#tab_java_8) +* [**Scala**](#tab_scala_8) -</figure> +| Value建构函数 | 描述 | +| --- | --- | +| `ROW(value1, [, value2]*)` | 返回从值列表(_value1,value2,_ ...)创建的行。 | +| `(value1, [, value2]*)` | | +| `ARRAY ‘[’ value1 [, value2 ]* ‘]’` | 返回从值列表(_value1,value2_,...)创建的数组。 | +| `MAP ‘[’ value1, value2 [, value3, value4 ]* ‘]’` | 返回从键值对列表((_value1,value2_),_(value3,value4)_,...)创建的映射。 | - | Returns TRUE if _ANY1_ is less than _ANY2_; returns UNKNOWN if _ANY1_ or _ANY2_ is NULL. | -| +| Value constructor functions | Description | +| --- | --- | +| `row(ANY1, ANY2, ...)` | Returns a row created from a list of object values (_ANY1, ANY2_, ...). Row is composite type that can be access via [value access functions](#value-access-functions). | +| `array(ANY1, ANY2, ...)` | Returns an array created from a list of object values (_ANY1, ANY2_, ...). | +| `map(ANY1, ANY2, ANY3, ANY4, ...)` | Returns a map created from a list of key-value pairs ((_ANY1, ANY2_), _(ANY3, ANY4)_, ...). | +| `NUMERIC.rows` | Creates a _NUMERIC_ interval of rows (commonly used in window creation). | -<figure class="highlight"> +| Value constructor functions | Description | +| --- | --- | +| `row(ANY1, ANY2, ...)` | Returns a row created from a list of object values (_ANY1, ANY2_, ...). Row is composite type that can be access via [value access functions](#value-access-functions). | +| `array(ANY1, ANY2, ...)` | Returns an array created from a list of object values (_ANY1, ANY2_, ...). | +| `map(ANY1, ANY2, ANY3, ANY4, ...)` | Returns a map created from a list of key-value pairs ((_ANY1, ANY2_), _(ANY3, ANY4)_, ...). | +| `NUMERIC.rows` | Creates a _NUMERIC_ interval of rows (commonly used in window creation). | -``` -ANY1 <= ANY2 -``` +### Value访问函数 -</figure> +* [**SQL**](#tab_SQL_9) +* [**Java**](#tab_java_9) +* [**Scala**](#tab_scala_9) - | Returns TRUE if _ANY1_ is less than or equal to _ANY2_; returns UNKNOWN if _ANY1_ or _ANY2_ is NULL. | -| +| Value访问函数 | 描述 | +| --- | --- | +| `tableName.compositeType.field` | 按名称从Flink复合类型(例如,Tuple,POJO)返回字段的值。 | +| `tableName.compositeType.*` | 返回Flink复合类型(例如,Tuple,POJO)的平面表示,该复合类型将其每个直接子类型转换为单独的字段。在大多数情况下,平面表示的字段与原始字段的命名方式类似,但使用美元分隔符(例如`mypojo$mytuple$f0`)。 | -<figure class="highlight"> +| Value access functions | Description | +| --- | --- | +| `COMPOSITE.get(STRING)` | Returns the value of a field from a Flink composite type (e.g., Tuple, POJO) by name or index.E.g., `pojo.get('myField')` or `tuple.get(0)`. | +| `COMPOSITE.get(INT)` | | +| `ANY.flatten()` | Returns a flat representation of a Flink composite type (e.g., Tuple, POJO) that converts each of its direct subtype into a separate field. In most cases the fields of the flat representation are named similarly to the original fields but with a dollar separator (e.g., `mypojo$mytuple$f0`). | -``` -ANY.isNull -``` +| Value access functions | Description | +| --- | --- | +| `COMPOSITE.get(STRING)` | Returns the value of a field from a Flink composite type (e.g., Tuple, POJO) by name or index.E.g., `'pojo.get("myField")` or `'tuple.get(0)`. | +| `COMPOSITE.get(INT)` | | +| `ANY.flatten()` | Returns a flat representation of a Flink composite type (e.g., Tuple, POJO) that converts each of its direct subtype into a separate field. In most cases the fields of the flat representation are named similarly to the original fields but with a dollar separator (e.g., `mypojo$mytuple$f0`). | -</figure> +### 分组函数 - | Returns TRUE if _ANY_ is NULL. | -| +* [**SQL**](#tab_SQL_10) +* [**Java**](#tab_Java_10) +* [**Scala**](#tab_Scala_10) -<figure class="highlight"> +| 分组函数 | 描述 | +| --- | --- | +| `GROUP_ID()` | 返回唯一标识分组键组合的整数。 | +| `GROUPING(expression1 [, expression2]* )` | 返回给定分组表达式的位向量。 | +| `GROUPING_ID(expression1 [, expression2]* )` | | -``` -ANY.isNotNull -``` +| Grouping functions | Description | +| --- | --- | -</figure> +| Grouping functions | Description | +| --- | --- | - | Returns TRUE if _ANY_ is not NULL. | -| +### 散列函数 -<figure class="highlight"> +* [**SQL**](#tab_SQL_11) +* [**Java**](#tab_java_11) +* [**Scala**](#tab_scala_11) -``` -STRING1.like(STRING2) -``` +| 散列函数 | 描述 | +| --- | --- | +| `MD5(string)` | 将_字符串_的MD5哈希值作为32个十六进制数字的_字符串_返回; 如果_string_为NULL,则返回NULL。 | +| `SHA1(string)` | 以40个十六进制数字的_字符串_形式返回_字符串_的SHA-1哈希值; 如果_string_为NULL,则返回NULL。 | +| `SHA224(string)` | 返回_字符串_的SHA-224哈希值,作为56个十六进制数字的字符串; 如果_string_为NULL,则返回NULL。 | +| `SHA256(string)` | 以64个十六进制数字的_字符串_形式返回_字符串_的SHA-256哈希值; 如果_string_为NULL,则返回NULL。 | +| `SHA384(string)` | 返回_字符串_的SHA-384哈希值,作为96个十六进制数字的字符串; 如果_string_为NULL,则返回NULL。 | +| `SHA512(string)` | 返回_字符串_的SHA-512哈希值,作为128个十六进制数字的字符串; 如果_string_为NULL,则返回NULL。 | +| `SHA2(string, hashLength)` | 使用SHA-2系列散列函数(SHA-224,SHA-256,SHA-384或SHA-512)返回散列。第一个参数_字符串_是要散列的字符串,第二个参数_hashLength_是结果的位长度(_224,256,384_或512)。如果_string_或_hashLength_为NULL,则返回NULL。 | -</figure> +| Hash functions | Description | +| --- | --- | +| `STRING.md5()` | Returns the MD5 hash of _STRING_ as a string of 32 hexadecimal digits; returns NULL if _STRING_ is NULL. | +| `STRING.sha1()` | Returns the SHA-1 hash of _STRING_ as a string of 40 hexadecimal digits; returns NULL if _STRING_ is NULL. | +| `STRING.sha224()` | Returns the SHA-224 hash of _STRING_ as a string of 56 hexadecimal digits; returns NULL if _STRING_ is NULL. | +| `STRING.sha256()` | Returns the SHA-256 hash of _STRING_ as a string of 64 hexadecimal digits; returns NULL if _STRING_ is NULL. | +| `STRING.sha384()` | Returns the SHA-384 hash of _STRING_ as a string of 96 hexadecimal digits; returns NULL if _STRING_ is NULL. | +| `STRING.sha512()` | Returns the SHA-512 hash of _STRING_ as a string of 128 hexadecimal digits; returns NULL if _STRING_ is NULL. | +| `STRING.sha2(INT)` | Returns the SHA-2 family (SHA-224, SHA-256, SHA-384, or SHA-512) hashed value specified by _INT_ (which could be 224, 256, 384, or 512) for _STRING_. Returns NULL if _STRING_ or _INT_ is NULL. | - | Returns TRUE if _STRING1_ matches pattern _STRING2_; returns UNKNOWN if _STRING1_ or _STRING2_ is NULL.E.g., `"JoKn".like("Jo_n%")` returns TRUE. | -| +| Hash functions | Description | +| --- | --- | +| `STRING.md5()` | Returns the MD5 hash of _STRING_ as a string of 32 hexadecimal digits; returns NULL if _STRING_ is NULL. | +| `STRING.sha1()` | Returns the SHA-1 hash of _STRING_ as a string of 40 hexadecimal digits; returns NULL if _STRING_ is NULL. | +| `STRING.sha224()` | Returns the SHA-224 hash of _STRING_ as a string of 56 hexadecimal digits; returns NULL if _STRING_ is NULL. | +| `STRING.sha256()` | Returns the SHA-256 hash of _STRING_ as a string of 64 hexadecimal digits; returns NULL if _STRING_ is NULL. | +| `STRING.sha384()` | Returns the SHA-384 hash of _STRING_ as a string of 96 hexadecimal digits; returns NULL if _STRING_ is NULL. | +| `STRING.sha512()` | Returns the SHA-512 hash of _STRING_ as a string of 128 hexadecimal digits; returns NULL if _STRING_ is NULL. | +| `STRING.sha2(INT)` | Returns the SHA-2 family (SHA-224, SHA-256, SHA-384, or SHA-512) hashed value specified by _INT_ (which could be 224, 256, 384, or 512) for _STRING_. Returns NULL if _STRING_ or _INT_ is NULL. | -<figure class="highlight"> +### 辅助函数 -``` -STRING1.similar(STRING2) -``` +* [**SQL**](#tab_SQL_12) +* [**Java**](#tab_java_12) +* [**Scala**](#tab_scala_12) -</figure> +| 辅助函数 | 描述 | +| --- | --- | - | Returns TRUE if _STRING1_ matches SQL regular expression _STRING2_; returns UNKNOWN if _STRING1_ or _STRING2_ is NULL.E.g., `"A".similar("A+")` returns TRUE. | -| +| Auxiliary functions | Description | +| --- | --- | +| `ANY.as(NAME1, NAME2, ...)` | Specifies a name for _ANY_ (a field). Additional names can be specified if the expression expands to multiple fields. | -<figure class="highlight"> +| Auxiliary functions | Description | +| --- | --- | +| `ANY.as(NAME1, NAME2, ...)` | Specifies a name for _ANY_ (a field). Additional names can be specified if the expression expands to multiple fields. | -``` -ANY1.in(ANY2, ANY3, ...) -``` +## 聚合函数 -</figure> +聚合函数将所有行的表达式作为输入,并返回单个聚合值作为结果。 - | Returns TRUE if _ANY1_ exists in a given list _(ANY2, ANY3, ...)_. When _(ANY2, ANY3, ...)_. contains NULL, returns TRUE if the element can be found and UNKNOWN otherwise. Always returns UNKNOWN if _ANY1_ is NULL.E.g., `4.in(1, 2, 3)` returns FALSE. | -| +* [**SQL**](#tab_SQL_13) +* [**Java**](#tab_java_13) +* [**Scala**](#tab_scala_13) -<figure class="highlight"> +| 聚合函数 | 描述 | +| --- | --- | +| `COUNT([ ALL ] expression | DISTINCT expression1 [, expression2]*)` | 默认情况下或使用ALL,返回_表达式_不为NULL 的输入行数。将DISTINCT用于每个值的一个唯一实例。 | +| `COUNT(*)` | 返回输入行数。 | +| `COUNT(1)` | | +| `AVG([ ALL | DISTINCT ] expression)` | 默认情况下或使用关键字ALL,返回所有输入行的_表达式_的平均值(算术平均值)。将DISTINCT用于每个值的一个唯一实例。 | +| `SUM([ ALL | DISTINCT ] expression)` | 默认情况下或使用关键字ALL,返回所有输入行的_表达式_总和。将DISTINCT用于每个值的一个唯一实例。 | +| `MAX([ ALL | DISTINCT ] expression)` | 默认情况下或使用关键字ALL,返回所有输入行的_表达式_的最大值。将DISTINCT用于每个值的一个唯一实例。 | +| `MIN([ ALL | DISTINCT ] expression)` | 默认情况下或使用关键字ALL,返回所有输入行中_表达式_的最小值。将DISTINCT用于每个值的一个唯一实例。 | +| `STDDEV_POP([ ALL | DISTINCT ] expression)` | 默认情况下或使用关键字ALL,返回所有输入行中_表达式_的总体标准差。将DISTINCT用于每个值的一个唯一实例。 | +| `STDDEV_SAMP([ ALL | DISTINCT ] expression)` | 默认情况下或使用关键字ALL,返回所有输入行中_表达式_的样本标准差。将DISTINCT用于每个值的一个唯一实例。 | +| `VAR_POP([ ALL | DISTINCT ] expression)` | 默认情况下或使用关键字ALL,返回所有输入行中_表达式_的总体方差(总体标准差的平方)。将DISTINCT用于每个值的一个唯一实例。 | +| `VAR_SAMP([ ALL | DISTINCT ] expression)` | 默认情况下或使用关键字ALL,返回所有输入行中_表达式_的样本方差(样本标准差的平方)。将DISTINCT用于每个值的一个唯一实例。 | +| `COLLECT([ ALL | DISTINCT ] expression)` | 默认情况下或使用关键字ALL,在所有输入行中返回多_表达式_。NULL值将被忽略。将DISTINCT用于每个值的一个唯一实例。 | -``` -ANY.in(TABLE) -``` +| Aggregate functions | Description | +| --- | --- | +| `FIELD.count` | Returns the number of input rows for which _FIELD_ is not NULL. | +| `FIELD.avg` | Returns the average (arithmetic mean) of _FIELD_ across all input rows. | +| `FIELD.sum` | Returns the sum of numeric field _FIELD_ across all input rows. If all values are NULL, returns NULL. | +| `FIELD.sum0` | Returns the sum of numeric field _FIELD_ across all input rows. If all values are NULL, returns 0. | +| `FIELD.max` | Returns the maximum value of numeric field _FIELD_ across all input rows. | +| `FIELD.min` | Returns the minimum value of numeric field _FIELD_ across all input rows. | +| `FIELD.stddevPop` | Returns the population standard deviation of numeric field _FIELD_ across all input rows. | +| `FIELD.stddevSamp` | Returns the sample standard deviation of numeric field _FIELD_ across all input rows. | +| `FIELD.varPop` | Returns the population variance (square of the population standard deviation) of numeric field _FIELD_ across all input rows. | +| `FIELD.varSamp` | Returns the sample variance (square of the sample standard deviation) of numeric field _FIELD_ across all input rows. | +| `FIELD.collect` | Returns a multiset of _FIELD_ across all input rows. | -</figure> +| Aggregate functions | Description | +| --- | --- | +| `FIELD.count` | Returns the number of input rows for which _FIELD_ is not NULL. | +| `FIELD.avg` | Returns the average (arithmetic mean) of _FIELD_ across all input rows. | +| `FIELD.sum` | Returns the sum of numeric field _FIELD_ across all input rows. If all values are NULL, returns NULL. | +| `FIELD.sum0` | Returns the sum of numeric field _FIELD_ across all input rows. If all values are NULL, returns 0. | +| `FIELD.max` | Returns the maximum value of numeric field _FIELD_ across all input rows. | +| `FIELD.min` | Returns the minimum value of numeric field _FIELD_ across all input rows. | +| `FIELD.stddevPop` | Returns the population standard deviation of numeric field _FIELD_ across all input rows. | +| `FIELD.stddevSamp` | Returns the sample standard deviation of numeric field _FIELD_ across all input rows. | +| `FIELD.varPop` | Returns the population variance (square of the population standard deviation) of numeric field _FIELD_ across all input rows. | +| `FIELD.varSamp` | Returns the sample variance (square of the sample standard deviation) of numeric field _FIELD_ across all input rows. | +| `FIELD.collect` | Returns a multiset of _FIELD_ across all input rows. | - | Returns TRUE if _ANY_ is equal to a row returned by sub-query _TABLE_.**Note:** For streaming queries the operation is rewritten in a join and group operation. The required state to compute the query result might grow infinitely depending on the number of distinct input rows. Please provide a query configuration with valid retention interval to prevent excessive state size. See [Streaming Concepts](streaming.html) for details. | -| +## 日期格式说明符 -<figure class="highlight"> - -``` -ANY1.between(ANY2, ANY3) -``` - -</figure> - - | Returns TRUE if _ANY1_ is greater than or equal to _ANY2_ and less than or equal to _ANY3_. When either _ANY2_ or _ANY3_ is NULL, returns FALSE or UNKNOWN.E.g., `12.between(15, 12)` returns FALSE; `12.between(10, Null(Types.INT))` returns UNKNOWN; `12.between(Null(Types.INT), 10)` returns FALSE. | -| - -<figure class="highlight"> - -``` -ANY1.notBetween(ANY2, ANY3) -``` - -</figure> - - | Returns TRUE if _ANY1_ is less than _ANY2_ or greater than _ANY3_. When either _ANY2_ or _ANY3_ is NULL, returns TRUE or UNKNOWN.E.g., `12.notBetween(15, 12)` returns TRUE; `12.notBetween(Null(Types.INT), 15)` returns UNKNOWN; `12.notBetween(15, Null(Types.INT))` returns TRUE. | - -### 逻辑函数 - -* [**SQL**](#tab_SQL_1) -* [**Java**](#tab_java_1) -* [**Scala**](#tab_scala_1) - -| 逻辑函数 | 描述 | -| --- | --- | -| - -<figure class="highlight"> - -``` -boolean1 OR boolean2 -``` - -</figure> - - | 如果_boolean1_为TRUE或_boolean2_为TRUE,则返回TRUE。支持三值逻辑。例如,`TRUE OR UNKNOWN`返回TRUE。 | -| - -<figure class="highlight"> - -``` -boolean1 AND boolean2 -``` - -</figure> - - | 如果_boolean1_和_boolean2_都为TRUE,则返回TRUE。支持三值逻辑。例如,`TRUE AND UNKNOWN`返回UNKNOWN。 | -| - -<figure class="highlight"> - -``` -NOT boolean -``` - -</figure> - - | 如果_boolean_为FALSE,则返回TRUE ; 否则返回TRUE 。如果_boolean_为TRUE,则返回FALSE ; 如果_布尔_值为UNKNOWN,则返回UNKNOWN。 | -| - -<figure class="highlight"> - -``` -boolean IS FALSE -``` - -</figure> - - | 如果_boolean_为FALSE,则返回TRUE ; 否则返回TRUE 。如果_boolean_为TRUE或UNKNOWN,则返回FALSE 。 | -| - -<figure class="highlight"> - -``` -boolean IS NOT FALSE -``` - -</figure> - - | 如果_boolean_为TRUE或UNKNOWN,则返回TRUE;否则返回TRUE 。如果_boolean_为FALSE,则返回FALSE。 | -| - -<figure class="highlight"> - -``` -boolean IS TRUE -``` - -</figure> - - | 如果_boolean_为TRUE,则返回TRUE; 如果_boolean_为FALSE或UNKNOWN,则返回FALSE 。 | -| - -<figure class="highlight"> - -``` -boolean IS NOT TRUE -``` - -</figure> - - | 如果_boolean_为FALSE或UNKNOWN,则返回TRUE;否则返回TRUE 。如果_boolean_为FALSE,则返回FALSE。 | -| - -<figure class="highlight"> - -``` -boolean IS UNKNOWN -``` - -</figure> - - | 如果_boolean_是UNKNOWN,则返回TRUE ; 否则返回TRUE 。如果_boolean_为TRUE或FALSE,则返回FALSE。 | -| - -<figure class="highlight"> - -``` -boolean IS NOT UNKNOWN -``` - -</figure> - - | 如果_boolean_为TRUE或FALSE,则返回TRUE;否则返回TRUE 。如果_布尔_值为UNKNOWN,则返回FALSE 。 | - -| Logical functions | Description | -| --- | --- | -| - -<figure class="highlight"> - -``` -BOOLEAN1 || BOOLEAN2 -``` - -</figure> - - | Returns TRUE if _BOOLEAN1_ is TRUE or _BOOLEAN2_ is TRUE. Supports three-valued logic.E.g., `true || Null(BOOLEAN)` returns TRUE. | -| - -<figure class="highlight"> - -``` -BOOLEAN1 && BOOLEAN2 -``` - -</figure> - - | Returns TRUE if _BOOLEAN1_ and _BOOLEAN2_ are both TRUE. Supports three-valued logic.E.g., `true && Null(BOOLEAN)` returns UNKNOWN. | -| - -<figure class="highlight"> - -``` -!BOOLEAN -``` - -</figure> - - | Returns TRUE if _BOOLEAN_ is FALSE; returns FALSE if _BOOLEAN_ is TRUE; returns UNKNOWN if _BOOLEAN_ is UNKNOWN. | -| - -<figure class="highlight"> - -``` -BOOLEAN.isTrue -``` - -</figure> - - | Returns TRUE if _BOOLEAN_ is TRUE; returns FALSE if _BOOLEAN_ is FALSE or UNKNOWN. | -| - -<figure class="highlight"> - -``` -BOOLEAN.isFalse -``` - -</figure> - - | Returns TRUE if _BOOLEAN_ is FALSE; returns FALSE if _BOOLEAN_ is TRUE or UNKNOWN. | -| - -<figure class="highlight"> - -``` -BOOLEAN.isNotTrue -``` - -</figure> - - | Returns TRUE if _BOOLEAN_ is FALSE or UNKNOWN; returns FALSE if _BOOLEAN_ is FALSE. | -| - -<figure class="highlight"> - -``` -BOOLEAN.isNotFalse -``` - -</figure> - - | Returns TRUE if _BOOLEAN_ is TRUE or UNKNOWN; returns FALSE if _BOOLEAN_ is FALSE. | - -| Logical functions | Description | -| --- | --- | -| - -<figure class="highlight"> - -``` -BOOLEAN1 || BOOLEAN2 -``` - -</figure> - - | Returns TRUE if _BOOLEAN1_ is TRUE or _BOOLEAN2_ is TRUE. Supports three-valued logic.E.g., `true || Null(Types.BOOLEAN)` returns TRUE. | -| - -<figure class="highlight"> - -``` -BOOLEAN1 && BOOLEAN2 -``` - -</figure> - - | Returns TRUE if _BOOLEAN1_ and _BOOLEAN2_ are both TRUE. Supports three-valued logic.E.g., `true && Null(Types.BOOLEAN)` returns UNKNOWN. | -| - -<figure class="highlight"> - -``` -!BOOLEAN -``` - -</figure> - - | Returns TRUE if _BOOLEAN_ is FALSE; returns FALSE if _BOOLEAN_ is TRUE; returns UNKNOWN if _BOOLEAN_ is UNKNOWN. | -| - -<figure class="highlight"> - -``` -BOOLEAN.isTrue -``` - -</figure> - - | Returns TRUE if _BOOLEAN_ is TRUE; returns FALSE if _BOOLEAN_ is FALSE or UNKNOWN. | -| - -<figure class="highlight"> - -``` -BOOLEAN.isFalse -``` - -</figure> - - | Returns TRUE if _BOOLEAN_ is FALSE; returns FALSE if _BOOLEAN_ is TRUE or UNKNOWN. | -| - -<figure class="highlight"> - -``` -BOOLEAN.isNotTrue -``` - -</figure> - - | Returns TRUE if _BOOLEAN_ is FALSE or UNKNOWN; returns FALSE if _BOOLEAN_ is FALSE. | -| - -<figure class="highlight"> - -``` -BOOLEAN.isNotFalse -``` - -</figure> - - | Returns TRUE if _BOOLEAN_ is TRUE or UNKNOWN; returns FALSE if _BOOLEAN_ is FALSE. | - -### 算术函数 - -* [**SQL**](#tab_SQL_2) -* [**Java**](#tab_java_2) -* [**Scala**](#tab_scala_2) - -| 算术函数 | 描述 | -| --- | --- | -| - -<figure class="highlight"> - -``` -+ numeric -``` - -</figure> - - | 返回_数字_。 | -| - -<figure class="highlight"> - -``` -- numeric -``` - -</figure> - - | 返回负_数字_。 | -| - -<figure class="highlight"> - -``` -numeric1 + numeric2 -``` - -</figure> - - | 返回_numeric1_加上_numeric2_。 | -| - -<figure class="highlight"> - -``` -numeric1 - numeric2 -``` - -</figure> - - | 返回_numeric1_减去_numeric2_。 | -| - -<figure class="highlight"> - -``` -numeric1 * numeric2 -``` - -</figure> - - | 返回_numeric1_乘以_numeric2_。 | -| - -<figure class="highlight"> - -``` -numeric1 / numeric2 -``` - -</figure> - - | 返回_numeric1_除以_numeric2_。 | -| - -<figure class="highlight"> - -``` -POWER(numeric1, numeric2) -``` - -</figure> - - | 返回_numeric1_上升到_numeric2的幂_。 | -| - -<figure class="highlight"> - -``` -ABS(numeric) -``` - -</figure> - - | 返回_numeric_的绝对值。 | -| - -<figure class="highlight"> - -``` -MOD(numeric1, numeric2) -``` - -</figure> - - | 返回_numeric1_的余数(模数)除以_numeric2_。仅当_numeric1_为负数时,结果才为负数。 | -| - -<figure class="highlight"> - -``` -SQRT(numeric) -``` - -</figure> - - | 返回_数字的_平方根。 | -| - -<figure class="highlight"> - -``` -LN(numeric) -``` - -</figure> - - | 返回的自然对数(以e为底)_的数字_。 | -| - -<figure class="highlight"> - -``` -LOG10(numeric) -``` - -</figure> - - | 返回_数字_的基数10对数。 | -| - -<figure class="highlight"> - -``` -LOG2(numeric) -``` - -</figure> - - | 返回_数字_的基数2对数。 | -| - -<figure class="highlight"> - -``` -LOG(numeric2) -LOG(numeric1, numeric2) -``` - -</figure> - - | 使用一个参数调用时,返回_numeric2_的自然对数。当使用两个参数调用时,此函数将_numeric2_的对数返回到基数_numeric1_。**注意:**目前,_numeric2_必须大于0且_numeric1_必须大于1。 | -| - -<figure class="highlight"> - -``` -EXP(numeric) -``` - -</figure> - - | 返回e提升到_数字_的幂。 | -| - -<figure class="highlight"> - -``` -CEIL(numeric) -CEILING(numeric) -``` - -</figure> - - | 将_数字_向上舍入,并返回大于或等于_numeric_的最小_数字_。 | -| - -<figure class="highlight"> - -``` -FLOOR(numeric) -``` - -</figure> - - | 将_数字_向下舍入,并返回小于或等于_numeric_的最大_数字_。 | -| - -<figure class="highlight"> - -``` -SIN(numeric) -``` - -</figure> - - | 返回_数字_的正弦值。 | -| - -<figure class="highlight"> - -``` -COS(numeric) -``` - -</figure> - - | 返回_数字_的余弦值。 | -| - -<figure class="highlight"> - -``` -TAN(numeric) -``` - -</figure> - - | 返回_数字_的正切值。 | -| - -<figure class="highlight"> - -``` -COT(numeric) -``` - -</figure> - - | 返回_数字_的余切。 | -| - -<figure class="highlight"> - -``` -ASIN(numeric) -``` - -</figure> - - | 返回_数字的_反正弦值。 | -| - -<figure class="highlight"> - -``` -ACOS(numeric) -``` - -</figure> - - | 返回_数字的反_余弦值。 | -| - -<figure class="highlight"> - -``` -ATAN(numeric) -``` - -</figure> - - | 返回_数字的_反正切。 | -| - -<figure class="highlight"> - -``` -ATAN2(numeric1, numeric2) -``` - -</figure> - - | 返回坐标_(numeric1,numeric2)的_反正切。 | -| - -<figure class="highlight"> - -``` -DEGREES(numeric) -``` - -</figure> - - | 返回弧度_数字_的度数表示。 | -| - -<figure class="highlight"> - -``` -RADIANS(numeric) -``` - -</figure> - - | 返回度数_数字_的弧度表示。 | -| - -<figure class="highlight"> - -``` -SIGN(numeric) -``` - -</figure> - - | 返回_数字_的符号。 | -| - -<figure class="highlight"> - -``` -ROUND(numeric, integer) -``` - -</figure> - - | 返回舍入为_数字的__整数_小数_位数_。 | -| - -<figure class="highlight"> - -``` -PI -``` - -</figure> - - | 返回比pi更接近任何其他值的值。 | -| - -<figure class="highlight"> - -``` -E() -``` - -</figure> - - | 返回比e的任何其他值更接近的值。 | -| - -<figure class="highlight"> - -``` -RAND() -``` - -</figure> - - | 返回介于0.0(包括)和1.0(不包括)之间的伪随机双精度值。 | -| - -<figure class="highlight"> - -``` -RAND(integer) -``` - -</figure> - - | 使用初始种子_整数_返回介于0.0(含)和1.0(不包含)之间的伪随机双精度值。如果两个RAND函数具有相同的初始种子,则它们将返回相同的数字序列。 | -| - -<figure class="highlight"> - -``` -RAND_INTEGER(integer) -``` - -</figure> - - | 返回0(包括)和_整数_(不包括)之间的伪随机整数值。 | -| - -<figure class="highlight"> - -``` -RAND_INTEGER(integer1, integer2) -``` - -</figure> - - | 返回0(包括)之间的伪随机整数值和具有初始种子的指定值(不包括)。如果两个RAND_INTEGER函数具有相同的初始种子和绑定,则它们将返回相同的数字序列。 | -| - -<figure class="highlight"> - -``` -UUID() -``` - -</figure> - - | 根据RFC 4122类型4(伪随机生成的)UUID返回UUID(通用唯一标识符)字符串(例如,“3d3c68f7-f608-473f-b60c-b0c44ad4cc4e”)。使用加密强伪随机数生成器生成UUID。 | -| - -<figure class="highlight"> - -``` -BIN(integer) -``` - -</figure> - - | 以二进制格式返回_整数_的字符串表示形式。如果_integer_为NULL,则返回NULL。例如,`BIN(4)`返回'100'并`BIN(12)`返回'1100'。 | -| - -<figure class="highlight"> - -``` -HEX(numeric) -HEX(string) -``` - -</figure> - - | 返回整数_数值_的字符串表示形式或十六进制格式的_字符串_。如果参数为NULL,则返回NULL。例如,数字20导致“14”,数字100导致“64”,字符串“hello,world”导致“68656C6C6F2C776F726C64”。 | - -| Arithmetic functions | Description | -| --- | --- | -| - -<figure class="highlight"> - -``` -+ NUMERIC -``` - -</figure> - - | Returns _NUMERIC_. | -| - -<figure class="highlight"> - -``` -- NUMERIC -``` - -</figure> - - | Returns negative _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC1 + NUMERIC2 -``` - -</figure> - - | Returns _NUMERIC1_ plus _NUMERIC2_. | -| - -<figure class="highlight"> - -``` -NUMERIC1 - NUMERIC2 -``` - -</figure> - - | Returns _NUMERIC1_ minus _NUMERIC2_. | -| - -<figure class="highlight"> - -``` -NUMERIC1 * NUMERIC2 -``` - -</figure> - - | Returns _NUMERIC1_ multiplied by _NUMERIC2_. | -| - -<figure class="highlight"> - -``` -NUMERIC1 / NUMERIC2 -``` - -</figure> - - | Returns _NUMERIC1_ divided by _NUMERIC2_. | -| - -<figure class="highlight"> - -``` -NUMERIC1.power(NUMERIC2) -``` - -</figure> - - | Returns _NUMERIC1_ raised to the power of _NUMERIC2_. | -| - -<figure class="highlight"> - -``` -NUMERIC.abs() -``` - -</figure> - - | Returns the absolute value of _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC1 % NUMERIC2 -``` - -</figure> - - | Returns the remainder (modulus) of _NUMERIC1_ divided by _NUMERIC2_. The result is negative only if _numeric1_ is negative. | -| - -<figure class="highlight"> - -``` -NUMERIC.sqrt() -``` - -</figure> - - | Returns the square root of _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.ln() -``` - -</figure> - - | Returns the natural logarithm (base e) of _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.log10() -``` - -</figure> - - | Returns the base 10 logarithm of _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.log2() -``` - -</figure> - - | Returns the base 2 logarithm of _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC1.log() -NUMERIC1.log(NUMERIC2) -``` - -</figure> - - | When called without argument, returns the natural logarithm of _NUMERIC1_. When called with an argument, returns the logarithm of _NUMERIC1_ to the base _NUMERIC2_.**Note:** Currently, _NUMERIC1_ must be greater than 0 and _NUMERIC2_ must be greater than 1. | -| - -<figure class="highlight"> - -``` -NUMERIC.exp() -``` - -</figure> - - | Returns e raised to the power of _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.ceil() -``` - -</figure> - - | Rounds _NUMERIC_ up, and returns the smallest number that is greater than or equal to _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.floor() -``` - -</figure> - - | Rounds _NUMERIC_ down, and returns the largest number that is less than or equal to _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.sin() -``` - -</figure> - - | Returns the sine of _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.cos() -``` - -</figure> - - | Returns the cosine of _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.tan() -``` - -</figure> - - | Returns the tangent of _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.cot() -``` - -</figure> - - | Returns the cotangent of a _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.asin() -``` - -</figure> - - | Returns the arc sine of _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.acos() -``` - -</figure> - - | Returns the arc cosine of _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.atan() -``` - -</figure> - - | Returns the arc tangent of _NUMERIC_. | -| - -<figure class="highlight"> - -``` -atan2(NUMERIC1, NUMERIC2) -``` - -</figure> - - | Returns the arc tangent of a coordinate _(NUMERIC1, NUMERIC2)_. | -| - -<figure class="highlight"> - -``` -NUMERIC.degrees() -``` - -</figure> - - | Returns the degree representation of a radian _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.radians() -``` - -</figure> - - | Returns the radian representation of a degree _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.sign() -``` - -</figure> - - | Returns the signum of _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.round(INT) -``` - -</figure> - - | Returns a number rounded to _INT_ decimal places for _NUMERIC_. | -| - -<figure class="highlight"> - -``` -pi() -``` - -</figure> - - | Returns a value that is closer than any other values to pi. | -| - -<figure class="highlight"> - -``` -e() -``` - -</figure> - - | Returns a value that is closer than any other values to e. | -| - -<figure class="highlight"> - -``` -rand() -``` - -</figure> - - | Returns a pseudorandom double value between 0.0 (inclusive) and 1.0 (exclusive). | -| - -<figure class="highlight"> - -``` -rand(INTEGER) -``` - -</figure> - - | Returns a pseudorandom double value between 0.0 (inclusive) and 1.0 (exclusive) with an initial seed _INTEGER_. Two RAND functions will return identical sequences of numbers if they have the same initial seed. | -| - -<figure class="highlight"> - -``` -randInteger(INTEGER) -``` - -</figure> - - | Returns a pseudorandom integer value between 0 (inclusive) and _INTEGER_ (exclusive). | -| - -<figure class="highlight"> - -``` -randInteger(INTEGER1, INTEGER2) -``` - -</figure> - - | Returns a pseudorandom integer value between 0 (inclusive) and _INTEGER2_ (exclusive) with an initial seed _INTEGER1_. Two randInteger functions will return identical sequences of numbers if they have same initial seed and bound. | -| - -<figure class="highlight"> - -``` -uuid() -``` - -</figure> - - | Returns an UUID (Universally Unique Identifier) string (e.g., "3d3c68f7-f608-473f-b60c-b0c44ad4cc4e") according to RFC 4122 type 4 (pseudo randomly generated) UUID. The UUID is generated using a cryptographically strong pseudo random number generator. | -| - -<figure class="highlight"> - -``` -INTEGER.bin() -``` - -</figure> - - | Returns a string representation of _INTEGER_ in binary format. Returns NULL if _INTEGER_ is NULL.E.g., `4.bin()` returns "100" and `12.bin()` returns "1100". | -| - -<figure class="highlight"> - -``` -NUMERIC.hex() -STRING.hex() -``` - -</figure> - - | Returns a string representation of an integer _NUMERIC_ value or a _STRING_ in hex format. Returns NULL if the argument is NULL.E.g. a numeric 20 leads to "14", a numeric 100 leads to "64", a string "hello,world" leads to "68656C6C6F2C776F726C64". | - -| Arithmetic functions | Description | -| --- | --- | -| - -<figure class="highlight"> - -``` -+ NUMERIC -``` - -</figure> - - | Returns _NUMERIC_. | -| - -<figure class="highlight"> - -``` -- NUMERIC -``` - -</figure> - - | Returns negative _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC1 + NUMERIC2 -``` - -</figure> - - | Returns _NUMERIC1_ plus _NUMERIC2_. | -| - -<figure class="highlight"> - -``` -NUMERIC1 - NUMERIC2 -``` - -</figure> - - | Returns _NUMERIC1_ minus _NUMERIC2_. | -| - -<figure class="highlight"> - -``` -NUMERIC1 * NUMERIC2 -``` - -</figure> - - | Returns _NUMERIC1_ multiplied by _NUMERIC2_. | -| - -<figure class="highlight"> - -``` -NUMERIC1 / NUMERIC2 -``` - -</figure> - - | Returns _NUMERIC1_ divided by _NUMERIC2_. | -| - -<figure class="highlight"> - -``` -NUMERIC1.power(NUMERIC2) -``` - -</figure> - - | Returns _NUMERIC1_ raised to the power of _NUMERIC2_. | -| - -<figure class="highlight"> - -``` -NUMERIC.abs() -``` - -</figure> - - | Returns the absolute value of _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC1 % NUMERIC2 -``` - -</figure> - - | Returns the remainder (modulus) of _NUMERIC1_ divided by _NUMERIC2_. The result is negative only if _numeric1_ is negative. | -| - -<figure class="highlight"> - -``` -NUMERIC.sqrt() -``` - -</figure> - - | Returns the square root of _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.ln() -``` - -</figure> - - | Returns the natural logarithm (base e) of _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.log10() -``` - -</figure> - - | Returns the base 10 logarithm of _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.log2() -``` - -</figure> - - | Returns the base 2 logarithm of _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC1.log() -NUMERIC1.log(NUMERIC2) -``` - -</figure> - - | When called without argument, returns the natural logarithm of _NUMERIC1_. When called with an argument, returns the logarithm of _NUMERIC1_ to the base _NUMERIC2_.**Note:** Currently, _NUMERIC1_ must be greater than 0 and _NUMERIC2_ must be greater than 1. | -| - -<figure class="highlight"> - -``` -NUMERIC.exp() -``` - -</figure> - - | Returns e raised to the power of _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.ceil() -``` - -</figure> - - | Rounds _NUMERIC_ up, and returns the smallest number that is greater than or equal to _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.floor() -``` - -</figure> - - | Rounds _NUMERIC_ down, and returns the largest number that is less than or equal to _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.sin() -``` - -</figure> - - | Returns the sine of _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.cos() -``` - -</figure> - - | Returns the cosine of _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.tan() -``` - -</figure> - - | Returns the tangent of _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.cot() -``` - -</figure> - - | Returns the cotangent of a _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.asin() -``` - -</figure> - - | Returns the arc sine of _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.acos() -``` - -</figure> - - | Returns the arc cosine of _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.atan() -``` - -</figure> - - | Returns the arc tangent of _NUMERIC_. | -| - -<figure class="highlight"> - -``` -atan2(NUMERIC1, NUMERIC2) -``` - -</figure> - - | Returns the arc tangent of a coordinate _(NUMERIC1, NUMERIC2)_. | -| - -<figure class="highlight"> - -``` -NUMERIC.degrees() -``` - -</figure> - - | Returns the degree representation of a radian _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.radians() -``` - -</figure> - - | Returns the radian representation of a degree _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.sign() -``` - -</figure> - - | Returns the signum of _NUMERIC_. | -| - -<figure class="highlight"> - -``` -NUMERIC.round(INT) -``` - -</figure> - - | Returns a number rounded to _INT_ decimal places for _NUMERIC_. | -| - -<figure class="highlight"> - -``` -pi() -``` - -</figure> - - | Returns a value that is closer than any other values to pi. | -| - -<figure class="highlight"> - -``` -e() -``` - -</figure> - - | Returns a value that is closer than any other values to e. | -| - -<figure class="highlight"> - -``` -rand() -``` - -</figure> - - | Returns a pseudorandom double value between 0.0 (inclusive) and 1.0 (exclusive). | -| - -<figure class="highlight"> - -``` -rand(INTEGER) -``` - -</figure> - - | Returns a pseudorandom double value between 0.0 (inclusive) and 1.0 (exclusive) with an initial seed _INTEGER_. Two RAND functions will return identical sequences of numbers if they have the same initial seed. | -| - -<figure class="highlight"> - -``` -randInteger(INTEGER) -``` - -</figure> - - | Returns a pseudorandom integer value between 0 (inclusive) and _INTEGER_ (exclusive). | -| - -<figure class="highlight"> - -``` -randInteger(INTEGER1, INTEGER2) -``` - -</figure> - - | Returns a pseudorandom integer value between 0 (inclusive) and _INTEGER2_ (exclusive) with an initial seed _INTEGER1_. Two randInteger functions will return identical sequences of numbers if they have same initial seed and bound. | -| - -<figure class="highlight"> - -``` -uuid() -``` - -</figure> - - | Returns an UUID (Universally Unique Identifier) string (e.g., "3d3c68f7-f608-473f-b60c-b0c44ad4cc4e") according to RFC 4122 type 4 (pseudo randomly generated) UUID. The UUID is generated using a cryptographically strong pseudo random number generator. | -| - -<figure class="highlight"> - -``` -INTEGER.bin() -``` - -</figure> - - | Returns a string representation of _INTEGER_ in binary format. Returns NULL if _INTEGER_ is NULL.E.g., `4.bin()` returns "100" and `12.bin()` returns "1100". | -| - -<figure class="highlight"> - -``` -NUMERIC.hex() -STRING.hex() -``` - -</figure> - - | Returns a string representation of an integer _NUMERIC_ value or a _STRING_ in hex format. Returns NULL if the argument is NULL.E.g. a numeric 20 leads to "14", a numeric 100 leads to "64", a string "hello,world" leads to "68656C6C6F2C776F726C64". | - -### 字符串函数 - -* [**SQL**](#tab_SQL_3) -* [**Java**](#tab_java_3) -* [**Scala**](#tab_scala_3) - -| 字符串函数 | 描述 | -| --- | --- | -| - -<figure class="highlight"> - -``` -string1 || string2 -``` - -</figure> - - | 返回_string1_和_string2_的串联。 | -| - -<figure class="highlight"> - -``` -CHAR_LENGTH(string) -CHARACTER_LENGTH(string) -``` - -</figure> - - | 返回_string中_的字符数。 | -| - -<figure class="highlight"> - -``` -UPPER(string) -``` - -</figure> - - | 以大写形式返回_字符串_。 | -| - -<figure class="highlight"> - -``` -LOWER(string) -``` - -</figure> - - | 以小写形式返回_字符串_。 | -| - -<figure class="highlight"> - -``` -POSITION(string1 IN string2) -``` - -</figure> - - | 返回的第一次出现的位置(从1开始)_字符串1_在_字符串2_ ; 如果在_string2中_找不到_string1,_则返回0 。 | -| - -<figure class="highlight"> - -``` -TRIM([ BOTH | LEADING | TRAILING ] string1 FROM string2) -``` - -</figure> - - | 返回一个字符串,用于从_string2_中删除前导和/或尾随字符_string1_。默认情况下,两侧的空格都被删除。 | -| - -<figure class="highlight"> - -``` -LTRIM(string) -``` - -</figure> - - | 返回一个字符串,从去除左空格_的字符串_。例如,`LTRIM(' This is a test String.')`返回“This is a test String。”。 | -| - -<figure class="highlight"> - -``` -RTRIM(string) -``` - -</figure> - - | 返回一个字符串,从去除右方的空格_字符串_。例如,`RTRIM('This is a test String. ')`返回“This is a test String。”。 | -| - -<figure class="highlight"> - -``` -REPEAT(string, integer) -``` - -</figure> - - | 返回一个重复基本_字符串_ _整_数倍的_字符串_。例如,`REPEAT('This is a test String.', 2)`返回“这是一个测试字符串。这是一个测试字符串。”。 | -| - -<figure class="highlight"> - -``` -OVERLAY(string1 PLACING string2 FROM integer1 [ FOR integer2 ]) -``` - -</figure> - - | 返回替换字符串_整数2_(_字符串2_通过默认的长度)的字符_字符串1_与_字符串2_从位置_整数1_。例如,`OVERLAY('This is an old string' PLACING ' new' FROM 10 FOR 5)`返回“这是一个新字符串” | -| - -<figure class="highlight"> - -``` -SUBSTRING(string FROM integer1 [ FOR integer2 ]) -``` - -</figure> - - | 返回从位置_integer1_开始的_字符串_的子_字符串_,其长度为_integer2_(默认情况下为结尾)。 | -| - -<figure class="highlight"> - -``` -INITCAP(string) -``` - -</figure> - - | 返回一种新形式的_字符串_,每个单词的第一个字符转换为大写,其余字符转换为小写。这里的单词意味着一系列字母数字字符。 | -| - -<figure class="highlight"> - -``` -CONCAT(string1, string2,...) -``` - -</figure> - - | 返回连接_string1,string2,..._的字符串。如果任何参数为NULL,则返回NULL。例如,`CONCAT('AA', 'BB', 'CC')`返回“AABBCC”。 | -| - -<figure class="highlight"> - -``` -CONCAT_WS(string1, string2, string3,...) -``` - -</figure> - - | 返回一个字符串,用于将_string2,string3,..._与分隔符_string1连接起来_。在要连接的字符串之间添加分隔符。返回NULL如果_string1_为NULL。与之相比`CONCAT()`,`CONCAT_WS()`自动跳过NULL参数。例如,`CONCAT_WS('~', 'AA', NULL, 'BB', '', 'CC')`返回“AA~BB ~~ CC”。 | -| - -<figure class="highlight"> - -``` -LPAD(string1, integer, string2) -``` - -</figure> - - | 返回从_string1_左侧填充_string2_到_整数_字符长度的新字符串。如果_string1_的长度小于_整数_,则返回_string1_缩短为_整数_字符。例如,`LPAD('hi',4,'??')`返回“?? hi”; `LPAD('hi',1,'??')`返回“h”。 | -| - -<figure class="highlight"> - -``` -RPAD(string1, integer, string2) -``` - -</figure> - - | 返回从_string1_右侧填充_string2_到_整数_字符长度的新字符串。如果_string1_的长度小于_整数_,则返回_string1_缩短为_整数_字符。例如,`RPAD('hi',4,'??')`返回“hi ??”,`RPAD('hi',1,'??')`返回“h”。 | -| - -<figure class="highlight"> - -``` -FROM_BASE64(string) -``` - -</figure> - - | 返回_string_的base64解码结果; 如果_string_为NULL,则返回NULL。例如,`FROM_BASE64('aGVsbG8gd29ybGQ=')`返回“hello world”。 | -| - -<figure class="highlight"> - -``` -TO_BASE64(string) -``` - -</figure> - - | 从_string_返回base64编码的结果; 如果_string_为NULL,则返回NULL。例如,`TO_BASE64('hello world')`返回“aGVsbG8gd29ybGQ =”。 | - -| String functions | Description | -| --- | --- | -| - -<figure class="highlight"> - -``` -STRING1 + STRING2 -``` - -</figure> - - | Returns the concatenation of _STRING1_ and _STRING2_. | -| - -<figure class="highlight"> - -``` -STRING.charLength() -``` - -</figure> - - | Returns the number of characters in _STRING_. | -| - -<figure class="highlight"> - -``` -STRING.upperCase() -``` - -</figure> - - | Returns _STRING_ in uppercase. | -| - -<figure class="highlight"> - -``` -STRING.lowerCase() -``` - -</figure> - - | Returns _STRING_ in lowercase. | -| - -<figure class="highlight"> - -``` -STRING1.position(STRING2) -``` - -</figure> - - | Returns the position (start from 1) of the first occurrence of _STRING1_ in _STRING2_; returns 0 if _STRING1_ cannot be found in _STRING2_. | -| - -<figure class="highlight"> - -``` -STRING1.trim(LEADING, STRING2) -STRING1.trim(TRAILING, STRING2) -STRING1.trim(BOTH, STRING2) -STRING1.trim(BOTH) -STRING1.trim() -``` - -</figure> - - | Returns a string that removes leading and/or trailing characters _STRING2_ from _STRING1_. By default, whitespaces at both sides are removed. | -| - -<figure class="highlight"> - -``` -STRING.ltrim() -``` - -</figure> - - | Returns a string that removes the left whitespaces from _STRING_.E.g., `' This is a test String.'.ltrim()` returns "This is a test String.". | -| - -<figure class="highlight"> - -``` -STRING.rtrim() -``` - -</figure> - - | Returns a string that removes the right whitespaces from _STRING_.E.g., `'This is a test String. '.rtrim()` returns "This is a test String.". | -| - -<figure class="highlight"> - -``` -STRING.repeat(INT) -``` - -</figure> - - | Returns a string that repeats the base _STRING_ _INT_ times.E.g., `'This is a test String.'.repeat(2)` returns "This is a test String.This is a test String.". | -| - -<figure class="highlight"> - -``` -STRING1.overlay(STRING2, INT1) -STRING1.overlay(STRING2, INT1, INT2) -``` - -</figure> - - | Returns a string that replaces _INT2_ (_STRING2_'s length by default) characters of _STRING1_ with _STRING2_ from position _INT1_.E.g., `'xxxxxtest'.overlay('xxxx', 6)` returns "xxxxxxxxx"; `'xxxxxtest'.overlay('xxxx', 6, 2)` returns "xxxxxxxxxst". | -| - -<figure class="highlight"> - -``` -STRING.substring(INT1) -STRING.substring(INT1, INT2) -``` - -</figure> - - | Returns a substring of _STRING_ starting from position _INT1_ with length _INT2_ (to the end by default). | -| - -<figure class="highlight"> - -``` -STRING.initCap() -``` - -</figure> - - | Returns a new form of _STRING_ with the first character of each word converted to uppercase and the rest characters to lowercase. Here a word means a sequences of alphanumeric characters. | -| - -<figure class="highlight"> - -``` -concat(STRING1, STRING2, ...) -``` - -</figure> - - | Returns a string that concatenates _STRING1, STRING2, ..._. Returns NULL if any argument is NULL.E.g., `concat('AA', 'BB', 'CC')` returns "AABBCC". | -| - -<figure class="highlight"> - -``` -concat_ws(STRING1, STRING2, STRING3, ...) -``` - -</figure> - - | Returns a string that concatenates _STRING2, STRING3, ..._ with a separator _STRING1_. The separator is added between the strings to be concatenated. Returns NULL If _STRING1_ is NULL. Compared with `concat()`, `concat_ws()` automatically skips NULL arguments.E.g., `concat_ws('~', 'AA', Null(STRING), 'BB', '', 'CC')` returns "AA~BB~~CC". | -| - -<figure class="highlight"> - -``` -STRING1.lpad(INT, STRING2) -``` - -</figure> - - | Returns a new string from _STRING1_ left-padded with _STRING2_ to a length of _INT_ characters. If the length of _STRING1_ is shorter than _INT_, returns _STRING1_ shortened to _INT_ characters.E.g., `'hi'.lpad(4, '??')` returns "??hi"; `'hi'.lpad(1, '??')` returns "h". | -| - -<figure class="highlight"> - -``` -STRING1.rpad(INT, STRING2) -``` - -</figure> - - | Returns a new string from _STRING1_ right-padded with _STRING2_ to a length of _INT_ characters. If the length of _STRING1_ is shorter than _INT_, returns _STRING1_ shortened to _INT_ characters.E.g., `'hi'.rpad(4, '??')` returns "hi??"; `'hi'.rpad(1, '??')` returns "h". | -| - -<figure class="highlight"> - -``` -STRING.fromBase64() -``` - -</figure> - - | Returns the base64-decoded result from _STRING_; returns NULL if _STRING_ is NULL.E.g., `'aGVsbG8gd29ybGQ='.fromBase64()` returns "hello world". | -| - -<figure class="highlight"> - -``` -STRING.toBase64() -``` - -</figure> - - | Returns the base64-encoded result from _STRING_; returns NULL if _STRING_ is NULL.E.g., `'hello world'.toBase64()` returns "aGVsbG8gd29ybGQ=". | - -| String functions | Description | -| --- | --- | -| - -<figure class="highlight"> - -``` -STRING1 + STRING2 -``` - -</figure> - - | Returns the concatenation of _STRING1_ and _STRING2_. | -| - -<figure class="highlight"> - -``` -STRING.charLength() -``` - -</figure> - - | Returns the number of characters in _STRING_. | -| - -<figure class="highlight"> - -``` -STRING.upperCase() -``` - -</figure> - - | Returns _STRING_ in uppercase. | -| - -<figure class="highlight"> - -``` -STRING.lowerCase() -``` - -</figure> - - | Returns _STRING_ in lowercase. | -| - -<figure class="highlight"> - -``` -STRING1.position(STRING2) -``` - -</figure> - - | Returns the position (start from 1) of the first occurrence of _STRING1_ in _STRING2_; returns 0 if _STRING1_ cannot be found in _STRING2_. | -| - -<figure class="highlight"> - -``` -STRING.trim( - leading = true, - trailing = true, - character = " ") -``` - -</figure> - - | Returns a string that removes leading and/or trailing characters from _STRING_. | -| - -<figure class="highlight"> - -``` -STRING.ltrim() -``` - -</figure> - - | Returns a string that removes the left whitespaces from _STRING_.E.g., `" This is a test String.".ltrim()` returns "This is a test String.". | -| - -<figure class="highlight"> - -``` -STRING.rtrim() -``` - -</figure> - - | Returns a string that removes the right whitespaces from _STRING_.E.g., `"This is a test String. ".rtrim()` returns "This is a test String.". | -| - -<figure class="highlight"> - -``` -STRING.repeat(INT) -``` - -</figure> - - | Returns a string that repeats the base _STRING_ _INT_ times.E.g., `"This is a test String.".repeat(2)` returns "This is a test String.This is a test String.". | -| - -<figure class="highlight"> - -``` -STRING1.overlay(STRING2, INT1) -STRING1.overlay(STRING2, INT1, INT2) -``` - -</figure> - - | Returns a string that replaces _INT2_ (_STRING2_'s length by default) characters of _STRING1_ with _STRING2_ from position _INT1_.E.g., `"xxxxxtest".overlay("xxxx", 6)` returns "xxxxxxxxx"; `"xxxxxtest".overlay("xxxx", 6, 2)` returns "xxxxxxxxxst". | -| - -<figure class="highlight"> - -``` -STRING.substring(INT1) -STRING.substring(INT1, INT2) -``` - -</figure> - - | Returns a substring of _STRING_ starting from position _INT1_ with length _INT2_ (to the end by default). | -| - -<figure class="highlight"> - -``` -STRING.initCap() -``` - -</figure> - - | Returns a new form of _STRING_ with the first character of each word converted to uppercase and the rest characters to lowercase. Here a word means a sequences of alphanumeric characters. | -| - -<figure class="highlight"> - -``` -concat(STRING1, STRING2, ...) -``` - -</figure> - - | Returns a string that concatenates _STRING1, STRING2, ..._. Returns NULL if any argument is NULL.E.g., `concat("AA", "BB", "CC")` returns "AABBCC". | -| - -<figure class="highlight"> - -``` -concat_ws(STRING1, STRING2, STRING3, ...) -``` - -</figure> - - | Returns a string that concatenates _STRING2, STRING3, ..._ with a separator _STRING1_. The separator is added between the strings to be concatenated. Returns NULL If _STRING1_ is NULL. Compared with `concat()`, `concat_ws()` automatically skips NULL arguments.E.g., `concat_ws("~", "AA", Null(Types.STRING), "BB", "", "CC")` returns "AA~BB~~CC". | -| - -<figure class="highlight"> - -``` -STRING1.lpad(INT, STRING2) -``` - -</figure> - - | Returns a new string from _STRING1_ left-padded with _STRING2_ to a length of _INT_ characters. If the length of _STRING1_ is shorter than _INT_, returns _STRING1_ shortened to _INT_ characters.E.g., `"hi".lpad(4, "??")` returns "??hi"; `"hi".lpad(1, "??")` returns "h". | -| - -<figure class="highlight"> - -``` -STRING1.rpad(INT, STRING2) -``` - -</figure> - - | Returns a new string from _STRING1_ right-padded with _STRING2_ to a length of _INT_ characters. If the length of _STRING1_ is shorter than _INT_, returns _STRING1_ shortened to _INT_ characters.E.g., `"hi".rpad(4, "??")` returns "hi??"; `"hi".rpad(1, "??")` returns "h". | -| - -<figure class="highlight"> - -``` -STRING.fromBase64() -``` - -</figure> - - | Returns the base64-decoded result from _STRING_; returns null If _STRING_ is NULL.E.g., `"aGVsbG8gd29ybGQ=".fromBase64()` returns "hello world". | -| - -<figure class="highlight"> - -``` -STRING.toBase64() -``` - -</figure> - - | Returns the base64-encoded result from _STRING_; returns NULL if _STRING_ is NULL.E.g., `"hello world".toBase64()` returns "aGVsbG8gd29ybGQ=". | - -### 时间函数 - -* [**SQL**](#tab_SQL_4) -* [**Java**](#tab_java_4) -* [**Scala**](#tab_scala_4) - -| 时间函数 | 描述 | -| --- | --- | -| - -<figure class="highlight"> - -``` -DATE string -``` - -</figure> - - | 返回以“yyyy-MM-dd”形式从_字符串_解析的SQL日期。 | -| - -<figure class="highlight"> - -``` -TIME string -``` - -</figure> - - | 返回以“HH:mm:ss”形式从_字符串_解析的SQL时间。 | -| - -<figure class="highlight"> - -``` -TIMESTAMP string -``` - -</figure> - - | 返回以_字符串_形式解析的SQL时间戳,格式为“yyyy-MM-dd HH:mm:ss [.SSS]”。 | -| - -<figure class="highlight"> - -``` -INTERVAL string range -``` - -</figure> - - | 对于SQL间隔为毫秒,以“dd hh:mm:ss.fff”形式解析间隔_字符串_,对于SQL间隔月,解析“yyyy-mm”。的间隔范围可以是`DAY`,`MINUTE`,`DAY TO HOUR`,或`DAY TO SECOND`的毫秒时间间隔; `YEAR`或`YEAR TO MONTH`间隔数月。例如`INTERVAL '10 00:00:00.004' DAY TO SECOND`,`INTERVAL '10' DAY`或者`INTERVAL '2-10' YEAR TO MONTH`返回的时间间隔。 | -| - -<figure class="highlight"> - -``` -CURRENT_DATE -``` - -</figure> - - | 返回UTC时区中的当前SQL日期。 | -| - -<figure class="highlight"> - -``` -CURRENT_TIME -``` - -</figure> - - | 返回UTC时区中的当前SQL时间。 | -| - -<figure class="highlight"> - -``` -CURRENT_TIMESTAMP -``` - -</figure> - - | 返回UTC时区中的当前SQL时间戳。 | -| - -<figure class="highlight"> - -``` -LOCALTIME -``` - -</figure> - - | 返回本地时区的当前SQL时间。 | -| - -<figure class="highlight"> - -``` -LOCALTIMESTAMP -``` - -</figure> - - | 返回本地时区的当前SQL时间戳。 | -| - -<figure class="highlight"> - -``` -EXTRACT(timeintervalunit FROM temporal) -``` - -</figure> - - | 返回从_temporal_的_timeintervalitit_部分提取的long值。例如,`EXTRACT(DAY FROM DATE '2006-06-05')`返回5。 | -| - -<figure class="highlight"> - -``` -YEAR(date) -``` - -</figure> - - | 返回SQL日期_日期_的年份。相当于EXTRACT(从日期开始)。例如,`YEAR(DATE '1994-09-27')`返回1994年。 | -| - -<figure class="highlight"> - -``` -QUARTER(date) -``` - -</figure> - - | 从SQL返回日期一年的季度(1和4之间的整数)_日期_。相当于`EXTRACT(QUARTER FROM date)`。例如,`QUARTER(DATE '1994-09-27')`返回3。 | -| - -<figure class="highlight"> - -``` -MONTH(date) -``` - -</figure> - - | 从SQL日期_日期_返回一年中的月份(1到12之间的整数)。相当于`EXTRACT(MONTH FROM date)`。例如,`MONTH(DATE '1994-09-27')`返回9。 | -| - -<figure class="highlight"> - -``` -WEEK(date) -``` - -</figure> - - | 从SQL date _日期_返回一年中的一周(1到53之间的整数)。相当于`EXTRACT(WEEK FROM date)`。例如,`WEEK(DATE '1994-09-27')`返回39。 | -| - -<figure class="highlight"> - -``` -DAYOFYEAR(date) -``` - -</figure> - - | 返回一年的从SQL日期当天(1和366之间的整数)_日期_。相当于`EXTRACT(DOY FROM date)`。例如,`DAYOFYEAR(DATE '1994-09-27')`返回270。 | -| - -<figure class="highlight"> - -``` -DAYOFMONTH(date) -``` - -</figure> - - | 从SQL日期_日期_返回一个月中的某一天(1到31之间的整数)。相当于`EXTRACT(DAY FROM date)`。例如,`DAYOFMONTH(DATE '1994-09-27')`返回27。 | -| - -<figure class="highlight"> - -``` -DAYOFWEEK(date) -``` - -</figure> - - | 从SQL date _date_返回一周中的星期几(1到7之间的整数;星期日= 1)`EXTRACT(DOW FROM date)`。等效于。例如,`DAYOFWEEK(DATE '1994-09-27')`返回3。 | -| - -<figure class="highlight"> - -``` -HOUR(timestamp) -``` - -</figure> - - | 从SQL时间_戳记时间戳_返回一天中的小时(0到23之间的整数)。相当于`EXTRACT(HOUR FROM timestamp)`。例如,`HOUR(TIMESTAMP '1994-09-27 13:14:15')`返回13。 | -| - -<figure class="highlight"> - -``` -MINUTE(timestamp) -``` - -</figure> - - | 从SQL时间_戳记时间戳_返回一小时的分钟(0到59之间的整数)。相当于`EXTRACT(MINUTE FROM timestamp)`。例如,`MINUTE(TIMESTAMP '1994-09-27 13:14:15')`返回14。 | -| - -<figure class="highlight"> - -``` -SECOND(timestamp) -``` - -</figure> - - | 从SQL时间戳返回第二分钟(0到59之间的整数)。相当于`EXTRACT(SECOND FROM timestamp)`。例如,`SECOND(TIMESTAMP '1994-09-27 13:14:15')`返回15。 | -| - -<figure class="highlight"> - -``` -FLOOR(timepoint TO timeintervalunit) -``` - -</figure> - - | 返回将_时间点_向下_舍_入到时间单位_timeintervalunit的值_。例如,`FLOOR(TIME '12:44:31' TO MINUTE)`返回12:44:00。 | -| - -<figure class="highlight"> - -``` -CEIL(timepoint TO timeintervalunit) -``` - -</figure> - - | 返回一个将_时间点__舍_入到时间单位_timeintervalunit的值_。例如,`CEIL(TIME '12:44:31' TO MINUTE)`返回12:45:00。 | -| - -<figure class="highlight"> - -``` -(timepoint1, temporal1) OVERLAPS (timepoint2, temporal2) -``` - -</figure> - - | 如果由(_timepoint1_,_temporal1_)和(_timepoint2_,_temporal2_)定义的两个时间间隔重叠,则返回TRUE 。时间值可以是时间点或时间间隔。例如,`(TIME '2:55:00', INTERVAL '1' HOUR) OVERLAPS (TIME '3:30:00', INTERVAL '2' HOUR)`返回TRUE; `(TIME '9:00:00', TIME '10:00:00') OVERLAPS (TIME '10:15:00', INTERVAL '3' HOUR)`返回FALSE。 | -| - -<figure class="highlight"> - -``` -DATE_FORMAT(timestamp, string) -``` - -</figure> - - | 返回使用指定格式_字符串_格式化_时间戳的__字符串_。格式规范在[Date Format Specifier表中给出](#date-format-specifiers)。 | -| - -<figure class="highlight"> - -``` -TIMESTAMPADD(unit, interval, timevalue) -``` - -</figure> - - | 返回一个新的时间值,它将(带符号)整数时间间隔添加到_timevalue_。为单位_的时间间隔_是由单元参数,它应为以下值中的一个给定的:`SECOND`,`MINUTE`,`HOUR`,`DAY`,`WEEK`,`MONTH`,`QUARTER`,或`YEAR`。例如,`TIMESTAMPADD(WEEK, 1, DATE '2003-01-02')`退货`2003-01-09`。 | - -| Temporal functions | Description | -| --- | --- | -| - -<figure class="highlight"> - -``` -STRING.toDate() -``` - -</figure> - - | Returns a SQL date parsed from _STRING_ in form of "yyyy-MM-dd". | -| - -<figure class="highlight"> - -``` -STRING.toTime() -``` - -</figure> - - | Returns a SQL time parsed from _STRING_ in form of "HH:mm:ss". | -| - -<figure class="highlight"> - -``` -STRING.toTimestamp() -``` - -</figure> - - | Returns a SQL timestamp parsed from _STRING_ in form of "yyyy-MM-dd HH:mm:ss[.SSS]". | -| - -<figure class="highlight"> - -``` -NUMERIC.year -NUMERIC.years -``` - -</figure> - - | Creates an interval of months for _NUMERIC_ years. | -| - -<figure class="highlight"> - -``` -NUMERIC.month -NUMERIC.months -``` - -</figure> - - | Creates an interval of _NUMERIC_ months. | -| - -<figure class="highlight"> - -``` -NUMERIC.day -NUMERIC.days -``` - -</figure> - - | Creates an interval of milliseconds for _NUMERIC_ days. | -| - -<figure class="highlight"> - -``` -NUMERIC.hour -NUMERIC.hours -``` - -</figure> - - | Creates an interval of milliseconds for _NUMERIC_ hours. | -| - -<figure class="highlight"> - -``` -NUMERIC.minute -NUMERIC.minutes -``` - -</figure> - - | Creates an interval of milliseconds for _NUMERIC_ minutes. | -| - -<figure class="highlight"> - -``` -NUMERIC.second -NUMERIC.seconds -``` - -</figure> - - | Creates an interval of milliseconds for _NUMERIC_ seconds. | -| - -<figure class="highlight"> - -``` -NUMERIC.milli -NUMERIC.millis -``` - -</figure> - - | Creates an interval of _NUMERIC_ milliseconds. | -| - -<figure class="highlight"> - -``` -currentDate() -``` - -</figure> - - | Returns the current SQL date in the UTC time zone. | -| - -<figure class="highlight"> - -``` -currentTime() -``` - -</figure> - - | Returns the current SQL time in the UTC time zone. | -| - -<figure class="highlight"> - -``` -currentTimestamp() -``` - -</figure> - - | Returns the current SQL timestamp in the UTC time zone. | -| - -<figure class="highlight"> - -``` -localTime() -``` - -</figure> - - | Returns the current SQL time in local time zone. | -| - -<figure class="highlight"> - -``` -localTimestamp() -``` - -</figure> - - | Returns the current SQL timestamp in local time zone. | -| - -<figure class="highlight"> - -``` -TEMPORAL.extract(TIMEINTERVALUNIT) -``` - -</figure> - - | Returns a long value extracted from the _TIMEINTERVALUNIT_ part of _temporal_.E.g., `'2006-06-05'.toDate.extract(DAY)` returns 5; `'2006-06-05'.toDate.extract(QUARTER)` returns 2. | -| - -<figure class="highlight"> - -``` -TIMEPOINT.floor(TIMEINTERVALUNIT) -``` - -</figure> - - | Returns a value that rounds _TIMEPOINT_ down to the time unit _TIMEINTERVALUNIT_.E.g., `'12:44:31'.toDate.floor(MINUTE)` returns 12:44:00. | -| - -<figure class="highlight"> - -``` -TIMEPOINT.ceil(TIMEINTERVALUNIT) -``` - -</figure> - - | Returns a value that rounds _TIMEPOINT_ up to the time unit _TIMEINTERVALUNIT_.E.g., `'12:44:31'.toTime.floor(MINUTE)` returns 12:45:00. | -| - -<figure class="highlight"> - -``` -temporalOverlaps(TIMEPOINT1, TEMPORAL1, TIMEPOINT2, TEMPORAL2) -``` - -</figure> - - | Returns TRUE if two time intervals defined by (_TIMEPOINT1_, _TEMPORAL1_) and (_TIMEPOINT2_, _TEMPORAL2_) overlap. The temporal values could be either a time point or a time interval.E.g., `temporalOverlaps('2:55:00'.toTime, 1.hour, '3:30:00'.toTime, 2.hour)` returns TRUE. | -| - -<figure class="highlight"> - -``` -dateFormat(TIMESTAMP, STRING) -``` - -</figure> - - | Returns a string that formats _TIMESTAMP_ with a specified format _STRING_. The format specification is given in the [Date Format Specifier table](#date-format-specifiers).E.g., `dateFormat(ts, '%Y, %d %M')` results in strings formatted as "2017, 05 May". | - -| Temporal functions | Description | -| --- | --- | -| - -<figure class="highlight"> - -``` -STRING.toDate -``` - -</figure> - - | Returns a SQL date parsed from _STRING_ in form of "yyyy-MM-dd". | -| - -<figure class="highlight"> - -``` -STRING.toTime -``` - -</figure> - - | Returns a SQL time parsed from _STRING_ in form of "HH:mm:ss". | -| - -<figure class="highlight"> - -``` -STRING.toTimestamp -``` - -</figure> - - | Returns a SQL timestamp parsed from _STRING_ in form of "yyyy-MM-dd HH:mm:ss[.SSS]". | -| - -<figure class="highlight"> - -``` -NUMERIC.year -NUMERIC.years -``` - -</figure> - - | Creates an interval of months for _NUMERIC_ years. | -| - -<figure class="highlight"> - -``` -NUMERIC.month -NUMERIC.months -``` - -</figure> - - | Creates an interval of _NUMERIC_ months. | -| - -<figure class="highlight"> - -``` -NUMERIC.day -NUMERIC.days -``` - -</figure> - - | Creates an interval of milliseconds for _NUMERIC_ days. | -| - -<figure class="highlight"> - -``` -NUMERIC.hour -NUMERIC.hours -``` - -</figure> - - | Creates an interval of milliseconds for _NUMERIC_ hours. | -| - -<figure class="highlight"> - -``` -NUMERIC.minute -NUMERIC.minutes -``` - -</figure> - - | Creates an interval of milliseconds for _NUMERIC_ minutes. | -| - -<figure class="highlight"> - -``` -NUMERIC.second -NUMERIC.seconds -``` - -</figure> - - | Creates an interval of milliseconds for _NUMERIC_ seconds. | -| - -<figure class="highlight"> - -``` -NUMERIC.milli -NUMERIC.millis -``` - -</figure> - - | Creates an interval of _NUMERIC_ milliseconds. | -| - -<figure class="highlight"> - -``` -currentDate() -``` - -</figure> - - | Returns the current SQL date in the UTC time zone. | -| - -<figure class="highlight"> - -``` -currentTime() -``` - -</figure> - - | Returns the current SQL time in the UTC time zone. | -| - -<figure class="highlight"> - -``` -currentTimestamp() -``` - -</figure> - - | Returns the current SQL timestamp in the UTC time zone. | -| - -<figure class="highlight"> - -``` -localTime() -``` - -</figure> - - | Returns the current SQL time in local time zone. | -| - -<figure class="highlight"> - -``` -localTimestamp() -``` - -</figure> - - | Returns the current SQL timestamp in local time zone. | -| - -<figure class="highlight"> - -``` -TEMPORAL.extract(TIMEINTERVALUNIT) -``` - -</figure> - - | Returns a long value extracted from the _TIMEINTERVALUNIT_ part of _temporal_.E.g., `"2006-06-05".toDate.extract(TimeIntervalUnit.DAY)` returns 5; `"2006-06-05".toDate.extract(QUARTER)` returns 2. | -| - -<figure class="highlight"> - -``` -TIMEPOINT.floor(TIMEINTERVALUNIT) -``` - -</figure> - - | Returns a value that rounds _TIMEPOINT_ down to the time unit _TIMEINTERVALUNIT_.E.g., `"12:44:31".toDate.floor(TimeIntervalUnit.MINUTE)` returns 12:44:00. | -| - -<figure class="highlight"> - -``` -TIMEPOINT.ceil(TIMEINTERVALUNIT) -``` - -</figure> - - | Returns a value that rounds _TIMEPOINT_ up to the time unit _TIMEINTERVALUNIT_.E.g., `"12:44:31".toTime.floor(TimeIntervalUnit.MINUTE)` returns 12:45:00. | -| - -<figure class="highlight"> - -``` -temporalOverlaps(TIMEPOINT1, TEMPORAL1, TIMEPOINT2, TEMPORAL2) -``` - -</figure> - - | Returns TRUE if two time intervals defined by (_TIMEPOINT1_, _TEMPORAL1_) and (_TIMEPOINT2_, _TEMPORAL2_) overlap. The temporal values could be either a time point or a time interval.E.g., `temporalOverlaps("2:55:00".toTime, 1.hour, "3:30:00".toTime, 2.hour)` returns TRUE. | -| - -<figure class="highlight"> - -``` -dateFormat(TIMESTAMP, STRING) -``` - -</figure> - - | Returns a string that formats _TIMESTAMP_ with a specified format _STRING_. The format specification is given in the [Date Format Specifier table](#date-format-specifiers).E.g., `dateFormat('ts, "%Y, %d %M")` results in strings formatted as "2017, 05 May". | - -### 条件函数 - -* [**SQL**](#tab_SQL_5) -* [**Java**](#tab_java_5) -* [**Scala**](#tab_scala_5) - -| 条件函数 | 描述 | -| --- | --- | -| - -<figure class="highlight"> - -``` -CASE value -WHEN value1_1 [, value1_2 ]* THEN result1 -[ WHEN value2_1 [, value2_2 ]* THEN result2 ]* -[ ELSE resultZ ] -END -``` - -</figure> - - | 当第一个时间_值_包含在(_valueX_1,valueX_2,..._)中时返回_resultX_。如果没有值匹配,则返回_resultZ(_如果已提供),否则返回NULL。 | -| - -<figure class="highlight"> - -``` -CASE -WHEN condition1 THEN result1 -[ WHEN condition2 THEN result2 ]* -[ ELSE resultZ ] -END -``` - -</figure> - - | 满足第一个_conditionX_时返回_resultX_。如果没有满足条件,则返回_resultZ(_如果已提供),否则返回NULL。 | -| - -<figure class="highlight"> - -``` -NULLIF(value1, value2) -``` - -</figure> - - | 如果_value1_等于_value2_,则返回NULL ; 否则返回_value1_。例如,`NULLIF(5, 5)`返回NULL; `NULLIF(5, 0)`返回5。 | -| - -<figure class="highlight"> - -``` -COALESCE(value1, value2 [, value3 ]* ) -``` - -</figure> - - | 从_value1,value2,..._返回非NULL的第一个值。例如,`COALESCE(NULL, 5)`返回5。 | - -| Conditional functions | Description | -| --- | --- | -| - -<figure class="highlight"> - -``` -BOOLEAN.?(VALUE1, VALUE2) -``` - -</figure> - - | Returns _VALUE1_ if _BOOLEAN_ evaluates to TRUE; returns _VALUE2_ otherwise.E.g., `(42 > 5).?('A', 'B')` returns "A". | - -| Conditional functions | Description | -| --- | --- | -| - -<figure class="highlight"> - -``` -BOOLEAN.?(VALUE1, VALUE2) -``` - -</figure> - - | Returns _VALUE1_ if _BOOLEAN_ evaluates to TRUE; returns _VALUE2_ otherwise.E.g., `(42 > 5).?("A", "B")` returns "A". | - -### 类型转换函数 - -* [**SQL**](#tab_SQL_6) -* [**Java**](#tab_java_6) -* [**Scala**](#tab_scala_6) - -| 类型转换函数 | 描述 | -| --- | --- | -| - -<figure class="highlight"> - -``` -CAST(value AS type) -``` - -</figure> - - | 返回要转换为类型_类型_的新_值_。请在[此处](sql.html#data-types)查看支持的类型。[](sql.html#data-types)例如,`CAST('42' AS INT)`返回42。 | - -| Type conversion functions | Description | -| --- | --- | -| - -<figure class="highlight"> - -``` -ANY.cast(TYPE) -``` - -</figure> - - | Returns a new _ANY_ being cast to type _TYPE_. See the supported types [here](tableApi.html#data-types).E.g., `'42'.cast(INT)` returns 42. | - -| Type conversion functions | Description | -| --- | --- | -| - -<figure class="highlight"> - -``` -ANY.cast(TYPE) -``` - -</figure> - - | Returns a new _ANY_ being cast to type _TYPE_. See the supported types [here](tableApi.html#data-types).E.g., `"42".cast(Types.INT)` returns 42. | - -### 收集函数 - -* [**SQL**](#tab_SQL_7) -* [**Java**](#tab_java_7) -* [**Scala**](#tab_scala_7) - -| 收集函数 | 描述 | -| --- | --- | -| - -<figure class="highlight"> - -``` -CARDINALITY(array) -``` - -</figure> - - | 返回_数组中_的数据元数。 | -| - -<figure class="highlight"> - -``` -array ‘[’ integer ‘]’ -``` - -</figure> - - | 在返回位置处的数据元_整数_在_阵列_。索引从1开始。 | -| - -<figure class="highlight"> - -``` -ELEMENT(array) -``` - -</figure> - - | 返回_数组_的唯一数据元(其基数应为1); 如果_数组_为空,则返回NULL 。如果_数组_有多个数据元,则抛出异常。 | -| - -<figure class="highlight"> - -``` -CARDINALITY(map) -``` - -</figure> - - | 返回_map中_的条目数。 | -| - -<figure class="highlight"> - -``` -map ‘[’ value ‘]’ -``` - -</figure> - - | 返回键指定的值,_值_的_Map_。 | - -| Collection functions | Description | -| --- | --- | -| - -<figure class="highlight"> - -``` -ARRAY.cardinality() -``` - -</figure> - - | Returns the number of elements in _ARRAY_. | -| - -<figure class="highlight"> - -``` -ARRAY.at(INT) -``` - -</figure> - - | Returns the element at position _INT_ in _ARRAY_. The index starts from 1. | -| - -<figure class="highlight"> - -``` -ARRAY.element() -``` - -</figure> - - | Returns the sole element of _ARRAY_ (whose cardinality should be one); returns NULL if _ARRAY_ is empty. Throws an exception if _ARRAY_ has more than one element. | -| - -<figure class="highlight"> - -``` -MAP.cardinality() -``` - -</figure> - - | Returns the number of entries in _MAP_. | -| - -<figure class="highlight"> - -``` -MAP.at(ANY) -``` - -</figure> - - | Returns the value specified by key _ANY_ in _MAP_. | - -| Collection functions | Description | -| --- | --- | -| - -<figure class="highlight"> - -``` -ARRAY.cardinality() -``` - -</figure> - - | Returns the number of elements in _ARRAY_. | -| - -<figure class="highlight"> - -``` -ARRAY.at(INT) -``` - -</figure> - - | Returns the element at position _INT_ in _ARRAY_. The index starts from 1. | -| - -<figure class="highlight"> - -``` -ARRAY.element() -``` - -</figure> - - | Returns the sole element of _ARRAY_ (whose cardinality should be one); returns NULL if _ARRAY_ is empty. Throws an exception if _ARRAY_ has more than one element. | -| - -<figure class="highlight"> - -``` -MAP.cardinality() -``` - -</figure> - - | Returns the number of entries in _MAP_. | -| - -<figure class="highlight"> - -``` -MAP.at(ANY) -``` - -</figure> - - | Returns the value specified by key _ANY_ in _MAP_. | - -### Value构建函数 - -* [**SQL**](#tab_SQL_8) -* [**Java**](#tab_java_8) -* [**Scala**](#tab_scala_8) - -| Value建构函数 | 描述 | -| --- | --- | -| - -<figure class="highlight"> - -``` -ROW(value1, [, value2]*) -(value1, [, value2]*) -``` - -</figure> - - | 返回从值列表(_value1,value2,_ ...)创建的行。 | -| - -<figure class="highlight"> - -``` -ARRAY ‘[’ value1 [, value2 ]* ‘]’ -``` - -</figure> - - | 返回从值列表(_value1,value2_,...)创建的数组。 | -| - -<figure class="highlight"> - -``` -MAP ‘[’ value1, value2 [, value3, value4 ]* ‘]’ -``` - -</figure> - - | 返回从键值对列表((_value1,value2_),_(value3,value4)_,...)创建的映射。 | - -| Value constructor functions | Description | -| --- | --- | -| - -<figure class="highlight"> - -``` -row(ANY1, ANY2, ...) -``` - -</figure> - - | Returns a row created from a list of object values (_ANY1, ANY2_, ...). Row is composite type that can be access via [value access functions](#value-access-functions). | -| - -<figure class="highlight"> - -``` -array(ANY1, ANY2, ...) -``` - -</figure> - - | Returns an array created from a list of object values (_ANY1, ANY2_, ...). | -| - -<figure class="highlight"> - -``` -map(ANY1, ANY2, ANY3, ANY4, ...) -``` - -</figure> - - | Returns a map created from a list of key-value pairs ((_ANY1, ANY2_), _(ANY3, ANY4)_, ...). | -| - -<figure class="highlight"> - -``` -NUMERIC.rows -``` - -</figure> - - | Creates a _NUMERIC_ interval of rows (commonly used in window creation). | - -| Value constructor functions | Description | -| --- | --- | -| - -<figure class="highlight"> - -``` -row(ANY1, ANY2, ...) -``` - -</figure> - - | Returns a row created from a list of object values (_ANY1, ANY2_, ...). Row is composite type that can be access via [value access functions](#value-access-functions). | -| - -<figure class="highlight"> - -``` -array(ANY1, ANY2, ...) -``` - -</figure> - - | Returns an array created from a list of object values (_ANY1, ANY2_, ...). | -| - -<figure class="highlight"> - -``` -map(ANY1, ANY2, ANY3, ANY4, ...) -``` - -</figure> - - | Returns a map created from a list of key-value pairs ((_ANY1, ANY2_), _(ANY3, ANY4)_, ...). | -| - -<figure class="highlight"> - -``` -NUMERIC.rows -``` - -</figure> - - | Creates a _NUMERIC_ interval of rows (commonly used in window creation). | - -### Value访问函数 - -* [**SQL**](#tab_SQL_9) -* [**Java**](#tab_java_9) -* [**Scala**](#tab_scala_9) - -| Value访问函数 | 描述 | -| --- | --- | -| - -<figure class="highlight"> - -``` -tableName.compositeType.field -``` - -</figure> - - | 按名称从Flink复合类型(例如,Tuple,POJO)返回字段的值。 | -| - -<figure class="highlight"> - -``` -tableName.compositeType.* -``` - -</figure> - - | 返回Flink复合类型(例如,Tuple,POJO)的平面表示,该复合类型将其每个直接子类型转换为单独的字段。在大多数情况下,平面表示的字段与原始字段的命名方式类似,但使用美元分隔符(例如`mypojo$mytuple$f0`)。 | - -| Value access functions | Description | -| --- | --- | -| - -<figure class="highlight"> - -``` -COMPOSITE.get(STRING) -COMPOSITE.get(INT) -``` - -</figure> - - | Returns the value of a field from a Flink composite type (e.g., Tuple, POJO) by name or index.E.g., `pojo.get('myField')` or `tuple.get(0)`. | -| - -<figure class="highlight"> - -``` -ANY.flatten() -``` - -</figure> - - | Returns a flat representation of a Flink composite type (e.g., Tuple, POJO) that converts each of its direct subtype into a separate field. In most cases the fields of the flat representation are named similarly to the original fields but with a dollar separator (e.g., `mypojo$mytuple$f0`). | - -| Value access functions | Description | -| --- | --- | -| - -<figure class="highlight"> - -``` -COMPOSITE.get(STRING) -COMPOSITE.get(INT) -``` - -</figure> - - | Returns the value of a field from a Flink composite type (e.g., Tuple, POJO) by name or index.E.g., `'pojo.get("myField")` or `'tuple.get(0)`. | -| - -<figure class="highlight"> - -``` -ANY.flatten() -``` - -</figure> - - | Returns a flat representation of a Flink composite type (e.g., Tuple, POJO) that converts each of its direct subtype into a separate field. In most cases the fields of the flat representation are named similarly to the original fields but with a dollar separator (e.g., `mypojo$mytuple$f0`). | - -### 分组函数 - -* [**SQL**](#tab_SQL_10) -* [**Java**](#tab_Java_10) -* [**Scala**](#tab_Scala_10) - -| 分组函数 | 描述 | -| --- | --- | -| - -<figure class="highlight"> - -``` -GROUP_ID() -``` - -</figure> - - | 返回唯一标识分组键组合的整数。 | -| - -<figure class="highlight"> - -``` -GROUPING(expression1 [, expression2]* ) -GROUPING_ID(expression1 [, expression2]* ) -``` - -</figure> - - | 返回给定分组表达式的位向量。 | - -| Grouping functions | Description | -| --- | --- | - -| Grouping functions | Description | -| --- | --- | - -### 散列函数 - -* [**SQL**](#tab_SQL_11) -* [**Java**](#tab_java_11) -* [**Scala**](#tab_scala_11) - -| 散列函数 | 描述 | -| --- | --- | -| - -<figure class="highlight"> - -``` -MD5(string) -``` - -</figure> - - | 将_字符串_的MD5哈希值作为32个十六进制数字的_字符串_返回; 如果_string_为NULL,则返回NULL。 | -| - -<figure class="highlight"> - -``` -SHA1(string) -``` - -</figure> - - | 以40个十六进制数字的_字符串_形式返回_字符串_的SHA-1哈希值; 如果_string_为NULL,则返回NULL。 | -| - -<figure class="highlight"> - -``` -SHA224(string) -``` - -</figure> - - | 返回_字符串_的SHA-224哈希值,作为56个十六进制数字的字符串; 如果_string_为NULL,则返回NULL。 | -| - -<figure class="highlight"> - -``` -SHA256(string) -``` - -</figure> - - | 以64个十六进制数字的_字符串_形式返回_字符串_的SHA-256哈希值; 如果_string_为NULL,则返回NULL。 | -| - -<figure class="highlight"> - -``` -SHA384(string) -``` - -</figure> - - | 返回_字符串_的SHA-384哈希值,作为96个十六进制数字的字符串; 如果_string_为NULL,则返回NULL。 | -| - -<figure class="highlight"> - -``` -SHA512(string) -``` - -</figure> - - | 返回_字符串_的SHA-512哈希值,作为128个十六进制数字的字符串; 如果_string_为NULL,则返回NULL。 | -| - -<figure class="highlight"> - -``` -SHA2(string, hashLength) -``` - -</figure> - - | 使用SHA-2系列散列函数(SHA-224,SHA-256,SHA-384或SHA-512)返回散列。第一个参数_字符串_是要散列的字符串,第二个参数_hashLength_是结果的位长度(_224,256,384_或512)。如果_string_或_hashLength_为NULL,则返回NULL。 | - -| Hash functions | Description | -| --- | --- | -| - -<figure class="highlight"> - -``` -STRING.md5() -``` - -</figure> - - | Returns the MD5 hash of _STRING_ as a string of 32 hexadecimal digits; returns NULL if _STRING_ is NULL. | -| - -<figure class="highlight"> - -``` -STRING.sha1() -``` - -</figure> - - | Returns the SHA-1 hash of _STRING_ as a string of 40 hexadecimal digits; returns NULL if _STRING_ is NULL. | -| - -<figure class="highlight"> - -``` -STRING.sha224() -``` - -</figure> - - | Returns the SHA-224 hash of _STRING_ as a string of 56 hexadecimal digits; returns NULL if _STRING_ is NULL. | -| - -<figure class="highlight"> - -``` -STRING.sha256() -``` - -</figure> - - | Returns the SHA-256 hash of _STRING_ as a string of 64 hexadecimal digits; returns NULL if _STRING_ is NULL. | -| - -<figure class="highlight"> - -``` -STRING.sha384() -``` - -</figure> - - | Returns the SHA-384 hash of _STRING_ as a string of 96 hexadecimal digits; returns NULL if _STRING_ is NULL. | -| - -<figure class="highlight"> - -``` -STRING.sha512() -``` - -</figure> - - | Returns the SHA-512 hash of _STRING_ as a string of 128 hexadecimal digits; returns NULL if _STRING_ is NULL. | -| - -<figure class="highlight"> - -``` -STRING.sha2(INT) -``` - -</figure> - - | Returns the SHA-2 family (SHA-224, SHA-256, SHA-384, or SHA-512) hashed value specified by _INT_ (which could be 224, 256, 384, or 512) for _STRING_. Returns NULL if _STRING_ or _INT_ is NULL. | - -| Hash functions | Description | -| --- | --- | -| - -<figure class="highlight"> - -``` -STRING.md5() -``` - -</figure> - - | Returns the MD5 hash of _STRING_ as a string of 32 hexadecimal digits; returns NULL if _STRING_ is NULL. | -| - -<figure class="highlight"> - -``` -STRING.sha1() -``` - -</figure> - - | Returns the SHA-1 hash of _STRING_ as a string of 40 hexadecimal digits; returns NULL if _STRING_ is NULL. | -| - -<figure class="highlight"> - -``` -STRING.sha224() -``` - -</figure> - - | Returns the SHA-224 hash of _STRING_ as a string of 56 hexadecimal digits; returns NULL if _STRING_ is NULL. | -| - -<figure class="highlight"> - -``` -STRING.sha256() -``` - -</figure> - - | Returns the SHA-256 hash of _STRING_ as a string of 64 hexadecimal digits; returns NULL if _STRING_ is NULL. | -| - -<figure class="highlight"> - -``` -STRING.sha384() -``` - -</figure> - - | Returns the SHA-384 hash of _STRING_ as a string of 96 hexadecimal digits; returns NULL if _STRING_ is NULL. | -| - -<figure class="highlight"> - -``` -STRING.sha512() -``` - -</figure> - - | Returns the SHA-512 hash of _STRING_ as a string of 128 hexadecimal digits; returns NULL if _STRING_ is NULL. | -| - -<figure class="highlight"> - -``` -STRING.sha2(INT) -``` - -</figure> - - | Returns the SHA-2 family (SHA-224, SHA-256, SHA-384, or SHA-512) hashed value specified by _INT_ (which could be 224, 256, 384, or 512) for _STRING_. Returns NULL if _STRING_ or _INT_ is NULL. | - -### 辅助函数 - -* [**SQL**](#tab_SQL_12) -* [**Java**](#tab_java_12) -* [**Scala**](#tab_scala_12) - -| 辅助函数 | 描述 | -| --- | --- | - -| Auxiliary functions | Description | -| --- | --- | -| - -<figure class="highlight"> - -``` -ANY.as(NAME1, NAME2, ...) -``` - -</figure> - - | Specifies a name for _ANY_ (a field). Additional names can be specified if the expression expands to multiple fields. | - -| Auxiliary functions | Description | -| --- | --- | -| - -<figure class="highlight"> - -``` -ANY.as(NAME1, NAME2, ...) -``` - -</figure> - - | Specifies a name for _ANY_ (a field). Additional names can be specified if the expression expands to multiple fields. | - -## 聚合函数 - -聚合函数将所有行的表达式作为输入,并返回单个聚合值作为结果。 - -* [**SQL**](#tab_SQL_13) -* [**Java**](#tab_java_13) -* [**Scala**](#tab_scala_13) - -| 聚合函数 | 描述 | -| --- | --- | -| - -<figure class="highlight"> - -``` -COUNT([ ALL ] expression | DISTINCT expression1 [, expression2]*) -``` - -</figure> - - | 默认情况下或使用ALL,返回_表达式_不为NULL 的输入行数。将DISTINCT用于每个值的一个唯一实例。 | -| - -<figure class="highlight"> - -``` -COUNT(*) -COUNT(1) -``` - -</figure> - - | 返回输入行数。 | -| - -<figure class="highlight"> - -``` -AVG([ ALL | DISTINCT ] expression) -``` - -</figure> - - | 默认情况下或使用关键字ALL,返回所有输入行的_表达式_的平均值(算术平均值)。将DISTINCT用于每个值的一个唯一实例。 | -| - -<figure class="highlight"> - -``` -SUM([ ALL | DISTINCT ] expression) -``` - -</figure> - - | 默认情况下或使用关键字ALL,返回所有输入行的_表达式_总和。将DISTINCT用于每个值的一个唯一实例。 | -| - -<figure class="highlight"> - -``` -MAX([ ALL | DISTINCT ] expression) -``` - -</figure> - - | 默认情况下或使用关键字ALL,返回所有输入行的_表达式_的最大值。将DISTINCT用于每个值的一个唯一实例。 | -| - -<figure class="highlight"> - -``` -MIN([ ALL | DISTINCT ] expression) -``` - -</figure> - - | 默认情况下或使用关键字ALL,返回所有输入行中_表达式_的最小值。将DISTINCT用于每个值的一个唯一实例。 | -| - -<figure class="highlight"> - -``` -STDDEV_POP([ ALL | DISTINCT ] expression) -``` - -</figure> - - | 默认情况下或使用关键字ALL,返回所有输入行中_表达式_的总体标准差。将DISTINCT用于每个值的一个唯一实例。 | -| - -<figure class="highlight"> - -``` -STDDEV_SAMP([ ALL | DISTINCT ] expression) -``` - -</figure> - - | 默认情况下或使用关键字ALL,返回所有输入行中_表达式_的样本标准差。将DISTINCT用于每个值的一个唯一实例。 | -| - -<figure class="highlight"> - -``` -VAR_POP([ ALL | DISTINCT ] expression) -``` - -</figure> - - | 默认情况下或使用关键字ALL,返回所有输入行中_表达式_的总体方差(总体标准差的平方)。将DISTINCT用于每个值的一个唯一实例。 | -| - -<figure class="highlight"> - -``` -VAR_SAMP([ ALL | DISTINCT ] expression) -``` - -</figure> - - | 默认情况下或使用关键字ALL,返回所有输入行中_表达式_的样本方差(样本标准差的平方)。将DISTINCT用于每个值的一个唯一实例。 | -| - -<figure class="highlight"> - -``` -COLLECT([ ALL | DISTINCT ] expression) -``` - -</figure> - - | 默认情况下或使用关键字ALL,在所有输入行中返回多_表达式_。NULL值将被忽略。将DISTINCT用于每个值的一个唯一实例。 | - -| Aggregate functions | Description | -| --- | --- | -| - -<figure class="highlight"> - -``` -FIELD.count -``` - -</figure> - - | Returns the number of input rows for which _FIELD_ is not NULL. | -| - -<figure class="highlight"> - -``` -FIELD.avg -``` - -</figure> - - | Returns the average (arithmetic mean) of _FIELD_ across all input rows. | -| - -<figure class="highlight"> - -``` -FIELD.sum -``` - -</figure> - - | Returns the sum of numeric field _FIELD_ across all input rows. If all values are NULL, returns NULL. | -| - -<figure class="highlight"> - -``` -FIELD.sum0 -``` - -</figure> - - | Returns the sum of numeric field _FIELD_ across all input rows. If all values are NULL, returns 0. | -| - -<figure class="highlight"> - -``` -FIELD.max -``` - -</figure> - - | Returns the maximum value of numeric field _FIELD_ across all input rows. | -| - -<figure class="highlight"> - -``` -FIELD.min -``` - -</figure> - - | Returns the minimum value of numeric field _FIELD_ across all input rows. | -| - -<figure class="highlight"> - -``` -FIELD.stddevPop -``` - -</figure> - - | Returns the population standard deviation of numeric field _FIELD_ across all input rows. | -| - -<figure class="highlight"> - -``` -FIELD.stddevSamp -``` - -</figure> - - | Returns the sample standard deviation of numeric field _FIELD_ across all input rows. | -| - -<figure class="highlight"> - -``` -FIELD.varPop -``` - -</figure> - - | Returns the population variance (square of the population standard deviation) of numeric field _FIELD_ across all input rows. | -| - -<figure class="highlight"> - -``` -FIELD.varSamp -``` - -</figure> - - | Returns the sample variance (square of the sample standard deviation) of numeric field _FIELD_ across all input rows. | -| - -<figure class="highlight"> - -``` -FIELD.collect -``` - -</figure> - - | Returns a multiset of _FIELD_ across all input rows. | - -| Aggregate functions | Description | -| --- | --- | -| - -<figure class="highlight"> - -``` -FIELD.count -``` - -</figure> - - | Returns the number of input rows for which _FIELD_ is not NULL. | -| - -<figure class="highlight"> - -``` -FIELD.avg -``` - -</figure> - - | Returns the average (arithmetic mean) of _FIELD_ across all input rows. | -| - -<figure class="highlight"> - -``` -FIELD.sum -``` - -</figure> - - | Returns the sum of numeric field _FIELD_ across all input rows. If all values are NULL, returns NULL. | -| - -<figure class="highlight"> - -``` -FIELD.sum0 -``` - -</figure> - - | Returns the sum of numeric field _FIELD_ across all input rows. If all values are NULL, returns 0. | -| - -<figure class="highlight"> - -``` -FIELD.max -``` - -</figure> - - | Returns the maximum value of numeric field _FIELD_ across all input rows. | -| - -<figure class="highlight"> - -``` -FIELD.min -``` - -</figure> - - | Returns the minimum value of numeric field _FIELD_ across all input rows. | -| - -<figure class="highlight"> - -``` -FIELD.stddevPop -``` - -</figure> - - | Returns the population standard deviation of numeric field _FIELD_ across all input rows. | -| - -<figure class="highlight"> - -``` -FIELD.stddevSamp -``` - -</figure> - - | Returns the sample standard deviation of numeric field _FIELD_ across all input rows. | -| - -<figure class="highlight"> - -``` -FIELD.varPop -``` - -</figure> - - | Returns the population variance (square of the population standard deviation) of numeric field _FIELD_ across all input rows. | -| - -<figure class="highlight"> - -``` -FIELD.varSamp -``` - -</figure> - - | Returns the sample variance (square of the sample standard deviation) of numeric field _FIELD_ across all input rows. | -| - -<figure class="highlight"> - -``` -FIELD.collect -``` - -</figure> - - | Returns a multiset of _FIELD_ across all input rows. | - -## 日期格式说明符 - -下表列出了日期格式函数的说明符。 +下表列出了日期格式函数的说明符。 | 符 | 描述 | | --- | --- | -| - -<figure class="highlight"> - -``` -%a -``` - -</figure> - - | 缩写的工作日名称(`Sun`.. `Sat`) | -| - -<figure class="highlight"> - -``` -%b -``` - -</figure> - - | 缩写的月份名称(`Jan`.. `Dec`) | -| - -<figure class="highlight"> - -``` -%c -``` - -</figure> - - | 月,数字(`1`.. `12`) | -| - -<figure class="highlight"> - -``` -%D -``` - -</figure> - - | 这个月的一天,英语后缀(`0th`,`1st`,`2nd`,`3rd`,...) | -| - -<figure class="highlight"> - -``` -%d -``` - -</figure> - - | 每月的某天,数字(`01`.. `31`) | -| - -<figure class="highlight"> - -``` -%e -``` - -</figure> - - | 每月的某天,数字(`1`.. `31`) | -| - -<figure class="highlight"> - -``` -%f -``` - -</figure> - - | 第二个分数(打印6位数:`000000`... `999000`;解析时为1 - 9位数:`0`.. `999999999`)(时间戳被截断为毫秒。) | -| - -<figure class="highlight"> - -``` -%H -``` - -</figure> - - | 小时(`00`.. `23`) | -| - -<figure class="highlight"> - -``` -%h -``` - -</figure> - - | 小时(`01`.. `12`) | -| - -<figure class="highlight"> - -``` -%I -``` - -</figure> - - | 小时(`01`.. `12`) | -| - -<figure class="highlight"> - -``` -%i -``` - -</figure> - - | 分钟,数字(`00`.. `59`) | -| - -<figure class="highlight"> - -``` -%j -``` - -</figure> - - | 一年中的某一天(`001`.. `366`) | -| - -<figure class="highlight"> - -``` -%k -``` - -</figure> - - | 小时(`0`.. `23`) | -| - -<figure class="highlight"> - -``` -%l -``` - -</figure> - - | 小时(`1`.. `12`) | -| - -<figure class="highlight"> - -``` -%M -``` - -</figure> - - | 月份名称(`January`.. `December`) | -| - -<figure class="highlight"> - -``` -%m -``` - -</figure> - - | 月,数字(`01`.. `12`) | -| - -<figure class="highlight"> - -``` -%p -``` - -</figure> - - | `AM` 要么 `PM` | -| - -<figure class="highlight"> - -``` -%r -``` - -</figure> - - | 时间,12小时(`hh:mm:ss`其次是`AM`或`PM`) | -| - -<figure class="highlight"> - -``` -%S -``` - -</figure> - - | 秒(`00`... `59`) | -| - -<figure class="highlight"> - -``` -%s -``` - -</figure> - - | 秒(`00`... `59`) | -| - -<figure class="highlight"> - -``` -%T -``` - -</figure> - - | 时间,24小时(`hh:mm:ss`) | -| - -<figure class="highlight"> - -``` -%U -``` - -</figure> - - | 周(`00`.. `53`),周日是一周的第一天 | -| - -<figure class="highlight"> - -``` -%u -``` - -</figure> - - | 周(`00`.. `53`),周一是一周的第一天 | -| - -<figure class="highlight"> - -``` -%V -``` - -</figure> - - | 周(`01`.. `53`),周日是一周的第一天; 用于`%X` | -| - -<figure class="highlight"> - -``` -%v -``` - -</figure> - - | 周(`01`.. `53`),周一是一周的第一天; 用于`%x` | -| - -<figure class="highlight"> - -``` -%W -``` - -</figure> - - | 平日名称(`Sunday`.. `Saturday`) | -| - -<figure class="highlight"> - -``` -%w -``` - -</figure> - - | 星期几(`0`.. `6`),星期日是一周的第一天 | -| - -<figure class="highlight"> - -``` -%X -``` - -</figure> - - | 星期日是星期的第一天的星期,数字,四位数; 用于`%V` | -| - -<figure class="highlight"> - -``` -%x -``` - -</figure> - - | 一周的年份,星期一是一周的第一天,数字,四位数; 用于`%v` | -| - -<figure class="highlight"> - -``` -%Y -``` - -</figure> - - | 年份,数字,四位数 | -| - -<figure class="highlight"> - -``` -%y -``` - -</figure> - - | 年份,数字(两位数) | -| - -<figure class="highlight"> - -``` -%% -``` - -</figure> - - | 文字`%`字符 | -| - -<figure class="highlight"> - -``` -%x -``` - -</figure> - - | `x`,对于`x`上面未列出的任何内容 | +| `%a` | 缩写的工作日名称(`Sun`.. `Sat`) | +| `%b` | 缩写的月份名称(`Jan`.. `Dec`) | +| `%c` | 月,数字(`1`.. `12`) | +| `%D` | 这个月的一天,英语后缀(`0th`,`1st`,`2nd`,`3rd`,...) | +| `%d` | 每月的某天,数字(`01`.. `31`) | +| `%e` | 每月的某天,数字(`1`.. `31`) | +| `%f` | 第二个分数(打印6位数:`000000`... `999000`;解析时为1 - 9位数:`0`.. `999999999`)(时间戳被截断为毫秒。) | +| `%H` | 小时(`00`.. `23`) | +| `%h` | 小时(`01`.. `12`) | +| `%I` | 小时(`01`.. `12`) | +| `%i` | 分钟,数字(`00`.. `59`) | +| `%j` | 一年中的某一天(`001`.. `366`) | +| `%k` | 小时(`0`.. `23`) | +| `%l` | 小时(`1`.. `12`) | +| `%M` | 月份名称(`January`.. `December`) | +| `%m` | 月,数字(`01`.. `12`) | +| `%p` | `AM` 要么 `PM` | +| `%r` | 时间,12小时(`hh:mm:ss`其次是`AM`或`PM`) | +| `%S` | 秒(`00`... `59`) | +| `%s` | 秒(`00`... `59`) | +| `%T` | 时间,24小时(`hh:mm:ss`) | +| `%U` | 周(`00`.. `53`),周日是一周的第一天 | +| `%u` | 周(`00`.. `53`),周一是一周的第一天 | +| `%V` | 周(`01`.. `53`),周日是一周的第一天; 用于`%X` | +| `%v` | 周(`01`.. `53`),周一是一周的第一天; 用于`%x` | +| `%W` | 平日名称(`Sunday`.. `Saturday`) | +| `%w` | 星期几(`0`.. `6`),星期日是一周的第一天 | +| `%X` | 星期日是星期的第一天的星期,数字,四位数; 用于`%V` | +| `%x` | 一周的年份,星期一是一周的第一天,数字,四位数; 用于`%v` | +| `%Y` | 年份,数字,四位数 | +| `%y` | 年份,数字(两位数) | +| `%%` | 文字`%`字符 | +| `%x` | `x`,对于`x`上面未列出的任何内容 |