Tabnine Logo
org.apache.kudu.client
Code IndexAdd Tabnine to your IDE (free)

How to use org.apache.kudu.client

Best Java code snippets using org.apache.kudu.client (Showing top 20 results out of 315)

origin: prestodb/presto

  public static PartialRow decodeRangePartitionKey(Schema schema, PartitionSchema partitionSchema, byte[] key)
  {
    return KeyEncoder.decodeRangePartitionKey(schema, partitionSchema, key);
  }
}
origin: prestodb/presto

private KuduTable getSchemasTable(KuduClient client)
    throws KuduException
{
  if (rawSchemasTable == null) {
    rawSchemasTable = client.openTable(rawSchemasTableName);
  }
  return rawSchemasTable;
}
origin: prestodb/presto

public static byte[] encodeRangePartitionKey(PartialRow row, PartitionSchema.RangeSchema rangeSchema)
{
  return KeyEncoder.encodeRangePartitionKey(row, rangeSchema);
}
origin: prestodb/presto

private void createAndFillSchemasTable(KuduClient client)
    throws KuduException
{
  List<String> existingSchemaNames = listSchemaNamesFromTablets(client);
  ColumnSchema schemaColumnSchema = new ColumnSchema.ColumnSchemaBuilder("schema", Type.STRING)
      .key(true).build();
  Schema schema = new Schema(ImmutableList.of(schemaColumnSchema));
  CreateTableOptions options = new CreateTableOptions();
  options.addHashPartitions(ImmutableList.of(schemaColumnSchema.getName()), 2);
  KuduTable schemasTable = client.createTable(rawSchemasTableName, schema, options);
  KuduSession session = client.newSession();
  try {
    session.setFlushMode(SessionConfiguration.FlushMode.AUTO_FLUSH_BACKGROUND);
    for (String schemaName : existingSchemaNames) {
      Insert insert = schemasTable.newInsert();
      insert.getRow().addString(0, schemaName);
      session.apply(insert);
    }
  }
  finally {
    session.close();
  }
}
origin: apache/nifi

protected KuduSession getKuduSession(final KuduClient client) {
  final KuduSession kuduSession = client.newSession();
  kuduSession.setMutationBufferSpace(batchSize);
  kuduSession.setFlushMode(flushMode);
  if (operationType == OperationType.INSERT_IGNORE) {
    kuduSession.setIgnoreAllDuplicateRows(true);
  }
  return kuduSession;
}
origin: brianfrankcooper/YCSB

@Override
public Status delete(String table, String key) {
 Delete delete = this.kuduTable.newDelete();
 PartialRow row = delete.getRow();
 row.addString(KEY, key);
 apply(delete);
 return Status.OK;
}
origin: apache/drill

public KuduRecordWriterImpl(OperatorContext context, KuduClient client, String name) {
 this.client = client;
 this.name = name;
 this.context = context;
 session = client.newSession();
 session.setFlushMode(FlushMode.MANUAL_FLUSH);
}
origin: prestodb/presto

  private PartialRow buildPrimaryKey()
  {
    Schema schema = table.getSchema();
    PartialRow row = new PartialRow(schema);
    RowHelper.copyPrimaryKey(schema, currentRow, row);
    return row;
  }
}
origin: prestodb/presto

public void dropColumn(SchemaTableName schemaTableName, String name)
{
  try {
    String rawName = schemaEmulation.toRawName(schemaTableName);
    AlterTableOptions alterOptions = new AlterTableOptions();
    alterOptions.dropColumn(name);
    client.alterTable(rawName, alterOptions);
  }
  catch (KuduException e) {
    throw new PrestoException(GENERIC_INTERNAL_ERROR, e);
  }
}
origin: prestodb/presto

public KuduSession newSession()
{
  return client.newSession();
}
origin: prestodb/presto

private List<String> internalListTables(String prefix)
{
  try {
    if (prefix.isEmpty()) {
      return client.getTablesList().getTablesList();
    }
    else {
      return client.getTablesList(prefix).getTablesList();
    }
  }
  catch (KuduException e) {
    throw new PrestoException(GENERIC_INTERNAL_ERROR, e);
  }
}
origin: prestodb/presto

public void renameColumn(SchemaTableName schemaTableName, String oldName, String newName)
{
  try {
    String rawName = schemaEmulation.toRawName(schemaTableName);
    AlterTableOptions alterOptions = new AlterTableOptions();
    alterOptions.renameColumn(oldName, newName);
    client.alterTable(rawName, alterOptions);
  }
  catch (KuduException e) {
    throw new PrestoException(GENERIC_INTERNAL_ERROR, e);
  }
}
origin: prestodb/presto

public void renameTable(SchemaTableName schemaTableName, SchemaTableName newSchemaTableName)
{
  try {
    String rawName = schemaEmulation.toRawName(schemaTableName);
    String newRawName = schemaEmulation.toRawName(newSchemaTableName);
    AlterTableOptions alterOptions = new AlterTableOptions();
    alterOptions.renameTable(newRawName);
    client.alterTable(rawName, alterOptions);
  }
  catch (KuduException e) {
    throw new PrestoException(GENERIC_INTERNAL_ERROR, e);
  }
}
origin: prestodb/presto

public Schema getTableSchema(KuduTableHandle tableHandle)
{
  KuduTable table = tableHandle.getTable(this);
  return table.getSchema();
}
origin: prestodb/presto

  private void closeSession()
  {
    try {
      session.close();
    }
    catch (KuduException e) {
      throw new RuntimeException(e);
    }
  }
}
origin: prestodb/presto

public static double getDouble(Type type, RowResult row, int field)
{
  if (type == DoubleType.DOUBLE) {
    return row.getDouble(field);
  }
  else {
    throw new IllegalStateException("getDouble not implemented for " + type);
  }
}
origin: prestodb/presto

public static boolean getBoolean(Type type, RowResult row, int field)
{
  if (type == BooleanType.BOOLEAN) {
    return row.getBoolean(field);
  }
  else {
    throw new IllegalStateException("getBoolean not implemented for " + type);
  }
}
origin: prestodb/presto

@Override
public boolean isNull(int field)
{
  int mappedField = mapping(field);
  return mappedField >= 0 && currentRow.isNull(mappedField);
}
origin: prestodb/presto

public static PartialRow decodePrimaryKey(Schema schema, byte[] key)
{
  return KeyEncoder.decodePrimaryKey(schema, key);
}
origin: prestodb/presto

public static byte[] encodePrimaryKey(PartialRow row)
{
  return KeyEncoder.encodePrimaryKey(row);
}
org.apache.kudu.client

Most used classes

  • KuduClient
    A synchronous and thread-safe client for Kudu. This class acts as a wrapper around AsyncKuduClient w
  • KuduSession
    Synchronous version of AsyncKuduSession. Offers the same API but with blocking methods. This class i
  • KuduTable
    A KuduTable represents a table on a particular cluster. It holds the current schema of the table. An
  • PartialRow
    Class used to represent parts of a row along with its schema. Values can be replaced as often as nee
  • KuduScanner
    Synchronous version of AsyncKuduScanner. Offers the same API but with blocking methods.
  • CreateTableOptions,
  • RowResultIterator,
  • KuduClient$KuduClientBuilder,
  • KuduScanner$KuduScannerBuilder,
  • Insert,
  • KuduPredicate,
  • Delete,
  • KuduScanToken$KuduScanTokenBuilder,
  • KuduScanToken,
  • ListTablesResponse,
  • LocatedTablet,
  • Operation,
  • AlterTableOptions,
  • OperationResponse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now