@@ -664,6 +664,7 @@ function useSearchedConfigToChartConfig(
664664) {
665665 const { data : sourceObj , isLoading } = useSource ( {
666666 id : source ,
667+ kinds : [ SourceKind . Log , SourceKind . Trace ] ,
667668 } ) ;
668669 const defaultOrderBy = useDefaultOrderBy ( source ) ;
669670
@@ -674,10 +675,7 @@ function useSearchedConfigToChartConfig(
674675 select :
675676 select ||
676677 defaultSearchConfig ?. select ||
677- ( isLogSource ( sourceObj ) || isTraceSource ( sourceObj )
678- ? sourceObj . defaultTableSelectExpression
679- : '' ) ||
680- '' ,
678+ sourceObj . defaultTableSelectExpression ,
681679 from : sourceObj . from ,
682680 source : sourceObj . id ,
683681 ...( isLogSource ( sourceObj ) && sourceObj . tableFilterExpression != null
@@ -695,10 +693,7 @@ function useSearchedConfigToChartConfig(
695693 where : where ?? '' ,
696694 whereLanguage : whereLanguage ?? 'sql' ,
697695 timestampValueExpression : sourceObj . timestampValueExpression ,
698- implicitColumnExpression :
699- isLogSource ( sourceObj ) || isTraceSource ( sourceObj )
700- ? sourceObj . implicitColumnExpression
701- : undefined ,
696+ implicitColumnExpression : sourceObj . implicitColumnExpression ,
702697 connection : sourceObj . connection ,
703698 displayType : DisplayType . Search ,
704699 orderBy : orderBy || defaultSearchConfig ?. orderBy || defaultOrderBy ,
@@ -791,23 +786,21 @@ function optimizeDefaultOrderBy(
791786}
792787
793788export function useDefaultOrderBy ( sourceID : string | undefined | null ) {
794- const { data : source } = useSource ( { id : sourceID } ) ;
789+ const { data : source } = useSource ( {
790+ id : sourceID ,
791+ kinds : [ SourceKind . Log , SourceKind . Trace ] ,
792+ } ) ;
795793 const { data : tableMetadata } = useTableMetadata ( tcFromSource ( source ) ) ;
796794
797795 // When source changes, make sure select and orderby fields are set to default
798796 return useMemo ( ( ) => {
799797 // If no source, return undefined so that the orderBy is not set incorrectly
800798 if ( ! source ) return undefined ;
801- const trimmedOrderBy =
802- isLogSource ( source ) || isTraceSource ( source )
803- ? source . orderByExpression ?. trim ( )
804- : undefined ;
799+ const trimmedOrderBy = source . orderByExpression ?. trim ( ) ;
805800 if ( trimmedOrderBy ) return trimmedOrderBy ;
806801 return optimizeDefaultOrderBy (
807802 source ?. timestampValueExpression ?? '' ,
808- isLogSource ( source ) || isTraceSource ( source )
809- ? source . displayedTimestampValueExpression
810- : undefined ,
803+ source . displayedTimestampValueExpression ,
811804 tableMetadata ?. sorting_key ,
812805 ) ;
813806 } , [ source , tableMetadata ] ) ;
@@ -846,6 +839,7 @@ function DBSearchPage() {
846839 ) ;
847840 const { data : searchedSource } = useSource ( {
848841 id : searchedConfig . source ,
842+ kinds : [ SourceKind . Log , SourceKind . Trace ] ,
849843 } ) ;
850844
851845 const [ analysisMode , setAnalysisMode ] = useQueryState (
0 commit comments