@@ -575,10 +575,7 @@ export class ClickHousePrinter {
575575 * @param collectMetadata - Whether to collect column metadata
576576 * @returns Array of SQL column strings, or null if not an asterisk
577577 */
578- private expandAsterisk (
579- chain : Array < string | number > ,
580- collectMetadata : boolean
581- ) : string [ ] | null {
578+ private expandAsterisk ( chain : Array < string | number > , collectMetadata : boolean ) : string [ ] | null {
582579 // Check for SELECT * (chain: ["*"])
583580 if ( chain . length === 1 && chain [ 0 ] === "*" ) {
584581 return this . expandAllTableColumns ( collectMetadata ) ;
@@ -667,7 +664,9 @@ export class ClickHousePrinter {
667664
668665 // If the column has a different internal name, add an alias
669666 if ( clickhouseName !== columnName ) {
670- sqlResult = `${ this . printIdentifier ( clickhouseName ) } AS ${ this . printIdentifier ( columnName ) } ` ;
667+ sqlResult = `${ this . printIdentifier ( clickhouseName ) } AS ${ this . printIdentifier (
668+ columnName
669+ ) } `;
671670 } else {
672671 sqlResult = this . printIdentifier ( columnName ) ;
673672 }
@@ -702,7 +701,7 @@ export class ClickHousePrinter {
702701 */
703702 private analyzeSelectColumn ( col : Expression ) : {
704703 outputName : string | null ;
705- sourceColumn : ColumnSchema | null ;
704+ sourceColumn : Partial < ColumnSchema > | null ;
706705 inferredType : ClickHouseType | null ;
707706 } {
708707 // Handle Alias - the output name is the alias
@@ -735,9 +734,19 @@ export class ClickHousePrinter {
735734 // For value-preserving aggregates (SUM, AVG, MIN, MAX), propagate customRenderType
736735 // from the source column. COUNT and other aggregates return counts, not values,
737736 // so they shouldn't inherit the source column's render type.
738- const valuePreservingAggregates = [ "sum" , "sumif" , "avg" , "avgif" , "min" , "minif" , "max" , "maxif" ] ;
737+ const valuePreservingAggregates = [
738+ "sum" ,
739+ "sumif" ,
740+ "avg" ,
741+ "avgif" ,
742+ "min" ,
743+ "minif" ,
744+ "max" ,
745+ "maxif" ,
746+ "quantile" ,
747+ ] ;
739748 const funcName = call . name . toLowerCase ( ) ;
740- let sourceColumn : ColumnSchema | null = null ;
749+ let sourceColumn : Partial < ColumnSchema > | null = null ;
741750
742751 if ( valuePreservingAggregates . includes ( funcName ) && call . args . length > 0 ) {
743752 const firstArg = call . args [ 0 ] ;
@@ -746,7 +755,10 @@ export class ClickHousePrinter {
746755 const columnInfo = this . resolveFieldToColumn ( field . chain ) ;
747756 // Only propagate customRenderType, not the full column schema
748757 if ( columnInfo . column ?. customRenderType ) {
749- sourceColumn = { type : inferredType , customRenderType : columnInfo . column . customRenderType } ;
758+ sourceColumn = {
759+ type : inferredType ,
760+ customRenderType : columnInfo . column . customRenderType ,
761+ } ;
750762 }
751763 }
752764 }
0 commit comments