Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow table creates to specific column types with the low level proto format #1518

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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