Search in sources :

Example 1 with Analysis

use of io.crate.analyze.Analysis in project crate by crate.

the class BatchPortal method describe.

@Override
public List<Field> describe() {
    Analysis lastAnalysis = analysis.get(analysis.size() - 1);
    if (lastAnalysis.rootRelation() == null) {
        return null;
    }
    List<Field> fields = lastAnalysis.rootRelation().fields();
    outputTypes.add(Symbols.extractTypes(fields));
    return fields;
}
Also used : Field(io.crate.analyze.symbol.Field) Analysis(io.crate.analyze.Analysis)

Example 2 with Analysis

use of io.crate.analyze.Analysis in project crate by crate.

the class BulkPortal method sync.

@Override
public CompletableFuture<?> sync(Planner planner, JobsLogs jobsLogs) {
    List<Row> bulkParams = Rows.of(bulkArgs);
    Analysis analysis = portalContext.getAnalyzer().boundAnalyze(statement, sessionContext, new ParameterContext(Row.EMPTY, bulkParams));
    UUID jobId = UUID.randomUUID();
    Plan plan;
    try {
        plan = planner.plan(analysis, jobId, 0, maxRows);
    } catch (Throwable t) {
        jobsLogs.logPreExecutionFailure(jobId, query, SQLExceptions.messageOf(t));
        throw t;
    }
    jobsLogs.logExecutionStart(jobId, query);
    synced = true;
    return executeBulk(portalContext.getExecutor(), plan, jobId, jobsLogs);
}
Also used : Analysis(io.crate.analyze.Analysis) ParameterContext(io.crate.analyze.ParameterContext) Row(io.crate.data.Row) UUID(java.util.UUID) Plan(io.crate.planner.Plan)

Aggregations

Analysis (io.crate.analyze.Analysis)2 ParameterContext (io.crate.analyze.ParameterContext)1 Field (io.crate.analyze.symbol.Field)1 Row (io.crate.data.Row)1 Plan (io.crate.planner.Plan)1 UUID (java.util.UUID)1