Skip to content

Commit

Permalink
SCARY EVIL CODE
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherswenson committed Dec 13, 2024
1 parent b6f1b4d commit d784aa4
Show file tree
Hide file tree
Showing 8 changed files with 620 additions and 171 deletions.
8 changes: 8 additions & 0 deletions packages/malloy/src/dialect/duckdb/dialect_functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ import {
OverloadedDefinitionBlueprint,
} from '../functions/util';

const array_first: DefinitionBlueprint = {
takes: {'value': {array: {generic: 'T'}}},
generic: ['T', ['any']],
returns: {generic: 'T'},
impl: {sql: 'list_extract(${value}, 1)'},
};

const dayname: DefinitionBlueprint = {
takes: {'date_value': ['date', 'timestamp']},
returns: 'string',
Expand Down Expand Up @@ -74,6 +81,7 @@ const string_agg_distinct: OverloadedDefinitionBlueprint = {
};

export const DUCKDB_DIALECT_FUNCTIONS: DefinitionBlueprintMap = {
array_first,
count_approx,
dayname,
to_timestamp,
Expand Down
62 changes: 62 additions & 0 deletions packages/malloy/src/dialect/duckdb/duckdb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,68 @@ export class DuckDBDialect extends PostgresBase {

getDialectFunctions(): {[name: string]: DialectFunctionOverloadDef[]} {
return expandBlueprintMap(DUCKDB_DIALECT_FUNCTIONS);
// {
// ...expandBlueprintMap(DUCKDB_DIALECT_FUNCTIONS),

Check failure on line 363 in packages/malloy/src/dialect/duckdb/duckdb.ts

View workflow job for this annotation

GitHub Actions / test-all (18.x)

Delete `··`
// 'test_foo': [
// {
// returnType: {
// type: 'generic',
// generic: 'T',
// expressionType: 'scalar',
// evalSpace: 'constant',
// },
// params: [
// {
// name: 'foo',
// allowedTypes: [
// {
// type: 'generic',
// generic: 'T',
// expressionType: 'scalar',
// evalSpace: 'constant',
// },
// ],
// isVariadic: false,
// },
// ],
// genericTypes: [
// {name: 'T', acceptibleTypes: [{type: 'string'}, {type: 'number'}]},
// ],
// e: {node: 'function_parameter', name: 'foo'},
// between: undefined,
// },
// ],
// 'test_first': [
// {
// returnType: {
// type: 'generic',
// generic: 'T',
// expressionType: 'scalar',
// evalSpace: 'constant',
// },
// params: [
// {
// name: 'foo',
// allowedTypes: [
// {
// type: 'array',
// elementTypeDef: {
// type: 'generic',
// generic: 'T',
// },
// expressionType: 'scalar',
// evalSpace: 'constant',
// },
// ],
// isVariadic: false,
// },
// ],
// genericTypes: [{name: 'T', acceptibleTypes: [{type: 'any'}]}],
// e: {node: 'function_parameter', name: 'foo'},
// between: undefined,
// },
// ],
// };
}

malloyTypeToSQLType(malloyType: AtomicTypeDef): string {
Expand Down
Loading

0 comments on commit d784aa4

Please sign in to comment.