Skip to content

Commit ee2536f

Browse files
committed
feat: merge and momentarily disable hashql endpoint
1 parent 5ffbfdb commit ee2536f

3 files changed

Lines changed: 15 additions & 93 deletions

File tree

libs/@local/graph/api/src/rest/entity_query_request.rs

Lines changed: 11 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
//!
1515
//! When changing any of these types, make sure that the OpenAPI generator types do not degenerate
1616
//! into any of these cases.
17+
#![expect(
18+
dead_code,
19+
reason = "https://linear.app/hash/issue/BE-537/hashql-remove-old-backend-wire-up-hashql-in-the-api"
20+
)]
1721
use alloc::borrow::Cow;
1822
use core::{cmp, ops::Range};
1923

@@ -41,23 +45,17 @@ use hash_graph_store::{
4145
};
4246
use hashql_ast::error::AstDiagnosticCategory;
4347
use hashql_core::{
44-
collections::fast_hash_map_with_capacity,
4548
heap::Heap,
46-
module::ModuleRegistry,
4749
span::{SpanId, SpanTable},
48-
r#type::environment::Environment,
4950
};
5051
use hashql_diagnostics::{
51-
DiagnosticIssues, Failure, Severity, Status, StatusExt as _, Success,
52+
DiagnosticIssues, Failure, Severity, Status, Success,
5253
category::{DiagnosticCategory, canonical_category_id},
5354
diagnostic::render::{Format, RenderOptions},
5455
source::{DiagnosticSpan, Source, SourceId, Sources},
5556
};
56-
use hashql_eval::{
57-
error::EvalDiagnosticCategory,
58-
graph::{error::GraphCompilerDiagnosticCategory, read::FilterSlice},
59-
};
60-
use hashql_hir::{error::HirDiagnosticCategory, visit::Visitor as _};
57+
use hashql_eval::error::EvalDiagnosticCategory;
58+
use hashql_hir::error::HirDiagnosticCategory;
6159
use hashql_syntax_jexpr::{error::JExprDiagnosticCategory, span::Span};
6260
use http::StatusCode;
6361
use serde::Deserialize;
@@ -330,89 +328,11 @@ pub enum EntityQuery<'q> {
330328

331329
impl<'q> EntityQuery<'q> {
332330
fn compile_query<'heap>(
333-
heap: &'heap Heap,
334-
spans: &mut SpanTable<Span>,
335-
query: &RawJsonValue,
331+
_: &'heap Heap,
332+
_: &mut SpanTable<Span>,
333+
_: &RawJsonValue,
336334
) -> Status<Filter<'heap, Entity>, HashQLDiagnosticCategory, SpanId> {
337-
// Parse the query
338-
let mut parser = hashql_syntax_jexpr::Parser::new(heap, spans);
339-
let mut ast = parser
340-
.parse_expr(query.get().as_bytes())
341-
.map_err(|diagnostic| {
342-
Failure::new(diagnostic.map_category(HashQLDiagnosticCategory::JExpr))
343-
})?;
344-
345-
let mut env = Environment::new(heap);
346-
let modules = ModuleRegistry::new(&env);
347-
348-
// Lower the AST
349-
let Success {
350-
value: types,
351-
advisories,
352-
} = hashql_ast::lowering::lower(heap.intern_symbol("main"), &mut ast, &env, &modules)
353-
.map_category(|category| {
354-
HashQLDiagnosticCategory::Ast(AstDiagnosticCategory::Lowering(category))
355-
})?;
356-
357-
let interner = hashql_hir::intern::Interner::new(heap);
358-
let mut context = hashql_hir::context::HirContext::new(&interner, &modules);
359-
360-
// Reify the HIR from the AST
361-
let Success {
362-
value: hir,
363-
advisories,
364-
} = hashql_hir::node::NodeData::from_ast(ast, &mut context, &types)
365-
.map_category(|category| {
366-
HashQLDiagnosticCategory::Hir(HirDiagnosticCategory::Reification(category))
367-
})
368-
.with_diagnostics(advisories)?;
369-
370-
// Lower the HIR
371-
let Success {
372-
value: hir,
373-
advisories,
374-
} = hashql_hir::lower::lower(hir, &types, &mut env, &mut context)
375-
.map_category(|category| {
376-
HashQLDiagnosticCategory::Hir(HirDiagnosticCategory::Lowering(category))
377-
})
378-
.with_diagnostics(advisories)?;
379-
380-
// Evaluate the HIR
381-
// TODO: https://linear.app/hash/issue/BE-41/hashql-expose-input-in-graph-api
382-
let inputs = fast_hash_map_with_capacity(0);
383-
let mut compiler = hashql_eval::graph::read::GraphReadCompiler::new(heap, &inputs);
384-
385-
compiler.visit_node(hir);
386-
387-
let Success {
388-
value: result,
389-
advisories,
390-
} = compiler
391-
.finish()
392-
.map_category(|category| {
393-
HashQLDiagnosticCategory::Eval(EvalDiagnosticCategory::Graph(
394-
GraphCompilerDiagnosticCategory::Read(category),
395-
))
396-
})
397-
.with_diagnostics(advisories)?;
398-
399-
let output = result.output.get(&hir.id).expect("TODO");
400-
401-
// Compile the Filter into one
402-
let filters = match output {
403-
FilterSlice::Entity { range } => result.filters.entity(range.clone()),
404-
};
405-
406-
let filter = match filters {
407-
[] => Filter::All(Vec::new()),
408-
[filter] => filter.clone(),
409-
_ => Filter::All(filters.to_vec()),
410-
};
411-
412-
Ok(Success {
413-
value: filter,
414-
advisories,
415-
})
335+
unimplemented!("https://linear.app/hash/issue/BE-537/hashql-remove-old-backend-wire-up-hashql-in-the-api")
416336
}
417337

418338
/// Compiles a query into an executable entity filter.

libs/@local/hashql/compiletest/src/suite/eval_postgres.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use hashql_core::{
77
r#type::{TypeFormatter, TypeFormatterOptions, environment::Environment},
88
};
99
use hashql_diagnostics::DiagnosticIssues;
10-
use hashql_eval::{context::EvalContext, postgres::PostgresCompiler};
10+
use hashql_eval::{context::CodeGenerationContext, postgres::PostgresCompiler};
1111
use hashql_mir::{
1212
body::{Body, basic_block::BasicBlockId, terminator::TerminatorKind},
1313
context::MirContext,
@@ -117,7 +117,8 @@ impl Suite for EvalPostgres {
117117
let mir_buf = format_mir_with_placement(heap, &environment, &bodies, &analysis);
118118
secondary_outputs.insert("mir", mir_buf);
119119

120-
let mut context = EvalContext::new_in(
120+
let interner = interner.into();
121+
let mut context = CodeGenerationContext::new_in(
121122
&environment,
122123
&interner,
123124
&bodies,

libs/@local/hashql/eval/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ pub mod context;
2727
pub mod error;
2828
#[cfg(feature = "graph")]
2929
pub mod graph;
30+
pub mod intern;
3031
pub mod orchestrator;
3132
pub mod postgres;
3233

0 commit comments

Comments
 (0)