Expressions: Sql expressions with Duckdb (#81666)

duckdb temp storage of dataframes using parquet and querying from sql expressions
---------

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
Scott Lepper
2024-02-27 16:16:00 -05:00
committed by GitHub
co-authored by Ryan McKinley
parent d8b7992c0c
commit 70009201d4
27 changed files with 555 additions and 20 deletions
+4
View File
@@ -405,6 +405,8 @@ const (
TypeVariantSet
// TypeNoData is a no data response without a known data type.
TypeNoData
// TypeTableData is a tabular data response.
TypeTableData
)
// String returns a string representation of the ReturnType.
@@ -422,6 +424,8 @@ func (f ReturnType) String() string {
return "variant"
case TypeNoData:
return "noData"
case TypeTableData:
return "tableData"
default:
return "unknown"
}
+45
View File
@@ -246,3 +246,48 @@ func (s NoData) New() NoData {
func NewNoData() NoData {
return NoData{data.NewFrame("no data")}
}
// TableData is an untyped no data response.
type TableData struct{ Frame *data.Frame }
// Type returns the Value type and allows it to fulfill the Value interface.
func (s TableData) Type() parse.ReturnType { return parse.TypeTableData }
// Value returns the actual value allows it to fulfill the Value interface.
func (s TableData) Value() any { return s }
func (s TableData) GetLabels() data.Labels { return nil }
func (s TableData) SetLabels(ls data.Labels) {}
func (s TableData) GetMeta() any {
return s.Frame.Meta.Custom
}
func (s TableData) SetMeta(v any) {
m := s.Frame.Meta
if m == nil {
m = &data.FrameMeta{}
s.Frame.SetMeta(m)
}
m.Custom = v
}
func (s TableData) AddNotice(notice data.Notice) {
m := s.Frame.Meta
if m == nil {
m = &data.FrameMeta{}
s.Frame.SetMeta(m)
}
m.Notices = append(m.Notices, notice)
}
func (s TableData) AsDataFrame() *data.Frame { return s.Frame }
func (s TableData) New() TableData {
return NewTableData()
}
func NewTableData() TableData {
return TableData{data.NewFrame("")}
}