Package net.hydromatic.optiq

Examples of net.hydromatic.optiq.SchemaPlus


  public UserSession getSession(){
    return session;
  }

  public SchemaPlus getNewDefaultSchema(){
    SchemaPlus rootSchema = getRootSchema();
    SchemaPlus defaultSchema = session.getDefaultSchema(rootSchema);
    if(defaultSchema == null){
      return rootSchema;
    }else{
      return defaultSchema;
    }
View Full Code Here


      return defaultSchema;
    }
  }

  public SchemaPlus getRootSchema(){
    SchemaPlus rootSchema = SimpleOptiqSchema.createRootSchema(false);
    drillbitContext.getSchemaFactory().registerSchemas(session, rootSchema);
    return rootSchema;
  }
View Full Code Here

      //          -- "hivedb1"
      //    -- "hive.default"
      //    -- "hive.hivedb1"
      List<SchemaPlus> secondLevelSchemas = Lists.newArrayList();
      for (String firstLevelSchemaName : parent.getSubSchemaNames()) {
        SchemaPlus firstLevelSchema = parent.getSubSchema(firstLevelSchemaName);
        for (String secondLevelSchemaName : firstLevelSchema.getSubSchemaNames()) {
          secondLevelSchemas.add(firstLevelSchema.getSubSchema(secondLevelSchemaName));
        }
      }

      for (SchemaPlus schema : secondLevelSchemas) {
        AbstractSchema drillSchema;
View Full Code Here

  }

  @Override
  public void registerSchemas(UserSession session, SchemaPlus parent) {
    FileSystemSchema schema = new FileSystemSchema(schemaName, session);
    SchemaPlus plusOfThis = parent.add(schema.getName(), schema);
    schema.setPlus(plusOfThis);
  }
View Full Code Here

   * @param fullPath The desired path to set to.
   * @param schema The root schema to find this path within.
   * @return true if the path was set successfully.  false if this path was unavailable.
   */
  public boolean setDefaultSchemaPath(String fullPath, SchemaPlus schema) {
    SchemaPlus newDefault = findSchema(schema, fullPath);
    if (newDefault == null) {
      return false;
    }
    setProp(SCHEMA, fullPath);
    return true;
View Full Code Here

    properties.put(key, value);
  }

  private SchemaPlus findSchema(SchemaPlus rootSchema, String schemaPath) {
    String[] paths = schemaPath.split("\\.");
    SchemaPlus schema = rootSchema;
    for (String p : paths) {
      schema = schema.getSubSchema(p);
      if (schema == null) {
        break;
      }
    }
    return schema;
View Full Code Here

  }

  @Override
  public void registerSchemas(UserSession session, SchemaPlus parent) {
    MongoSchema schema = new MongoSchema(schemaName);
    SchemaPlus hPlus = parent.add(schemaName, schema);
    schema.setHolder(hPlus);
  }
View Full Code Here

      throws Exception {
    if (schemaPath.size() == 0) {
      return defaultSchema;
    }

    SchemaPlus schema;

    if ((schema = searchSchemaTree(defaultSchema, schemaPath)) != null) {
      return schema;
    }
View Full Code Here

    String tableSchema;
    if (db != null) {
      tableSchema = db.toString();
    } else {
      // If no schema is given in SHOW TABLES command, list tables from current schema
      SchemaPlus schema = context.getNewDefaultSchema();

      if (isRootSchema(schema)) {
        // If the default schema is a root schema, throw an error to select a default schema
        throw new RelConversionException("No schema selected. Select a schema using 'USE schema' command");
      }
View Full Code Here

    @Override
    public PhysicalPlan getPlan(SqlNode sqlNode) throws ValidationException, RelConversionException, IOException {
      SqlCreateView createView = unwrap(sqlNode, SqlCreateView.class);

      try {
        SchemaPlus defaultSchema = context.getNewDefaultSchema();
        SchemaPlus schema = findSchema(context.getRootSchema(), defaultSchema, createView.getSchemaPath());
        AbstractSchema drillSchema = getDrillSchema(schema);

        String schemaPath = drillSchema.getFullSchemaName();
        if (!drillSchema.isMutable()) {
          return DirectPlan.createDirectPlan(context, false, String.format("Unable to create view. " +
View Full Code Here

TOP

Related Classes of net.hydromatic.optiq.SchemaPlus

Copyright © 2018 www.massapicom. 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.