Exemplo n.º 1
0
        // [END bigtable_filters_composing_chain]

        // [START bigtable_filters_composing_interleave]
        /// <summary>
        /// /// Read using an interleave filter from an existing table.
        ///</summary>
        /// <param name="projectId">Your Google Cloud Project ID.</param>
        /// <param name="instanceId">Your Google Cloud Bigtable Instance ID.</param>
        /// <param name="tableId">Your Google Cloud Bigtable table ID.</param>

        public string filterComposingInterleave(
            String projectId, String instanceId, String tableId)
        {
            // A filter that matches cells with the value true OR with the column qualifier os_build
            RowFilter filter = RowFilters.Interleave(RowFilters.ValueExact("true"), RowFilters.ColumnQualifierExact("os_build"));

            return(readFilter(projectId, instanceId, tableId, filter));
        }
Exemplo n.º 2
0
        public void Chain()
        {
            var filter = RowFilters.Chain(
                RowFilters.CellsPerRowLimit(1),
                RowFilters.ValueExact("abc"));

            Assert.NotNull(filter.Chain);
            Assert.Equal(2, filter.Chain.Filters.Count);
            Assert.Equal(RowFilters.CellsPerRowLimit(1), filter.Chain.Filters[0]);
            Assert.Equal(RowFilters.ValueExact("abc"), filter.Chain.Filters[1]);
        }
Exemplo n.º 3
0
        public void Interleave()
        {
            var filter = RowFilters.Interleave(
                RowFilters.CellsPerRowLimit(1),
                RowFilters.ValueExact("abc"));

            Assert.NotNull(filter.Interleave);
            Assert.Equal(2, filter.Interleave.Filters.Count);
            Assert.Equal(RowFilters.CellsPerRowLimit(1), filter.Interleave.Filters[0]);
            Assert.Equal(RowFilters.ValueExact("abc"), filter.Interleave.Filters[1]);
        }
Exemplo n.º 4
0
        // [END bigtable_filters_composing_interleave]

        // [START bigtable_filters_composing_condition]
        /// <summary>
        /// /// Read using a conditional filter from an existing table.
        ///</summary>
        /// <param name="projectId">Your Google Cloud Project ID.</param>
        /// <param name="instanceId">Your Google Cloud Bigtable Instance ID.</param>
        /// <param name="tableId">Your Google Cloud Bigtable table ID.</param>

        public string filterComposingCondition(string projectId = "YOUR-PROJECT-ID", string instanceId = "YOUR-INSTANCE-ID", string tableId = "YOUR-TABLE-ID")
        {
            // A filter that applies the label passed-filter IF the cell has the column qualifier
            // data_plan_10gb AND the value true, OTHERWISE applies the label filtered-out
            RowFilter filter = RowFilters.Condition(
                RowFilters.Chain(RowFilters.ColumnQualifierExact("data_plan_10gb"), RowFilters.ValueExact("true")),
                new RowFilter {
                ApplyLabelTransformer = "passed-filter"
            },
                new RowFilter {
                ApplyLabelTransformer = "filtered-out"
            }
                );

            return(readFilter(projectId, instanceId, tableId, filter));
        }
Exemplo n.º 5
0
        public void ValueExact()
        {
            var filter = RowFilters.ValueExact("a\\b\0c\t");

            Assert.Equal(ByteString.CopyFromUtf8(@"a\\b\x00c\	"), filter.ValueRegexFilter);
        }