Tabnine Logo
ReadContext.readUsingIndex
Code IndexAdd Tabnine to your IDE (free)

How to use
readUsingIndex
method
in
com.google.cloud.spanner.ReadContext

Best Java code snippets using com.google.cloud.spanner.ReadContext.readUsingIndex (Showing top 11 results out of 315)

origin: googleapis/google-cloud-java

@Override
public ResultSet readUsingIndex(
  String table, String index, KeySet keys, Iterable<String> columns, ReadOption... options) {
 return wrap(delegate.readUsingIndex(table, index, keys, columns, options));
}
origin: googleapis/google-cloud-java

ResultSet readUsingIndex() {
 // [START read_context_read_index]
 ReadContext readContext = dbClient.singleUse();
 ResultSet resultSet =
   readContext.readUsingIndex(
     "Albums", "AlbumsByAlbumTitle", KeySet.all(), Arrays.asList("AlbumId", "AlbumTitle"));
 // [END read_context_read_index]
 return resultSet;
}
origin: googleapis/google-cloud-java

@Test
public void indexEmptyRead() {
 ResultSet resultSet =
   client
     .singleUse(TimestampBound.strong())
     .readUsingIndex(
       TABLE_NAME,
       INDEX_NAME,
       KeySet.range(KeyRange.closedOpen(Key.of("v99"), Key.of("z"))),
       ALL_COLUMNS);
 assertThat(resultSet.next()).isFalse();
 assertThat(resultSet.getType()).isEqualTo(TABLE_TYPE);
}
origin: googleapis/google-cloud-java

     ? client
       .singleUse(TimestampBound.strong())
       .readUsingIndex(
         TABLE_NAME, INDEX_NAME, keySet, ALL_COLUMNS, Options.limit(limit))
     : client
       .singleUse(TimestampBound.strong())
       .readUsingIndex(TABLE_NAME, INDEX_NAME, keySet, ALL_COLUMNS);
 break;
case DESC_INDEX:
     ? client
       .singleUse(TimestampBound.strong())
       .readUsingIndex(
         TABLE_NAME, DESC_INDEX_NAME, keySet, ALL_COLUMNS, Options.limit(limit))
     : client
       .singleUse(TimestampBound.strong())
       .readUsingIndex(TABLE_NAME, DESC_INDEX_NAME, keySet, ALL_COLUMNS);
 break;
case BASE_TABLE:
origin: GoogleCloudPlatform/java-docs-samples

static void readUsingIndex(DatabaseClient dbClient) {
 ResultSet resultSet =
   dbClient
     .singleUse()
     .readUsingIndex(
       "Albums",
       "AlbumsByAlbumTitle",
       KeySet.all(),
       Arrays.asList("AlbumId", "AlbumTitle"));
 while (resultSet.next()) {
  System.out.printf("%d %s\n", resultSet.getLong(0), resultSet.getString(1));
 }
}
// [END spanner_read_data_with_index]
origin: GoogleCloudPlatform/java-docs-samples

static void readStoringIndex(DatabaseClient dbClient) {
 // We can read MarketingBudget also from the index since it stores a copy of MarketingBudget.
 ResultSet resultSet =
   dbClient
     .singleUse()
     .readUsingIndex(
       "Albums",
       "AlbumsByAlbumTitle2",
       KeySet.all(),
       Arrays.asList("AlbumId", "AlbumTitle", "MarketingBudget"));
 while (resultSet.next()) {
  System.out.printf(
    "%d %s %s\n",
    resultSet.getLong(0),
    resultSet.getString(1),
    resultSet.isNull("MarketingBudget") ? "NULL" : resultSet.getLong("MarketingBudget"));
 }
}
// [END spanner_read_data_with_storing_index]
origin: spring-cloud/spring-cloud-gcp

@Override
public ResultSet readUsingIndex(
    String s,
    String s1,
    KeySet keySet,
    Iterable<String> iterable,
    Options.ReadOption... readOptions) {
  return targetTransactionContext.readUsingIndex(s, s1, keySet, iterable, readOptions);
}
origin: org.springframework.cloud/spring-cloud-gcp-data-spanner

@Override
public ResultSet readUsingIndex(
    String s,
    String s1,
    KeySet keySet,
    Iterable<String> iterable,
    Options.ReadOption... readOptions) {
  return targetTransactionContext.readUsingIndex(s, s1, keySet, iterable, readOptions);
}
origin: com.google.cloud/google-cloud-spanner

@Override
public ResultSet readUsingIndex(
  String table, String index, KeySet keys, Iterable<String> columns, ReadOption... options) {
 return wrap(delegate.readUsingIndex(table, index, keys, columns, options));
}
origin: spring-cloud/spring-cloud-gcp

private ResultSet executeRead(String tableName, KeySet keys, Iterable<String> columns,
    SpannerReadOptions options) {
  long startTime = LOGGER.isDebugEnabled() ? System.currentTimeMillis() : 0;
  ResultSet resultSet;
  ReadContext readContext = (options != null && options.getTimestamp() != null)
      ? getReadContext(options.getTimestamp())
      : getReadContext();
  if (options == null) {
    resultSet = getReadContext().read(tableName, keys, columns);
  }
  else if (options.getIndex() != null) {
    resultSet = readContext.readUsingIndex(tableName, options.getIndex(), keys,
        columns, options.getReadOptions());
  }
  else {
    resultSet = readContext.read(tableName, keys, columns, options.getReadOptions());
  }
  if (LOGGER.isDebugEnabled()) {
    StringBuilder logs = logColumns(tableName, keys, columns);
    logReadOptions(options, logs);
    LOGGER.debug(logs.toString());
    LOGGER.debug("Read elapsed milliseconds: " + (System.currentTimeMillis() - startTime));
  }
  return resultSet;
}
origin: org.springframework.cloud/spring-cloud-gcp-data-spanner

resultSet = readContext.readUsingIndex(tableName, options.getIndex(), keys,
    columns, options.getReadOptions());
com.google.cloud.spannerReadContextreadUsingIndex

Javadoc

Reads zero or more rows from a database using an index.

Implementations may or may not block in the initial read(...) call; for those that do not, the remote call will be initiated immediately but blocking on the response is deferred to the first ResultSet#next() call. Regardless of blocking behavior, any SpannerException is deferred to the first or subsequent ResultSet#next() call.

 
ReadContext readContext = dbClient.singleUse();

Popular methods of ReadContext

  • executeQuery
    Executes a query against the database.Implementations may or may not block in the initial executeQue
  • read
    Reads zero or more rows from a database.Implementations may or may not block in the initial read(...
  • readRow
    Reads a single row from a database, returning null if the row does not exist. ReadContext readConte
  • readRowUsingIndex
    Reads a single row from a database using an index, returning null if the row does not exist. ReadCo
  • analyzeQuery
    Analyzes a query and returns query plan and/or query execution statistics information.The query plan
  • close
    Closes this read context and frees up the underlying resources.

Popular in Java

  • Reactive rest calls using spring rest template
  • getSharedPreferences (Context)
  • onCreateOptionsMenu (Activity)
  • setScale (BigDecimal)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • Runner (org.openjdk.jmh.runner)
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Github Copilot alternatives
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