Ler usando um filtro de intervalo de valores (HBase)
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Cria um filtro limitante em um intervalo de valores de célula.
Mais informações
Para ver a documentação detalhada que inclui este exemplo de código, consulte:
Exemplo de código
Exceto em caso de indicação contrária, o conteúdo desta página é licenciado de acordo com a Licença de atribuição 4.0 do Creative Commons, e as amostras de código são licenciadas de acordo com a Licença Apache 2.0. Para mais detalhes, consulte as políticas do site do Google Developers. Java é uma marca registrada da Oracle e/ou afiliadas.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],[],[[["\u003cp\u003eThis code sample demonstrates how to use a filter to limit the range of cell values within a Bigtable table.\u003c/p\u003e\n"],["\u003cp\u003eThe filter utilizes \u003ccode\u003eValueFilter\u003c/code\u003e with \u003ccode\u003eGREATER_OR_EQUAL\u003c/code\u003e and \u003ccode\u003eLESS_OR_EQUAL\u003c/code\u003e comparison operators to define the upper and lower bounds of the desired value range.\u003c/p\u003e\n"],["\u003cp\u003eA \u003ccode\u003eFilterList\u003c/code\u003e with the \u003ccode\u003eMUST_PASS_ALL\u003c/code\u003e operator combines the two \u003ccode\u003eValueFilter\u003c/code\u003e instances to ensure only values falling within both defined limits are included.\u003c/p\u003e\n"],["\u003cp\u003eThe code uses a scan function with the created filter to read data from the table.\u003c/p\u003e\n"],["\u003cp\u003eThe code shows the setting of authentication and links to the page for more details.\u003c/p\u003e\n"]]],[],null,["# Read using a value range filter (HBase)\n\nCreates a limiting filter on a range of cell values.\n\nExplore further\n---------------\n\n\nFor detailed documentation that includes this code sample, see the following:\n\n- [Use filters](/bigtable/docs/using-filters)\n\nCode sample\n-----------\n\n### Java\n\n\nTo learn how to install and use the client library for Bigtable, see\n[Bigtable client libraries](/bigtable/docs/reference/libraries).\n\n\nTo authenticate to Bigtable, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n public static void filterLimitValueRange() {\n // TODO(developer): Replace these variables before running the sample.\n String projectId = \"my-project-id\";\n String instanceId = \"my-instance-id\";\n String tableId = \"mobile-time-series\";\n filterLimitValueRange(projectId, instanceId, tableId);\n }\n\n public static void filterLimitValueRange(String projectId, String instanceId, String tableId) {\n // A filter that matches cells whose values are between the given values\n ValueFilter valueGreaterFilter =\n new ValueFilter(\n CompareFilter.CompareOp.GREATER_OR_EQUAL,\n new BinaryComparator(Bytes.toBytes(\"PQ2A.190405\")));\n ValueFilter valueLesserFilter =\n new ValueFilter(\n CompareFilter.CompareOp.LESS_OR_EQUAL,\n new BinaryComparator(Bytes.toBytes(\"PQ2A.190406\")));\n\n FilterList filter = new FilterList(FilterList.Operator.MUST_PASS_ALL);\n filter.addFilter(valueGreaterFilter);\n filter.addFilter(valueLesserFilter);\n\n Scan scan = new Scan().setFilter(filter);\n readWithFilter(projectId, instanceId, tableId, scan);\n }\n\nWhat's next\n-----------\n\n\nTo search and filter code samples for other Google Cloud products, see the\n[Google Cloud sample browser](/docs/samples?product=bigtable)."]]