ronantakizawa/codereview-bench huggingface dataset:
Repository: diegomura/react-pdf
File: packages/image/src/resolve.js (JavaScript)

Code before:

  const isJpg = body[0] === 255 && body[1] === 216 && body[2] === 255;

  let extension = '';
  if (isPng) {
    extension = 'png';
  } else if (isJpg) {
    extension = 'jpg';
  } else {
    throw new Error('Not valid image extension');
  }

  return extension;
};

const resolveImageFromUrl = async src => {
  const { uri, body, headers, method = 'GET', credentials } = src;

  const data =
    !BROWSER && getAbsoluteLocalPath(uri)
      ? await fetchLocalFile(uri)
      : await fetchRemoteFile(uri, {
          body,
          headers,
          method,
          ...(credentials && { credentials }),
        });

  const extension = getImageFormat(data);

  return getImage(data, extension);
};

const resolveImage = (src, { cache = true } = {}) => {
  let image;
  const cacheKey = src.data ? src.data.toString() : src.uri;

  if (Buffer.isBuffer(src)) {
    image = resolveBufferImage(src);
  } else if (cache && IMAGE_CACHE.get(cacheKey)) {
    return IMAGE_CACHE.get(cacheKey);
  } else if (isCompatibleBase64(src)) {
    image = resolveBase64Image(src);
  } else if (typeof src === 'object' && src.data) {
    image = resolveImageFromData(src);
  } else {
    image = resolveImageFromUrl(src);
  }

  if (!image) {
    throw new Error('Cannot resolve image');

Review comment (security):
Can this construction be just a `credentials`? is empty key break fetch default?

```suggestion
          credentials,
```

Code after:

  const isJpg = body[0] === 255 && body[1] === 216 && body[2] === 255;

  let extension = '';
  if (isPng) {
    extension = 'png';
  } else if (isJpg) {
    extension = 'jpg';
  } else {
    throw new Error('Not valid image extension');
  }

  return extension;
};

const resolveImageFromUrl = async src => {
  const { uri, body, headers, method = 'GET', credentials } = src;

  const data =
    !BROWSER && getAbsoluteLocalPath(uri)
      ? await fetchLocalFile(uri)
      : await fetchRemoteFile(uri, {
          body,
          headers,
          method,
          credentials,
        });

  const extension = getImageFormat(data);

  return getImage(data, extension);
};

const resolveImage = (src, { cache = true } = {}) => {
  let image;
  const cacheKey = src.data ? src.data.toString() : src.uri;

  if (Buffer.isBuffer(src)) {
    image = resolveBufferImage(src);
  } else if (cache && IMAGE_CACHE.get(cacheKey)) {
    return IMAGE_CACHE.get(cacheKey);
  } else if (isCompatibleBase64(src)) {
    image = resolveBase64Image(src);
  } else if (typeof src === 'object' && src.data) {
    image = resolveImageFromData(src);
  } else {
    image = resolveImageFromUrl(src);
  }

  if (!image) {
    throw new Error('Cannot resolve image');
Repository: diegomura/react-pdf
File: packages/image/tests/resolve.test.js (JavaScript)

Code before:

    const image1 = await resolveImage({ uri: jpgImageUrl });
    const image2 = await resolveImage({ uri: jpgImageUrl });

    expect(image1).toBe(image2);
  });

  test('Should not cache previously loaded local images if flag false', async () => {
    fetch.mockResponse(localJPGImage);

    const image1 = await resolveImage(localJPGImage, { cache: false });
    const image2 = await resolveImage(localJPGImage, { cache: false });

    expect(image1).not.toBe(image2);
  });

  test('Should render a blob image', async () => {
    const blob = new Blob([localJPGImage], { type: 'image/jpeg' });
    const image = await resolveImage(blob);

    expect(image.data).toBeTruthy();
    expect(image.width).toBeGreaterThan(0);
    expect(image.height).toBeGreaterThan(0);
  });

  test('Should render a blob whithout type', async () => {
    const blob = new Blob([localJPGImage]);
    const image = await resolveImage(blob);

    expect(image.data).toBeTruthy();
    expect(image.width).toBeGreaterThan(0);
    expect(image.height).toBeGreaterThan(0);
  });

  test('Should render a blob image with type application/octet-stream', async () => {
    const blob = new Blob([localJPGImage], {
      type: 'application/octet-stream',
    });
    const image = await resolveImage(blob);

    expect(image.data).toBeTruthy();
    expect(image.width).toBeGreaterThan(0);
    expect(image.height).toBeGreaterThan(0);
  });
});


Review comment (suggestion):
```suggestion
  test('Should render a blob without type', async () => {
```

Code after:

    const image1 = await resolveImage({ uri: jpgImageUrl });
    const image2 = await resolveImage({ uri: jpgImageUrl });

    expect(image1).toBe(image2);
  });

  test('Should not cache previously loaded local images if flag false', async () => {
    fetch.mockResponse(localJPGImage);

    const image1 = await resolveImage(localJPGImage, { cache: false });
    const image2 = await resolveImage(localJPGImage, { cache: false });

    expect(image1).not.toBe(image2);
  });

  test('Should render a blob image', async () => {
    const blob = new Blob([localJPGImage], { type: 'image/jpeg' });
    const image = await resolveImage(blob);

    expect(image.data).toBeTruthy();
    expect(image.width).toBeGreaterThan(0);
    expect(image.height).toBeGreaterThan(0);
  });

  test('Should render a blob without type', async () => {
    const blob = new Blob([localJPGImage]);
    const image = await resolveImage(blob);

    expect(image.data).toBeTruthy();
    expect(image.width).toBeGreaterThan(0);
    expect(image.height).toBeGreaterThan(0);
  });

  test('Should render a blob image with type application/octet-stream', async () => {
    const blob = new Blob([localJPGImage], {
      type: 'application/octet-stream',
    });
    const image = await resolveImage(blob);

    expect(image.data).toBeTruthy();
    expect(image.width).toBeGreaterThan(0);
    expect(image.height).toBeGreaterThan(0);
  });
});
Repository: diegomura/react-pdf
File: packages/examples/src/index.jsx (JavaScript)

Code before:
import React from 'react';
import { createRoot } from 'react-dom/client';

import { PDFViewer } from '@react-pdf/renderer'

import Document from './jpgOrientation'

import './index.css'

const DocumentWrapper = () => {
  return (
    <>
      <PDFViewer>
        <Document />
      </PDFViewer>
    </>
  )
}

const MOUNT_ELEMENT = document.createElement('div');

document.body.appendChild(MOUNT_ELEMENT);

const root = createRoot(MOUNT_ELEMENT); // createRoot(container!) if you use TypeScript

root.render(<DocumentWrapper />);


Review comment (suggestion):
```suggestion
import Document from './pageWrap'
```

Code after:
import React from 'react';
import { createRoot } from 'react-dom/client';

import { PDFViewer } from '@react-pdf/renderer';

import Document from './pageWrap';

import './index.css';

const DocumentWrapper = () => {
  return (
    <>
      <PDFViewer>
        <Document />
      </PDFViewer>
    </>
  );
};

const MOUNT_ELEMENT = document.createElement('div');

document.body.appendChild(MOUNT_ELEMENT);

const root = createRoot(MOUNT_ELEMENT); // createRoot(container!) if you use TypeScript

root.render(<DocumentWrapper />);
Repository: diegomura/react-pdf
File: packages/layout/src/text/fontSubstitution.js (JavaScript)

Code before:
  return getFallbackFont();
};

const fontSubstitution =
  () =>
  ({ string, runs }) => {
    let lastFont = null;
    let lastFontSize = null;
    let lastIndex = 0;
    let index = 0;

    const res = [];

    for (let i = 0; i < runs.length; i += 1) {
      const run = runs[i];

      const defaultFont = run.attributes.font.map((font) =>
        typeof font === 'string' ? getOrCreateFont(font) : font,
      );

      if (string.length === 0) {
        res.push({ start: 0, end: 0, attributes: { font: defaultFont } });
        break;
      }

      const chars = [...string.slice(run.start, run.end)];

      for (let j = 0; j < chars.length; j += 1) {
        const char = chars[j];
        const codePoint = char.codePointAt();
        // If the default font does not have a glyph and the fallback font does, we use it
        const font = pickFontFromFontStack(codePoint, defaultFont, lastFont);
        const fontSize = getFontSize(run);

        // If anything that would impact res has changed, update it
        if (
          font !== lastFont ||
          fontSize !== lastFontSize ||
          font.unitsPerEm !== lastFont.unitsPerEm
        ) {
          if (lastFont) {
            res.push({
              start: lastIndex,
              end: index,
              attributes: {
                font: lastFont,
                scale: lastFontSize / lastFont.unitsPerEm,
              },
            });
          }


Review comment (suggestion):
```suggestion
      const chars = string.slice(run.start, run.end);
```

Code after:
  return getFallbackFont();
};

const fontSubstitution =
  () =>
  ({ string, runs }) => {
    let lastFont = null;
    let lastFontSize = null;
    let lastIndex = 0;
    let index = 0;

    const res = [];

    for (let i = 0; i < runs.length; i += 1) {
      const run = runs[i];

      const defaultFont = run.attributes.font.map((font) =>
        typeof font === 'string' ? getOrCreateFont(font) : font,
      );

      if (string.length === 0) {
        res.push({ start: 0, end: 0, attributes: { font: defaultFont } });
        break;
      }

      const chars = string.slice(run.start, run.end);

      for (let j = 0; j < chars.length; j += 1) {
        const char = chars[j];
        const codePoint = char.codePointAt();
        // If the default font does not have a glyph and the fallback font does, we use it
        const font = pickFontFromFontStack(codePoint, defaultFont, lastFont);
        const fontSize = getFontSize(run);

        // If anything that would impact res has changed, update it
        if (
          font !== lastFont ||
          fontSize !== lastFontSize ||
          font.unitsPerEm !== lastFont.unitsPerEm
        ) {
          if (lastFont) {
            res.push({
              start: lastIndex,
              end: index,
              attributes: {
                font: lastFont,
                scale: lastFontSize / lastFont.unitsPerEm,
              },
            });
          }
Repository: diegomura/react-pdf
File: packages/layout/src/page/getSize.js (JavaScript)

Code before:
import isLandscape from './isLandscape';

// page sizes for 72dpi. 72dpi is used internally by pdfkit
const PAGE_SIZES = {
  '4A0': [4767.87, 6740.79],
  '2A0': [3370.39, 4767.87],
  A0: [2383.94, 3370.39],
  A1: [1683.78, 2383.94],
  A2: [1190.55, 1683.78],
  A3: [841.89, 1190.55],
  A4: [595.28, 841.89],
  A5: [419.53, 595.28],
  A6: [297.64, 419.53],
  A7: [209.76, 297.64],
  A8: [147.4, 209.76],
  A9: [104.88, 147.4],
  A10: [73.7, 104.88],
  B0: [2834.65, 4008.19],
  B1: [2004.09, 2834.65],
  B2: [1417.32, 2004.09],
  B3: [1000.63, 1417.32],
  B4: [708.66, 1000.63],
  B5: [498.9, 708.66],
  B6: [354.33, 498.9],
  B7: [249.45, 354.33],
  B8: [175.75, 249.45],
  B9: [124.72, 175.75],
  B10: [87.87, 124.72],

Review comment (suggestion):
```suggestion
// Page sizes for 72dpi. 72dpi is used internally by pdfkit.
```

Code after:
import isLandscape from './isLandscape';

// Page sizes for 72dpi. 72dpi is used internally by pdfkit.
const PAGE_SIZES = {
  '4A0': [4767.87, 6740.79],
  '2A0': [3370.39, 4767.87],
  A0: [2383.94, 3370.39],
  A1: [1683.78, 2383.94],
  A2: [1190.55, 1683.78],
  A3: [841.89, 1190.55],
  A4: [595.28, 841.89],
  A5: [419.53, 595.28],
  A6: [297.64, 419.53],
  A7: [209.76, 297.64],
  A8: [147.4, 209.76],
  A9: [104.88, 147.4],
  A10: [73.7, 104.88],
  B0: [2834.65, 4008.19],
  B1: [2004.09, 2834.65],
  B2: [1417.32, 2004.09],
  B3: [1000.63, 1417.32],
  B4: [708.66, 1000.63],
  B5: [498.9, 708.66],
  B6: [354.33, 498.9],
  B7: [249.45, 354.33],
  B8: [175.75, 249.45],
  B9: [124.72, 175.75],
  B10: [87.87, 124.72],
Repository: diegomura/react-pdf
File: packages/layout/tests/steps/resolveBookmarks.test.ts (TypeScript)

Code before:
import { describe, expect, test } from 'vitest';

import resolveBookmarks from '../../src/steps/resolveBookmarks';
import { DocumentNode } from '../../src/types';

describe('layout resolveBookmarks', () => {
  test('should keep nodes the same if no bookmark passed', () => {
    const root = {
      type: 'DOCUMENT',
      props: {},
      children: [
        {
          type: 'PAGE',
          children: [{ type: 'VIEW', props: {} }],
        },
      ],
    } as DocumentNode;

    const result = resolveBookmarks(root);

    expect(result).toEqual(root);
  });

  test('should resolve bookmark in page node', () => {
    const result = resolveBookmarks({
      type: 'DOCUMENT',
      props: {},
      children: [
        {
          type: 'PAGE',
          props: { bookmark: 'page' },
          children: [{ type: 'VIEW', props: {} }],
        },
      ],
    });

    expect(result.children?.[0]?.props?.bookmark).toEqual({
      ref: 0,
      title: 'page',
      fit: false,
      expanded: false,
    });
  });

  test('should resolve bookmark hierarchy', () => {
    const result = resolveBookmarks({

Review comment (suggestion):
Unrelated to the fix, but updated this test to test against a new variable instance. The previous test would always pass because the original `root` variable would get mutated.

Code after:
import { describe, expect, test } from 'vitest';

import resolveBookmarks from '../../src/steps/resolveBookmarks';
import { DocumentNode } from '../../src/types';

describe('layout resolveBookmarks', () => {
  test('should keep nodes the same if no bookmark passed', () => {
    const root = {
      type: 'DOCUMENT',
      props: {},
      children: [
        {
          type: 'PAGE',
          children: [{ type: 'VIEW', props: {} }],
        },
      ],
    } as DocumentNode;

    const result = resolveBookmarks(root);

    expect(result).toEqual({
      type: 'DOCUMENT',
      props: {},
      children: [
        {
          type: 'PAGE',
          children: [{ type: 'VIEW', props: {} }],
        },
      ],
    });
  });

  test('should keep nodes the same if an undefined bookmark passed', () => {
    const root = {
      type: 'DOCUMENT',
      props: {},
      children: [
        {
          type: 'PAGE',
          props: { bookmark: undefined },
          children: [{ type: 'VIEW', props: {} }],
        },
      ],
    } as DocumentNode;

    const result = resolveBookmarks(root);
Repository: diesel-rs/diesel
File: diesel_tests/tests/debug/mod.rs (Rust)

Code before:
use crate::schema::TestBackend;
use diesel::upsert::DecoratableTarget;
use diesel::*;

#[test]
fn test_debug_count_output() {
    use crate::schema::users::dsl::*;
    let sql = debug_query::<TestBackend, _>(&users.count()).to_string();
    if cfg!(feature = "postgres") {
        assert_eq!(sql, r#"SELECT COUNT(*) FROM "users" -- binds: []"#);
    } else {
        assert_eq!(sql, "SELECT COUNT(*) FROM `users` -- binds: []");
    }
}

#[test]
fn test_debug_output() {
    use crate::schema::users::dsl::*;
    let command = update(users.filter(id.eq(1))).set(name.eq("new_name"));
    let sql = debug_query::<TestBackend, _>(&command).to_string();
    if cfg!(feature = "postgres") {
        assert_eq!(
            sql,
            r#"UPDATE "users" SET "name" = $1 WHERE "users"."id" = $2 -- binds: ["new_name", 1]"#
        )
    } else {
        assert_eq!(

Review comment (suggestion):
To resolve this to make it so `use diesel::*` also pulls in the `DecoratableTarget`, you should add the trait as a public reexport in `lib.rs` of Diesel in the inline `prelude` module.

See this for more details: https://github.com/diesel-rs/diesel/blob/master/diesel/src/lib.rs#L308

Code after:
use crate::schema::TestBackend;
use diesel::*;

#[test]
fn test_debug_count_output() {
    use crate::schema::users::dsl::*;
    let sql = debug_query::<TestBackend, _>(&users.count()).to_string();
    if cfg!(feature = "postgres") {
        assert_eq!(sql, r#"SELECT COUNT(*) FROM "users" -- binds: []"#);
    } else {
        assert_eq!(sql, "SELECT COUNT(*) FROM `users` -- binds: []");
    }
}

#[test]
fn test_debug_output() {
    use crate::schema::users::dsl::*;
    let command = update(users.filter(id.eq(1))).set(name.eq("new_name"));
    let sql = debug_query::<TestBackend, _>(&command).to_string();
    if cfg!(feature = "postgres") {
        assert_eq!(
            sql,
            r#"UPDATE "users" SET "name" = $1 WHERE "users"."id" = $2 -- binds: ["new_name", 1]"#
        )
    } else {
        assert_eq!(
            sql,
Repository: diesel-rs/diesel
File: diesel/src/query_builder/upsert/on_conflict_target_decorations.rs (Rust)

Code before:
    where_clause: U,
}

impl<T, P> DecoratableTarget<P> for T
where
    P: Expression,
    P::SqlType: BoolOrNullableBool,
    T: UndecoratedConflictTarget,
{
    type FilterOutput = DecoratedConflictTarget<T, WhereClause<P>>;
    fn filter_target(self, predicate: P) -> Self::FilterOutput {
        DecoratedConflictTarget {
            target: self,
            where_clause: NoWhereClause.and(predicate),
        }
    }
}

impl<T, U, P> DecoratableTarget<P> for DecoratedConflictTarget<T, U>
where
    P: Expression,
    P::SqlType: BoolOrNullableBool,
    U: WhereAnd<P>,
{
    type FilterOutput = DecoratedConflictTarget<T, <U as WhereAnd<P>>::Output>;
    fn filter_target(self, predicate: P) -> Self::FilterOutput {
        DecoratedConflictTarget {
            target: self.target,
            where_clause: self.where_clause.and(predicate),
        }
    }
}

impl<DB, T, U> QueryFragment<DB> for DecoratedConflictTarget<T, U>
where
    T: QueryFragment<DB>,
    U: QueryFragment<DB>,
    DB: Backend + SupportsOnConflictClause + SupportsOnConflictTargetDecorations,
{
    fn walk_ast(&self, mut out: AstPass<DB>) -> QueryResult<()> {
        self.target.walk_ast(out.reborrow())?;
        self.where_clause.walk_ast(out.reborrow())?;
        Ok(())
    }
}


Review comment (suggestion):
```suggestion
    type FilterOutput = DecoratedConflictTarget<T, <U as WhereAnd<P>>::Output>;
    
```

Code after:
    where_clause: U,
}

impl<T, P> DecoratableTarget<P> for T
where
    P: Expression,
    P::SqlType: BoolOrNullableBool,
    T: UndecoratedConflictTarget,
{
    type FilterOutput = DecoratedConflictTarget<T, WhereClause<P>>;

    fn filter_target(self, predicate: P) -> Self::FilterOutput {
        DecoratedConflictTarget {
            target: self,
            where_clause: NoWhereClause.and(predicate),
        }
    }
}

impl<T, U, P> DecoratableTarget<P> for DecoratedConflictTarget<T, U>
where
    P: Expression,
    P::SqlType: BoolOrNullableBool,
    U: WhereAnd<P>,
{
    type FilterOutput = DecoratedConflictTarget<T, <U as WhereAnd<P>>::Output>;

    fn filter_target(self, predicate: P) -> Self::FilterOutput {
        DecoratedConflictTarget {
            target: self.target,
            where_clause: self.where_clause.and(predicate),
        }
    }
}

impl<DB, T, U> QueryFragment<DB> for DecoratedConflictTarget<T, U>
where
    T: QueryFragment<DB>,
    U: QueryFragment<DB>,
    DB: Backend + SupportsOnConflictClause + SupportsOnConflictTargetDecorations,
{
    fn walk_ast(&self, mut out: AstPass<DB>) -> QueryResult<()> {
        self.target.walk_ast(out.reborrow())?;
        self.where_clause.walk_ast(out.reborrow())?;
        Ok(())
    }
}
Repository: diesel-rs/diesel
File: diesel/src/expression/count.rs (Rust)

Code before:
use std::marker::PhantomData;

use super::{functions::sql_function, is_aggregate, AsExpression};
use super::{Expression, ValidGrouping};
use crate::query_builder::*;
use crate::result::QueryResult;
use crate::sql_types::{BigInt, DieselNumericOps, SingleValue, SqlType};
use crate::{backend::Backend, AppearsOnTable, SelectableExpression};

sql_function! {
    /// Creates a SQL `COUNT` expression
    ///
    /// As with most bare functions, this is not exported by default. You can import
    /// it specifically as `diesel::dsl::count`, or glob import
    /// `diesel::dsl::*`
    ///
    /// # Examples
    ///
    /// ```rust
    /// # include!("../doctest_setup.rs");
    /// # use diesel::dsl::*;
    /// #
    /// # fn main() {
    /// #     use schema::animals::dsl::*;
    /// #     let connection = establish_connection();
    /// assert_eq!(Ok(1), animals.select(count(name)).first(&connection));
    /// # }
    /// ```

Review comment (suggestion):
This should follow the general use statement style in diesel

```suggestion
use super::functions::sql_function;
use super::{is_aggregate, AsExpression};
```

Code after:
use std::marker::PhantomData;

use super::functions::sql_function;
use super::{is_aggregate, AsExpression};
use super::{Expression, ValidGrouping};
use crate::backend::Backend;
use crate::query_builder::*;
use crate::result::QueryResult;
use crate::sql_types::{BigInt, DieselNumericOps, SingleValue, SqlType};
use crate::{AppearsOnTable, SelectableExpression};

sql_function! {
    /// Creates a SQL `COUNT` expression
    ///
    /// As with most bare functions, this is not exported by default. You can import
    /// it specifically as `diesel::dsl::count`, or glob import
    /// `diesel::dsl::*`
    ///
    /// # Examples
    ///
    /// ```rust
    /// # include!("../doctest_setup.rs");
    /// # use diesel::dsl::*;
    /// #
    /// # fn main() {
    /// #     use schema::animals::dsl::*;
    /// #     let connection = establish_connection();
    /// assert_eq!(Ok(1), animals.select(count(name)).first(&connection));
Repository: diesel-rs/diesel
File: diesel/src/expression/count.rs (Rust)

Code before:
use std::marker::PhantomData;

use super::{functions::sql_function, is_aggregate, AsExpression};
use super::{Expression, ValidGrouping};
use crate::query_builder::*;
use crate::result::QueryResult;
use crate::sql_types::{BigInt, DieselNumericOps, SingleValue, SqlType};
use crate::{backend::Backend, AppearsOnTable, SelectableExpression};

sql_function! {
    /// Creates a SQL `COUNT` expression
    ///
    /// As with most bare functions, this is not exported by default. You can import
    /// it specifically as `diesel::dsl::count`, or glob import
    /// `diesel::dsl::*`
    ///
    /// # Examples
    ///
    /// ```rust
    /// # include!("../doctest_setup.rs");
    /// # use diesel::dsl::*;
    /// #
    /// # fn main() {
    /// #     use schema::animals::dsl::*;
    /// #     let connection = establish_connection();
    /// assert_eq!(Ok(1), animals.select(count(name)).first(&connection));
    /// # }
    /// ```
    #[aggregate]
    fn count<T: SqlType + SingleValue>(expr: T) -> BigInt;
}

/// Creates a SQL `COUNT(*)` expression

Review comment (suggestion):
Same as above:

```suggestion
use crate::backend::Backend;
use crate::{AppearsOnTable, SelectableExpression};
```

Code after:
use std::marker::PhantomData;

use super::functions::sql_function;
use super::{is_aggregate, AsExpression};
use super::{Expression, ValidGrouping};
use crate::backend::Backend;
use crate::query_builder::*;
use crate::result::QueryResult;
use crate::sql_types::{BigInt, DieselNumericOps, SingleValue, SqlType};
use crate::{AppearsOnTable, SelectableExpression};

sql_function! {
    /// Creates a SQL `COUNT` expression
    ///
    /// As with most bare functions, this is not exported by default. You can import
    /// it specifically as `diesel::dsl::count`, or glob import
    /// `diesel::dsl::*`
    ///
    /// # Examples
    ///
    /// ```rust
    /// # include!("../doctest_setup.rs");
    /// # use diesel::dsl::*;
    /// #
    /// # fn main() {
    /// #     use schema::animals::dsl::*;
    /// #     let connection = establish_connection();
    /// assert_eq!(Ok(1), animals.select(count(name)).first(&connection));
    /// # }
    /// ```
    #[aggregate]
    fn count<T: SqlType + SingleValue>(expr: T) -> BigInt;
}