Examples of ViewDefinition


Examples of com.facebook.presto.metadata.ViewDefinition

        QualifiedTableName name = MetadataUtil.createQualifiedTableName(session, table.getName());

        Optional<ViewDefinition> optionalView = metadata.getView(session, name);
        if (optionalView.isPresent()) {
            ViewDefinition view = optionalView.get();

            Query query = parseView(view.getOriginalSql(), name, table);

            analysis.registerNamedQuery(table, query);

            TupleDescriptor descriptor = analyzeView(query, name, view.getCatalog(), view.getSchema(), table);

            if (isViewStale(view.getColumns(), descriptor.getVisibleFields())) {
                throw new SemanticException(VIEW_IS_STALE, table, "View '%s' is stale; it must be re-created", name);
            }

            analysis.setOutputDescriptor(table, descriptor);
            return descriptor;
View Full Code Here

Examples of com.facebook.presto.metadata.ViewDefinition

        Analysis analysis = analyzeStatement(statement, session, metadata);
        Iterable<Field> fields = analysis.getOutputDescriptor().getVisibleFields();

        List<ViewColumn> columns = FluentIterable.from(fields).transform(fieldToColumn()).toList();

        String data = codec.toJson(new ViewDefinition(sql, session.getCatalog(), session.getSchema(), columns));

        metadata.createView(session, name, data, statement.isReplace());
    }
View Full Code Here

Examples of com.facebook.presto.metadata.ViewDefinition

                ImmutableList.<ColumnMetadata>of(
                        new ColumnMetadata("a", BIGINT, 0, false)))));

        // valid view referencing table in same schema
        String viewData1 = JsonCodec.jsonCodec(ViewDefinition.class).toJson(
                new ViewDefinition("select a from t1", "tpch", "default", ImmutableList.of(
                        new ViewColumn("a", BIGINT))));
        metadata.createView(SESSION, new QualifiedTableName("tpch", "default", "v1"), viewData1, false);

        // stale view (different column type)
        String viewData2 = JsonCodec.jsonCodec(ViewDefinition.class).toJson(
                new ViewDefinition("select a from t1", "tpch", "default", ImmutableList.of(
                        new ViewColumn("a", VARCHAR))));
        metadata.createView(SESSION, new QualifiedTableName("tpch", "default", "v2"), viewData2, false);

        // view referencing table in different schema from itself and session
        String viewData3 = JsonCodec.jsonCodec(ViewDefinition.class).toJson(
                new ViewDefinition("select a from t4", "c2", "s2", ImmutableList.of(
                        new ViewColumn("a", BIGINT))));
        metadata.createView(SESSION, new QualifiedTableName("c3", "s3", "v3"), viewData3, false);

        analyzer = new Analyzer(
                new ConnectorSession("user", "test", "tpch", "default", UTC_KEY, Locale.ENGLISH, null, null),
View Full Code Here

Examples of com.facebook.presto.metadata.ViewDefinition

        QualifiedTableName name = MetadataUtil.createQualifiedTableName(session, table.getName());

        Optional<ViewDefinition> optionalView = metadata.getView(session, name);
        if (optionalView.isPresent()) {
            ViewDefinition view = optionalView.get();

            Query query = parseView(view.getOriginalSql(), name, table);

            analysis.registerNamedQuery(table, query);

            TupleDescriptor descriptor = analyzeView(query, name, view.getCatalog(), view.getSchema(), table);

            if (isViewStale(view.getColumns(), descriptor.getVisibleFields())) {
                throw new SemanticException(VIEW_IS_STALE, table, "View '%s' is stale; it must be re-created", name);
            }

            analysis.setOutputDescriptor(table, descriptor);
            return descriptor;
View Full Code Here

Examples of com.facebook.presto.metadata.ViewDefinition

        Analysis analysis = analyzeStatement(statement, session, metadata);
        Iterable<Field> fields = analysis.getOutputDescriptor().getVisibleFields();

        List<ViewColumn> columns = FluentIterable.from(fields).transform(fieldToColumn()).toList();

        String data = codec.toJson(new ViewDefinition(sql, session.getCatalog(), session.getSchema(), columns));

        metadata.createView(session, name, data, statement.isReplace());
    }
View Full Code Here

Examples of com.facebook.presto.metadata.ViewDefinition

        QualifiedTableName name = MetadataUtil.createQualifiedTableName(session, table.getName());

        Optional<ViewDefinition> optionalView = metadata.getView(session, name);
        if (optionalView.isPresent()) {
            ViewDefinition view = optionalView.get();

            Query query = parseView(view.getOriginalSql(), name, table);

            analysis.registerNamedQuery(table, query);

            TupleDescriptor descriptor = analyzeView(query, name, view.getCatalog(), view.getSchema(), table);

            if (isViewStale(view.getColumns(), descriptor.getVisibleFields())) {
                throw new SemanticException(VIEW_IS_STALE, table, "View '%s' is stale; it must be re-created", name);
            }

            analysis.setOutputDescriptor(table, descriptor);
            return descriptor;
View Full Code Here

Examples of com.foundationdb.sql.views.ViewDefinition

        if (view != null) {
            if (!context.isAccessible(view.getName())) {
                view = null;
            }
            else if (expandViews) {
                ViewDefinition viewdef = context.getViewDefinition(view);
                FromSubquery viewSubquery;
                try {
                    viewSubquery = viewdef.copySubquery(fromBaseTable.getParserContext());
                }
                catch (StandardException ex) {
                    throw new ViewHasBadSubqueryException(origName.toString(),
                                                          ex.getMessage());
                }
View Full Code Here

Examples of com.opengamma.engine.view.ViewDefinition

   *
   * @param user the market data user, for example taken from the parent/containing view definition, not null
   * @param executionSequence the execution sequence to evaluate, not null
   */
  public ViewEvaluationTarget(UserPrincipal user, ViewCycleExecutionSequenceDescriptor executionSequence) {
    _viewDefinition = new ViewDefinition("Temp", user);
    _executionSequence = executionSequence;
  }
View Full Code Here

Examples of com.opengamma.engine.view.ViewDefinition

    // Check the valuation parameters are compatible
    if (!getExecutionSequence().equals(other.getExecutionSequence())) {
      return null;
    }
    // Check the basic view definitions are compatible
    final ViewDefinition myView = getViewDefinition();
    final ViewDefinition otherView = other.getViewDefinition();
    if (!ObjectUtils.equals(myView.getDefaultCurrency(), otherView.getDefaultCurrency())
        || !ObjectUtils.equals(myView.getMarketDataUser(), otherView.getMarketDataUser())
        || !ObjectUtils.equals(myView.getMaxDeltaCalculationPeriod(), otherView.getMaxDeltaCalculationPeriod())
        || !ObjectUtils.equals(myView.getMaxFullCalculationPeriod(), otherView.getMaxFullCalculationPeriod())
        || !ObjectUtils.equals(myView.getMinDeltaCalculationPeriod(), otherView.getMinDeltaCalculationPeriod())
        || !ObjectUtils.equals(myView.getMinFullCalculationPeriod(), otherView.getMinFullCalculationPeriod())
        || !ObjectUtils.equals(myView.getName(), otherView.getName())
        || !ObjectUtils.equals(myView.getPortfolioId(), otherView.getPortfolioId())
        || !ObjectUtils.equals(myView.getResultModelDefinition(), otherView.getResultModelDefinition())) {
      return null;
    }
    // Check the calc configs are compatible
    for (final ViewCalculationConfiguration myConfig : myView.getAllCalculationConfigurations()) {
      final ViewCalculationConfiguration otherConfig = otherView.getCalculationConfiguration(myConfig.getName());
      if (!ObjectUtils.equals(myConfig.getDefaultProperties(), otherConfig.getDefaultProperties())
          || !ObjectUtils.equals(myConfig.getDeltaDefinition(), otherConfig.getDeltaDefinition())
          || !ObjectUtils.equals(myConfig.getResolutionRuleTransform(), otherConfig.getResolutionRuleTransform())) {
        // Configs aren't compatible
        return null;
      }
    }
    // Create a new view definition that is the union of all calc configs
    final ViewDefinition newView = myView.copyWith(myView.getName(), myView.getPortfolioId(), myView.getMarketDataUser());
    for (final ViewCalculationConfiguration otherConfig : otherView.getAllCalculationConfigurations()) {
      final ViewCalculationConfiguration newConfig = newView.getCalculationConfiguration(otherConfig.getName());
      if (newConfig == null) {
        myView.addViewCalculationConfiguration(newConfig);
      } else {
        newConfig.addSpecificRequirements(otherConfig.getSpecificRequirements());
      }
View Full Code Here

Examples of com.opengamma.engine.view.ViewDefinition

   */
  public DependencyGraphBuildTrace build(DependencyGraphTraceBuilderProperties properties) {
    final DependencyGraphBuilder builder = _builderContext.getDependencyGraphBuilderFactory().newInstance();
    builder.setCalculationConfigurationName(properties.getCalculationConfigurationName());
    final FunctionCompilationContext context = _builderContext.getFunctionCompilationContext().clone();
    final ViewDefinition definition = new ViewDefinition("Mock View", "Test");
    final ViewCalculationConfiguration calcConfig = new ViewCalculationConfiguration(definition, properties.getCalculationConfigurationName());
    calcConfig.setDefaultProperties(properties.getDefaultProperties());
    context.setViewCalculationConfiguration(calcConfig);
    context.setComputationTargetResolver(context.getRawComputationTargetResolver().atVersionCorrection(properties.getResolutionTime()));
    builder.setCompilationContext(context);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.