spark sql自己定義規則

2021-08-24 20:23:57 字數 1572 閱讀 2744

2)找到 sqlbase.g4 檔案,以 offset 為例進行說明,下面的

2.1)找到下面的內容

queryorganization

: (order by order+=sortitem (',' order+=sortitem)*)?

(cluster by clusterby+=expression (',' clusterby+=expression)*)?

(distribute by distributeby+=expression (',' distributeby+=expression)*)?

(sort by sort+=sortitem (',' sort+=sortitem)*)?

windows?

(offset offset=expression)? 此處是新增的功能,類似於oracle裡面的關鍵字

(limit (all | limit=expression))?

;

2.2)1  package org.apache.spark.sql.execution  limit

/*** offset 編輯資訊

* @param offset

* @param limit

* @param child

*/case class offsetexec(offset:int,limit: int, child: sparkplan) extends unaryexecnode

override def executecollect(): array[internalrow] = else

}private val serializer: serializer = new unsaferowserializer(child.output.size)

override def outputordering: seq[sortorder] = sortorder

override def outputpartitioning: partitioning = singlepartition

override def ******string: string =

2.3)org.apache.spark.sql.catalyst.plans.logical.baselogicaloperators

/*** 基本物理邏輯處理

* @param offsetexpr

* @param limitexpr

* @param child

*/case class offset(offsetexpr: expression,limitexpr: expression, child: logicalplan) extends unarynode

2.4 org.apache.spark.sql.catalyst.parser.astbuilder        withqueryresultclauses:

//offset

var withoffset:logicalplan = null

if(limit != null)

}else

}withoffset.optional(limit)

Spark SQL中自定義函式詳解

資料來源 初始化sparksession package com.kfk.spark.common import org.apache.spark.sql.sparksession author 蔡政潔 email caizhengjie888 icloud.com date 2020 12 2 t...

表定義規則

表分類 1.系統表 字首 t sys 特點 系統執行必須的表,如使用者,也可能與業務有關係,如許可權資源。2 基本配置表 字首 t base 特點 業務必須得基本配置,不分站點,如使用者型別 付款型別等。安裝系統時配置,使用者不可修改。3.基礎資料表 字首 t bd 特點 業務區分得基礎資料,分站點...

iptables 定義規則

iptables定義規則的方式大概是這種格式 iptables t table command chain cretiria j action t 表名 指定要操作的表 command 定義策略 chain 指定要操作的鏈 cretiria 定義匹配的標準 分為多個標準 j target 策略進行的...