Skip to content

Commit b4afe2b

Browse files
committed
Remove unused code
1 parent 41e1907 commit b4afe2b

File tree

1 file changed

+0
-74
lines changed

1 file changed

+0
-74
lines changed

ndc-sqlgen/src/main/kotlin/io/hasura/ndc/sqlgen/BaseQueryGenerator.kt

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -128,80 +128,6 @@ abstract class BaseQueryGenerator : BaseGenerator {
128128
return withStep
129129
}
130130

131-
fun mkNativeQueryCTE(
132-
request: QueryRequest
133-
): org.jooq.WithStep {
134-
val config = ConnectorConfiguration.Loader.config
135-
136-
fun renderNativeQuerySQL(
137-
nativeQuery: NativeQueryInfo,
138-
arguments: Map<String, Argument>
139-
): String {
140-
val sql = nativeQuery.sql
141-
val parts = sql.parts
142-
143-
return parts.joinToString("") { part ->
144-
when (part) {
145-
is NativeQueryPart.Text -> part.value
146-
is NativeQueryPart.Parameter -> {
147-
val argument = arguments[part.value] ?: error("Argument ${part.value} not found")
148-
when (argument) {
149-
is Argument.Literal -> argument.value.toString()
150-
else -> error("Only literals are supported in Native Queries in this version")
151-
}
152-
}
153-
}
154-
}
155-
}
156-
157-
val nativeQuery = config.nativeQueries[request.collection]!!
158-
val nativeQuerySQL = renderNativeQuerySQL(nativeQuery, request.arguments)
159-
160-
return DSL.with(
161-
DSL.name(request.collection)
162-
).`as`(
163-
DSL.resultQuery(nativeQuerySQL)
164-
)
165-
}
166-
167-
// TODO: Fix this being duplicated due to "buildCTEs" in Snowflake CTE Strategy wanting CommonTableExpression<*> instead of WithStep
168-
// Probably easiest to make them both return CommonTableExpression<*> and wrap with DSL.with() in the specific implementations
169-
fun mkNativeQueryCTESnowflake(
170-
request: QueryRequest
171-
): org.jooq.CommonTableExpression<*> {
172-
val config = ConnectorConfiguration.Loader.config
173-
174-
fun renderNativeQuerySQL(
175-
nativeQuery: NativeQueryInfo,
176-
arguments: Map<String, Argument>
177-
): String {
178-
val sql = nativeQuery.sql
179-
val parts = sql.parts
180-
181-
return parts.joinToString("") { part ->
182-
when (part) {
183-
is NativeQueryPart.Text -> part.value
184-
is NativeQueryPart.Parameter -> {
185-
val argument = arguments[part.value] ?: error("Argument ${part.value} not found")
186-
when (argument) {
187-
is Argument.Literal -> argument.value.toString()
188-
else -> error("Only literals are supported in Native Queries in this version")
189-
}
190-
}
191-
}
192-
}
193-
}
194-
195-
val nativeQuery = config.nativeQueries[request.collection]!!
196-
val nativeQuerySQL = renderNativeQuerySQL(nativeQuery, request.arguments)
197-
198-
return DSL.name(
199-
request.collection
200-
).`as`(
201-
DSL.resultQuery(nativeQuerySQL)
202-
)
203-
}
204-
205131
fun getQueryColumnFields(fields: Map<String, IRField>): Map<String, IRField.ColumnField> {
206132
return fields
207133
.filterValues { it is IRField.ColumnField }

0 commit comments

Comments
 (0)