Package com.cloudera.cdk.data

Examples of com.cloudera.cdk.data.MetadataProviderException


    String schemaUrlString = table.getProperty(AVRO_SCHEMA_URL_PROPERTY_NAME);
    if (schemaUrlString != null) {
      try {
        builder.schemaUri(new URI(schemaUrlString));
      } catch (IOException e) {
        throw new MetadataProviderException("Could not read schema", e);
      } catch (URISyntaxException e) {
        // this library sets the URI, so it should always be valid
        throw new MetadataProviderException("[BUG] Invalid schema URI", e);
      }
    }

    String schemaLiteral = table.getProperty(AVRO_SCHEMA_LITERAL_PROPERTY_NAME);
    if (schemaLiteral != null) {
      builder.schemaLiteral(schemaLiteral);
    }

    try {
      return builder.build();
    catch (IllegalStateException ex) {
      throw new MetadataProviderException("Cannot find schema: missing metadata");
    }
  }
View Full Code Here


      table.setSerializationLib(FORMAT_TO_SERDE.get(format));
      try {
        table.setInputFormatClass(FORMAT_TO_INPUT_FORMAT.get(format));
        table.setOutputFormatClass(FORMAT_TO_OUTPUT_FORMAT.get(format));
      } catch (HiveException ex) {
        throw new MetadataProviderException(
            "Failed to set input/output formats for format:" +
            format.getName(), ex);
      }
    } else {
      throw new UnknownFormatException(
          "No known serde for format:" + format.getName());
    }
    try {
    } catch (Exception e) {
      throw new MetadataProviderException("Error configuring Hive Avro table, " +
          "table creation failed", e);
    }

    // copy schema info
    boolean useLiteral;
View Full Code Here

      table.setProperty(
          AVRO_SCHEMA_LITERAL_PROPERTY_NAME,
          descriptor.getSchema().toString());
    } else if (table.getProperty(AVRO_SCHEMA_URL_PROPERTY_NAME) != null) {
      if (descriptor.getSchemaUrl() == null) {
        throw new MetadataProviderException("Cannot update " +
            AVRO_SCHEMA_URL_PROPERTY_NAME + " since descriptor schema URL is not set.");
      }
      table.setProperty(
          AVRO_SCHEMA_URL_PROPERTY_NAME,
          descriptor.getSchemaUrl().toExternalForm());
    } else {
      throw new MetadataProviderException("Cannot update Avro schema since neither " +
          AVRO_SCHEMA_LITERAL_PROPERTY_NAME + " nor " + AVRO_SCHEMA_URL_PROPERTY_NAME +
          " is set.");
    }
  }
View Full Code Here

  static FileSystem fsForPath(Configuration conf, Path path) {
    try {
      return path.getFileSystem(conf);
    } catch (IOException ex) {
      throw new MetadataProviderException(
          "Cannot access FileSystem for uri:" + path, ex);
    }
  }
View Full Code Here

        return path.getFileSystem(conf);
      } else {
        return FileSystem.get(new URI(fsUri), conf);
      }
    } catch (IOException ex) {
      throw new MetadataProviderException(
          "Cannot access FileSystem for path:" + path, ex);
    } catch (URISyntaxException ex) {
      throw new MetadataProviderException(
          "Cannot access FileSystem for uri:" + fsUri, ex);
    }
  }
View Full Code Here

  }

  static String getHiveType(Class<?> type) {
    String typeName = PrimitiveObjectInspectorUtils.getTypeNameFromPrimitiveJava(type);
    if (typeName == null) {
      throw new MetadataProviderException("Unsupported FieldPartitioner type: " + type);
    }
    return typeName;
  }
View Full Code Here

          hbaseAdmin.deleteColumn(tableName, columnFamily);
        } finally {
          hbaseAdmin.enableTable(tableName);
        }
      } catch (IOException e) {
        throw new MetadataProviderException(e);
      }
    }
    return true;
  }
View Full Code Here

    Preconditions.checkArgument(name != null, "Name cannot be null");

    final Table table = hcat.getTable(HiveUtils.DEFAULT_DB, name);

    if (!TableType.MANAGED_TABLE.equals(table.getTableType())) {
      throw new MetadataProviderException("Table is not managed");
    }

    return HiveUtils.descriptorForTable(conf, table);
  }
View Full Code Here

  public boolean exists(String dbName, String tableName) {
    try {
      return client.tableExists(dbName, tableName);
    } catch (Exception e) {
      throw new MetadataProviderException("Hive metastore exception", e);
    }
  }
View Full Code Here

  public List<String> getAllTables(String dbName) {
    try {
      return client.getAllTables(dbName);
    } catch (Exception e) {
      throw new MetadataProviderException("Hive metastore exception", e);
    }
  }
View Full Code Here

TOP

Related Classes of com.cloudera.cdk.data.MetadataProviderException

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.