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:
co-authored by
Ryan McKinley
parent
d8b7992c0c
commit
70009201d4
@@ -75,6 +75,8 @@ func (dp *DataPipeline) execute(c context.Context, now time.Time, s *Service) (m
|
||||
executeDSNodesGrouped(c, now, vars, s, dsNodes)
|
||||
}
|
||||
|
||||
s.allowLongFrames = hasSqlExpression(*dp)
|
||||
|
||||
for _, node := range *dp {
|
||||
if groupByDSFlag && node.NodeType() == TypeDatasourceNode {
|
||||
continue // already executed via executeDSNodesGrouped
|
||||
@@ -266,6 +268,10 @@ func buildGraphEdges(dp *simple.DirectedGraph, registry map[string]Node) error {
|
||||
for _, neededVar := range cmdNode.Command.NeedsVars() {
|
||||
neededNode, ok := registry[neededVar]
|
||||
if !ok {
|
||||
_, ok := cmdNode.Command.(*SQLCommand)
|
||||
if ok {
|
||||
continue
|
||||
}
|
||||
return fmt.Errorf("unable to find dependent node '%v'", neededVar)
|
||||
}
|
||||
|
||||
@@ -312,3 +318,37 @@ func GetCommandsFromPipeline[T Command](pipeline DataPipeline) []T {
|
||||
}
|
||||
return results
|
||||
}
|
||||
|
||||
func hasSqlExpression(dp DataPipeline) bool {
|
||||
for _, node := range dp {
|
||||
if node.NodeType() == TypeCMDNode {
|
||||
cmdNode := node.(*CMDNode)
|
||||
_, ok := cmdNode.Command.(*SQLCommand)
|
||||
if ok {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// func graphHasSqlExpresssion(dp *simple.DirectedGraph) bool {
|
||||
// node := dp.Nodes()
|
||||
// for node.Next() {
|
||||
// if cmdNode, ok := node.Node().(*CMDNode); ok {
|
||||
// // res[dpNode.RefID()] = dpNode
|
||||
// _, ok := cmdNode.Command.(*SQLCommand)
|
||||
// if ok {
|
||||
// return true
|
||||
// }
|
||||
// }
|
||||
// // if node.NodeType() == TypeCMDNode {
|
||||
// // cmdNode := node.(*CMDNode)
|
||||
// // _, ok := cmdNode.Command.(*SQLCommand)
|
||||
// // if ok {
|
||||
// // return true
|
||||
// // }
|
||||
// // }
|
||||
// }
|
||||
// return false
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user