Search in sources :

Example 1 with RuleParser

use of com.hortonworks.streamline.streams.catalog.rule.RuleParser in project streamline by hortonworks.

the class StreamCatalogService method updateRuleWithSql.

private void updateRuleWithSql(Rule rule, String sql, Long topologyId, Long versionId) {
    // parse
    RuleParser ruleParser = new RuleParser(this, sql, topologyId, versionId);
    ruleParser.parse();
    // update rule with parsed sql constructs
    Set<String> ruleInputStreams = ruleParser.getStreams().stream().map(Stream::getId).collect(Collectors.toSet());
    ensureValidStreams(ruleInputStreams, topologyId, versionId);
    rule.setProjection(ruleParser.getProjection());
    rule.setCondition(ruleParser.getCondition());
    rule.setGroupBy(ruleParser.getGroupBy());
    rule.setHaving(ruleParser.getHaving());
    rule.setReferredUdfs(ruleParser.getReferredUdfs());
    rule.setStreams(ruleInputStreams);
}
Also used : RuleParser(com.hortonworks.streamline.streams.catalog.rule.RuleParser)

Aggregations

RuleParser (com.hortonworks.streamline.streams.catalog.rule.RuleParser)1