Skip to content

Conversation

@airhorns
Copy link

@airhorns airhorns commented Nov 8, 2024

Without this, table creates can't specify a value type ever, which is required if you want to use AddToCell mutations for server-side aggregations. With this in place, the call to create a table with an aggregated value type is nasty, but possible. Here's what it would look like:

const int64Type: google.bigtable.v2.IType = {
  int64Type: {
    encoding: { bigEndianBytes: {} },
  },
};

bigtable.table("some_table").create({
  families: [
    {
      name: "aggregations",
      rule: {
        versions: 1,
      },
      // hacky specification of the column family aggregation type -- the JS client doesn't have support for these types, but putting this here passes it down to the eventual protobuf call the client makes
      valueType: {
        aggregateType: {
          inputType: int64Type,
          stateType: int64Type,
          sum: {},
        },
      },
    },
  ],
});

I'm not exactly sure what the policy is around features of this nature, but it seems busted to me to not allow calls to specify this level of schema at all and have to go through some other system like cbt to create tables with specific value types, but I'm open to feedback!

… proto format

Without this, table creates can't specify a value type ever, which is required if you want to use `AddToCell` mutations for server-side aggregations. With this in place, the call to create a table with an aggregated value type is nasty, but possible. Here's what it would look like:

```
const int64Type: google.bigtable.v2.IType = {
  int64Type: {
    encoding: { bigEndianBytes: {} },
  },
};

bigtable.table("some_table").create({
  families: [
    {
      name: "aggregations",
      rule: {
        versions: 1,
      },
      // hacky specification of the column family aggregation type -- the JS client doesn't have support for these types, but putting this here passes it down to the eventual protobuf call the client makes
      valueType: {
        aggregateType: {
          inputType: int64Type,
          stateType: int64Type,
          sum: {},
        },
      },
    },
  ],
});
```
@airhorns airhorns marked this pull request as ready for review November 8, 2024 23:56
@airhorns airhorns requested review from a team as code owners November 8, 2024 23:56
@product-auto-label product-auto-label bot added size: xs Pull request size is extra small. api: bigtable Issues related to the googleapis/nodejs-bigtable API. labels Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigtable Issues related to the googleapis/nodejs-bigtable API. size: xs Pull request size is extra small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant