How to use druid-query-toolkit - 10 common examples

To help you get started, we’ve selected a few druid-query-toolkit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github apache / druid / web-console / src / views / query-view / column-tree / column-tree-menu / time-menu-items / time-menu-items.spec.tsx View on Github external
describe('time menu', () => {
  const parser = sqlParserFactory(['COUNT']);

  it('matches snapshot when menu is opened for column not inside group by', () => {
    const timeMenu = (
       {}}
      />
    );

    const { container } = render(timeMenu);
    expect(container).toMatchSnapshot();
  });

  it('matches snapshot when menu is opened for column inside group by', () => {
    const timeMenu = (
github apache / druid / web-console / src / views / query-view / query-output / query-output.spec.tsx View on Github external
it('matches snapshot', () => {
    const parser = sqlParserFactory(SQL_FUNCTIONS.map(sqlFunction => sqlFunction.name));

    const parsedQuery = parser(`SELECT
  "language",
  COUNT(*) AS "Count", COUNT(DISTINCT "language") AS "dist_language", COUNT(*) FILTER (WHERE "language"= 'xxx') AS "language_filtered_count"
FROM "github"
WHERE "__time" >= CURRENT_TIMESTAMP - INTERVAL '1' DAY AND "language" != 'TypeScript'
GROUP BY 1
HAVING "Count" != 37392
ORDER BY "Count" DESC`);

    const queryOutput = (
github apache / druid / web-console / src / views / query-view / column-tree / column-tree-menu / number-menu-items / number-menu-items.spec.tsx View on Github external
describe('number menu', () => {
  const parser = sqlParserFactory(['COUNT']);

  it('matches snapshot when menu is opened for column not inside group by', () => {
    const numberMenu = (
       {}}
      />
    );

    const { container } = render(numberMenu);
    expect(container).toMatchSnapshot();
  });

  it('matches snapshot when menu is opened for column inside group by', () => {
    const numberMenu = (
github apache / druid / web-console / src / views / query-view / column-tree / column-tree-menu / string-menu-items / string-menu-items.spec.tsx View on Github external
describe('string menu', () => {
  const parser = sqlParserFactory(['COUNT']);

  it('matches snapshot when menu is opened for column not inside group by', () => {
    const stringMenu = (
       {}}
      />
    );

    const { container } = render(stringMenu);
    expect(container).toMatchSnapshot();
  });

  it('matches snapshot when menu is opened for column inside group by', () => {
    const stringMenu = (
github apache / druid / web-console / src / views / query-view / column-tree / column-tree.spec.tsx View on Github external
describe('column tree', () => {
  const parser = sqlParserFactory(['COUNT']);

  it('matches snapshot', () => {
    const columnTree = (
       {
          return parser(`SELECT channel, count(*) as cnt FROM wikipedia GROUP BY 1`);
        }}
        defaultSchema="druid"
        defaultTable="wikipedia"
        columnMetadataLoading={false}
        columnMetadata={
          [
            {
              TABLE_SCHEMA: 'druid',
              TABLE_NAME: 'wikipedia',
              COLUMN_NAME: '__time',
github apache / druid / web-console / src / views / query-view / column-tree / column-tree-menu / time-menu-items / time-menu-items.tsx View on Github external
function dateToTimestamp(date: Date): Timestamp {
  return timestampFactory(
    date
      .toISOString()
      .split('.')[0]
      .split('T')
      .join(' '),
  );
}
github apache / druid / web-console / src / views / query-view / column-tree / column-tree-menu / time-menu-items / time-menu-items.tsx View on Github external
onClick={() => {
            onQueryChange(
              parsedQuery.addFunctionToGroupBy(
                'TIME_FLOOR',
                [' '],
                [stringFactory(columnName, `"`), stringFactory('PT1H', `'`)],
                aliasFactory(`${columnName}_time_floor`),
              ),
              true,
            );
          }}
        />
github apache / druid / web-console / src / views / query-view / column-tree / column-tree-menu / string-menu-items / string-menu-items.tsx View on Github external
'COUNT',
                aliasFactory(`${columnName}_filtered_count`),
                false,
                new FilterClause({
                  keyword: 'FILTER',
                  spacing: [' '],
                  ex: new WhereClause({
                    keyword: 'WHERE',
                    spacing: [' '],
                    filter: new ComparisonExpression({
                      parens: [],
                      ex: stringFactory(columnName, '"'),
                      rhs: new ComparisonExpressionRhs({
                        parens: [],
                        op: '=',
                        rhs: stringFactory('xxx', `'`),
                        spacing: [' ', ' '],
                      }),
                    }),
                  }),
                }),
              ),
            );
          }}
        />
github apache / druid / web-console / src / views / query-view / column-tree / column-tree-menu / time-menu-items / time-menu-items.tsx View on Github external
onClick={() => {
            onQueryChange(
              parsedQuery.addFunctionToGroupBy(
                'TIME_FLOOR',
                [' '],
                [stringFactory(columnName, `"`), stringFactory('P1D', `'`)],
                aliasFactory(`${columnName}_time_floor`),
              ),
              true,
            );
          }}
        />
github apache / druid / web-console / src / views / query-view / column-tree / column-tree-menu / time-menu-items / time-menu-items.tsx View on Github external
onClick={() => {
            onQueryChange(
              parsedQuery.addFunctionToGroupBy(
                'TIME_FLOOR',
                [' '],
                [stringFactory(columnName, `"`), stringFactory('P7D', `'`)],
                aliasFactory(`${columnName}_time_floor`),
              ),
              true,
            );
          }}
        />