private KuduTable getSchemasTable(KuduClient client) throws KuduException { if (rawSchemasTable == null) { rawSchemasTable = client.openTable(rawSchemasTableName); } return rawSchemasTable; }
public KuduTable openTable(SchemaTableName schemaTableName) { String rawName = schemaEmulation.toRawName(schemaTableName); try { return client.openTable(rawName); } catch (KuduException e) { log.debug("Error on doOpenTable: " + e, e); if (!listSchemaNames().contains(schemaTableName.getSchemaName())) { throw new SchemaNotFoundException(schemaTableName.getSchemaName()); } throw new TableNotFoundException(schemaTableName); } }
@Override public Table getTable(String name) { KuduScanSpec scanSpec = new KuduScanSpec(name); try { KuduTable table = plugin.getClient().openTable(name); Schema schema = table.getSchema(); return new DrillKuduTable(getName(), plugin, schema, scanSpec); } catch (Exception e) { logger.warn("Failure while retrieving kudu table {}", name, e); return null; } }
@Override public void init() throws DBException { this.tableName = getProperties().getProperty(TABLENAME_PROPERTY, TABLENAME_PROPERTY_DEFAULT); initClient(); this.session = client.newSession(); if (getProperties().getProperty(SYNC_OPS_OPT) != null && getProperties().getProperty(SYNC_OPS_OPT).equals("false")) { this.session.setFlushMode(KuduSession.FlushMode.AUTO_FLUSH_BACKGROUND); this.session.setMutationBufferSpace( getIntFromProp(getProperties(), BUFFER_NUM_OPS_OPT, BUFFER_NUM_OPS_DEFAULT)); } else { this.session.setFlushMode(KuduSession.FlushMode.AUTO_FLUSH_SYNC); } try { this.kuduTable = client.openTable(tableName); this.schema = kuduTable.getSchema(); } catch (Exception e) { throw new DBException("Could not open a table because of:", e); } }
private void init() { String tableName = kuduScanSpec.getTableName(); Collection<DrillbitEndpoint> endpoints = kuduStoragePlugin.getContext().getBits(); Map<String,DrillbitEndpoint> endpointMap = Maps.newHashMap(); for (DrillbitEndpoint endpoint : endpoints) { endpointMap.put(endpoint.getAddress(), endpoint); } try { List<LocatedTablet> locations = kuduStoragePlugin.getClient().openTable(tableName).getTabletsLocations(10000); for (LocatedTablet tablet : locations) { KuduWork work = new KuduWork(tablet.getPartition().getPartitionKeyStart(), tablet.getPartition().getPartitionKeyEnd()); for (Replica replica : tablet.getReplicas()) { String host = replica.getRpcHost(); DrillbitEndpoint ep = endpointMap.get(host); if (ep != null) { work.getByteMap().add(ep, DEFAULT_TABLET_SIZE); } } kuduWorkList.add(work); } } catch (Exception e) { throw new RuntimeException(e); } }
KuduTable table = client.openTable(rawName); Schema schema = table.getSchema(); PartitionDesign design = KuduTableProperties.getPartitionDesign(table);
@Override public void setup(OperatorContext context, OutputMutator output) throws ExecutionSetupException { this.output = output; this.context = context; try { KuduTable table = client.openTable(scanSpec.getTableName()); KuduScannerBuilder builder = client.newScannerBuilder(table); if (!isStarQuery()) { List<String> colNames = Lists.newArrayList(); for (SchemaPath p : this.getColumns()) { colNames.add(p.getRootSegmentPath()); } builder.setProjectedColumnNames(colNames); } context.getStats().startWait(); try { scanner = builder .lowerBoundRaw(scanSpec.getStartKey()) .exclusiveUpperBoundRaw(scanSpec.getEndKey()) .build(); } finally { context.getStats().stopWait(); } } catch (Exception e) { throw new ExecutionSetupException(e); } }
@OnScheduled public void OnScheduled(final ProcessContext context) throws KuduException { final String tableName = context.getProperty(TABLE_NAME).evaluateAttributeExpressions().getValue(); final String kuduMasters = context.getProperty(KUDU_MASTERS).evaluateAttributeExpressions().getValue(); operationType = OperationType.valueOf(context.getProperty(INSERT_OPERATION).getValue()); batchSize = context.getProperty(BATCH_SIZE).evaluateAttributeExpressions().asInteger(); flushMode = SessionConfiguration.FlushMode.valueOf(context.getProperty(FLUSH_MODE).getValue()); getLogger().debug("Setting up Kudu connection..."); kuduClient = createClient(kuduMasters); kuduTable = kuduClient.openTable(tableName); getLogger().debug("Kudu connection successfully initialized"); }
KuduTable table = client.openTable(tableName);
KuduTable table = client.openTable(tableInfo.getTableName()); AlterTableOptions alterTableOptions = new AlterTableOptions(); AtomicBoolean updated = new AtomicBoolean(false);
try table = kuduClient.openTable(entityMetadata.getTableName());
try table = kuduClient.openTable(m.getTableName());
KuduTable getTable(String tableName) throws KuduException { if (tables.containsKey(tableName)) { return tables.get(tableName); } else { KuduTable table = client.openTable(tableName); tables.put(tableName, table); return table; } }
try table = kuduClient.openTable(entityMetadata.getTableName());
try table = kuduClient.openTable(entityMetadata.getTableName());
@Override protected void setup(Context context) throws KuduException { Configuration conf = context.getConfiguration(); CommandLineParser parser = new CommandLineParser(conf); client = parser.getClient(); table = client.openTable(getTableName(conf)); session = client.newSession(); numUpdatesPerMapper = conf.getInt(MAX_LINK_UPDATES_PER_MAPPER, 1); headsCache = new ArrayList<>(numUpdatesPerMapper); }
private KuduTable table(KuduTableInfo infoTable) throws IOException { KuduClient syncClient = client.syncClient(); String tableName = infoTable.getName(); if (syncClient.tableExists(tableName)) { return syncClient.openTable(tableName); } if (infoTable.createIfNotExist()) { return syncClient.createTable(tableName, infoTable.getSchema(), infoTable.getCreateTableOptions()); } throw new UnsupportedOperationException("table not exists and is marketed to not be created"); }
@Test(timeout = 100000) public void testFormatRangePartitionsUnbounded() throws Exception { CreateTableOptions builder = getBasicCreateTableOptions(); client.createTable(tableName, basicSchema, builder); assertEquals( ImmutableList.of("UNBOUNDED"), client.openTable(tableName).getFormattedRangePartitions(10000)); }
@Before public void setUp() throws Exception { harness.getClient().createTable(TABLE_NAME, allTypesSchema, getAllTypesCreateTableOptions()); table = harness.getClient().openTable(TABLE_NAME); }
@Before public void setUp() throws Exception { CreateTableOptions builder = getBasicCreateTableOptions(); harness.getClient().createTable(TABLE_NAME, getBasicSchema(), builder); table = harness.getClient().openTable(TABLE_NAME); }