Skip to content

[TODO]Support hints in goalisa #2352

Open
@weiguoz

Description

@weiguoz

In the issue: 2220, we plan to supports Maxcompute hints.
goalisa is one of the dabase/sql driver of Maxcompute. We're going to support Maxcompute hints in goalisa at first.
I found our parser is able to split the hints from a SQL program. What we want to do are:

  • To support passing the hints to the backend of the database, we need to implement interfaces DB.PrepareContext to prepare a stmt, then get the result via stmt.QueryContext(stmt.ExecContext).
    Moreover, we need to implement such methods in all database/sql drivers: goalisa/gomaxcompute/gohive to unify the code in SQLFlow.

    • gomaxcompute
    • gohive
    • goalisa
  • Extract the hints from the parse result, and the hints will be sent to the goalisa finally via runSingleSQLFlowStatement

    func runSQLProgram(wr *pipe.Writer, sqlProgram string, db *database.DB, modelDir string, session *pb.Session) error {
    stmts, err := parser.Parse(db.DriverName, sqlProgram)
    if err != nil {
    return err
    }
    // NOTE(tony): We generate IR and execute its translated program one-by-one since IR generation may depend on the execution
    // of the previous statement. For example, consider a SQL program
    //
    // create table some_table as (select ...);
    // select * from some_table to train ...
    //
    // The IR generation on the second statement would fail since it requires inspection the schema of some_table,
    // which depends on the execution of create table some_table as (select ...);.
    for _, sql := range stmts {
    if err := runSingleSQLFlowStatement(wr, sql, db, modelDir, session); err != nil {
    return err
    }
    }
    return nil
    }

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions