How to use the druid-query-toolkit.sqlParserFactory function in druid-query-toolkit

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 / query-view.tsx View on Github external
QueryManager,
  SemiJoinQueryExplanation,
} from '../../utils';
import { ColumnMetadata } from '../../utils/column-metadata';
import { isEmptyContext, QueryContext } from '../../utils/query-context';
import { QueryRecord, QueryRecordUtil } from '../../utils/query-history';

import { ColumnTree } from './column-tree/column-tree';
import { QueryExtraInfo, QueryExtraInfoData } from './query-extra-info/query-extra-info';
import { QueryInput } from './query-input/query-input';
import { QueryOutput } from './query-output/query-output';
import { RunButton } from './run-button/run-button';

import './query-view.scss';

const parserRaw = sqlParserFactory(SQL_FUNCTIONS.map(sqlFunction => sqlFunction.name));

const parser = memoizeOne((sql: string) => {
  try {
    return parserRaw(sql);
  } catch {
    return;
  }
});

interface QueryWithContext {
  queryString: string;
  queryContext: QueryContext;
  wrapQueryLimit: number | undefined;
}

export interface QueryViewProps {