Skip to content

Commit

Permalink
chore(ui): handle and display error received while scrolling the grid
Browse files Browse the repository at this point in the history
  • Loading branch information
glasstiger committed Oct 22, 2024
1 parent e4c8d6b commit eb23981
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/browser-tests/questdb
Submodule questdb updated 83 files
+1 −0 .gitignore
+4 −7 README.md
+1 −1 benchmarks/pom.xml
+1 −1 compat/pom.xml
+2 −2 core/pom.xml
+1 −0 core/src/main/c/share/dedup_comparers.h
+17 −8 core/src/main/c/share/files.c
+2 −3 core/src/main/c/share/txn_board.cpp
+8 −3 core/src/main/java/io/questdb/ServerMain.java
+75 −423 core/src/main/java/io/questdb/cairo/CairoEngine.java
+11 −1 core/src/main/java/io/questdb/cairo/DatabaseCheckpointAgent.java
+529 −0 core/src/main/java/io/questdb/cairo/MetadataCache.java
+18 −23 core/src/main/java/io/questdb/cairo/MetadataCacheReader.java
+70 −0 core/src/main/java/io/questdb/cairo/MetadataCacheWriter.java
+9 −2 core/src/main/java/io/questdb/cairo/TableConverter.java
+5 −3 core/src/main/java/io/questdb/cairo/TableReader.java
+114 −20 core/src/main/java/io/questdb/cairo/TableWriter.java
+31 −19 core/src/main/java/io/questdb/cairo/TxnScoreboard.java
+4 −0 core/src/main/java/io/questdb/cairo/vm/MemoryCMARWImpl.java
+13 −2 core/src/main/java/io/questdb/cairo/wal/seq/TableSequencerImpl.java
+4 −0 core/src/main/java/io/questdb/cutlass/http/HttpChunkedResponse.java
+58 −47 core/src/main/java/io/questdb/cutlass/http/HttpResponseSink.java
+64 −35 core/src/main/java/io/questdb/cutlass/http/processors/JsonQueryProcessor.java
+104 −45 core/src/main/java/io/questdb/cutlass/http/processors/JsonQueryProcessorState.java
+15 −9 core/src/main/java/io/questdb/cutlass/pgwire/PGConnectionContext.java
+40 −4 core/src/main/java/io/questdb/cutlass/text/ParallelCsvFileImporter.java
+1 −1 core/src/main/java/io/questdb/griffin/FunctionParser.java
+5 −0 core/src/main/java/io/questdb/griffin/SqlCodeGenerator.java
+69 −5 core/src/main/java/io/questdb/griffin/SqlCompilerImpl.java
+38 −28 core/src/main/java/io/questdb/griffin/engine/functions/catalogue/AllTablesFunctionFactory.java
+72 −50 core/src/main/java/io/questdb/griffin/engine/functions/catalogue/InformationSchemaColumnsFunctionFactory.java
+73 −55 core/src/main/java/io/questdb/griffin/engine/functions/catalogue/PgAttributeFunctionFactory.java
+29 −8 core/src/main/java/io/questdb/griffin/engine/functions/catalogue/SimulateCrashFunctionFactory.java
+40 −32 core/src/main/java/io/questdb/griffin/engine/functions/catalogue/TablesFunctionFactory.java
+22 −22 core/src/main/java/io/questdb/griffin/engine/functions/groupby/AbstractCovarGroupByFunction.java
+0 −180 core/src/main/java/io/questdb/griffin/engine/functions/groupby/CorrGroupByFunction.java
+194 −0 core/src/main/java/io/questdb/griffin/engine/functions/groupby/CorrGroupByFunctionFactory.java
+1 −1 core/src/main/java/io/questdb/griffin/engine/functions/groupby/CovarPopGroupByFunction.java
+0 −51 core/src/main/java/io/questdb/griffin/engine/functions/groupby/CovarSampleGroupByFunction.java
+63 −0 core/src/main/java/io/questdb/griffin/engine/functions/groupby/CovarSampleGroupByFunctionFactory.java
+205 −0 core/src/main/java/io/questdb/griffin/engine/functions/groupby/RegressionSlopeFunctionFactory.java
+0 −52 core/src/main/java/io/questdb/griffin/engine/functions/groupby/StdDevPopGroupByFunction.java
+59 −0 core/src/main/java/io/questdb/griffin/engine/functions/groupby/StdDevPopGroupByFunctionFactory.java
+0 −52 core/src/main/java/io/questdb/griffin/engine/functions/groupby/StdDevSampleGroupByFunction.java
+58 −0 core/src/main/java/io/questdb/griffin/engine/functions/groupby/StdDevSampleGroupByFunctionFactory.java
+59 −0 core/src/main/java/io/questdb/griffin/engine/functions/groupby/VarPopGroupByFunctionFactory.java
+0 −51 core/src/main/java/io/questdb/griffin/engine/functions/groupby/VarSampleGroupByFunction.java
+60 −0 core/src/main/java/io/questdb/griffin/engine/functions/groupby/VarSampleGroupByFunctionFactory.java
+6 −3 core/src/main/java/io/questdb/griffin/engine/functions/table/HydrateTableMetadataFunctionFactory.java
+20 −7 core/src/main/java/io/questdb/griffin/engine/table/ShowColumnsRecordCursorFactory.java
+4 −0 core/src/main/java/io/questdb/std/CharSequenceObjHashMap.java
+3 −0 core/src/main/java/module-info.java
+2 −0 core/src/main/resources/META-INF/services/io.questdb.griffin.FunctionFactory
+ core/src/main/resources/io/questdb/bin/darwin-aarch64/libquestdb.dylib
+ core/src/main/resources/io/questdb/bin/darwin-x86-64/libquestdb.dylib
+ core/src/main/resources/io/questdb/bin/linux-aarch64/libquestdb.so
+ core/src/main/resources/io/questdb/bin/linux-x86-64/libquestdb.so
+ core/src/main/resources/io/questdb/bin/windows-x86-64/libquestdb.dll
+95 −13 core/src/test/java/io/questdb/test/AbstractCairoTest.java
+12 −1 core/src/test/java/io/questdb/test/CreateTableTestUtils.java
+94 −51 core/src/test/java/io/questdb/test/FilesTest.java
+0 −610 core/src/test/java/io/questdb/test/cairo/CairoMetadataCacheTest.java
+803 −0 core/src/test/java/io/questdb/test/cairo/MetadataCacheTest.java
+8 −5 core/src/test/java/io/questdb/test/cairo/TxnScoreboardTest.java
+192 −134 core/src/test/java/io/questdb/test/cutlass/http/IODispatcherTest.java
+31 −44 core/src/test/java/io/questdb/test/cutlass/pgwire/PGJobContextTest.java
+25 −9 core/src/test/java/io/questdb/test/griffin/CheckpointTest.java
+74 −0 core/src/test/java/io/questdb/test/griffin/ParallelGroupByFuzzTest.java
+46 −0 core/src/test/java/io/questdb/test/griffin/SqlCompilerImplTest.java
+36 −8 ...st/java/io/questdb/test/griffin/engine/functions/catalogue/InformationSchemaColumnsFunctionFactoryTest.java
+10 −11 core/src/test/java/io/questdb/test/griffin/engine/functions/catalogue/SimulateCrashFunctionTest.java
+5 −9 core/src/test/java/io/questdb/test/griffin/engine/functions/catalogue/TablesFunctionFactoryTest.java
+142 −0 core/src/test/java/io/questdb/test/griffin/engine/functions/finance/RegressionSlopeFunctionFactoryTest.java
+160 −21 core/src/test/java/io/questdb/test/griffin/engine/functions/groupby/CorrGroupByFunctionFactoryTest.java
+68 −34 core/src/test/java/io/questdb/test/tools/TestUtils.java
+32 −0 core/src/test/resources/sqllogictest/test/sql/test_corr.test
+84 −0 core/src/test/resources/sqllogictest/test/sql/test_covar.test
+36 −0 core/src/test/resources/sqllogictest/test/sql/test_regression.test
+134 −0 core/src/test/resources/sqllogictest/test/sql/test_stddev.test
+103 −0 core/src/test/resources/sqllogictest/test/sql/test_var.test
+1 −1 examples/pom.xml
+1 −1 pom.xml
+1 −1 utils/pom.xml
34 changes: 24 additions & 10 deletions packages/web-console/src/scenes/Result/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

import $ from "jquery"
import React, { useContext, useEffect, useRef, useState } from "react"
import { useSelector } from "react-redux"
import { useDispatch, useSelector } from "react-redux"
import styled from "styled-components"
import { Download2, Refresh } from "@styled-icons/remix-line"
import { Reset } from "@styled-icons/boxicons-regular"
Expand All @@ -39,15 +39,17 @@ import {
Text,
Tooltip,
} from "../../components"
import { selectors } from "../../store"
import { color, QueryRawResult } from "../../utils"
import { actions, selectors } from "../../store"
import {color, ErrorResult, QueryRawResult} from "../../utils"
import * as QuestDB from "../../utils/questdb"
import { ResultViewMode } from "scenes/Console/types"
import { Button } from "@questdb/react-components"
import type { IQuestDBGrid } from "../../js/console/grid.js"
import { eventBus } from "../../modules/EventBus"
import { EventType } from "../../modules/EventBus/types"
import { QuestContext } from "../../providers"
import {QueryInNotification} from "../Editor/Monaco/query-in-notification";
import {NotificationType} from "../../store/Query/types";

const Root = styled.div`
display: flex;
Expand Down Expand Up @@ -98,17 +100,29 @@ const Result = ({ viewMode }: { viewMode: ResultViewMode }) => {
const activeSidebar = useSelector(selectors.console.getActiveSidebar)
const gridRef = useRef<IQuestDBGrid | undefined>()
const [gridFreezeLeftState, setGridFreezeLeftState] = useState<number>(0)

const dispatch = useDispatch()

useEffect(() => {
const _grid = grid(
document.getElementById("grid"),
async function (sql, lo, hi, rendererFn: (data: QueryRawResult) => void) {
const result = await quest.queryRaw(sql, {
limit: `${lo},${hi}`,
nm: true,
})
if (result.type === QuestDB.Type.DQL) {
rendererFn(result)
try {
const result = await quest.queryRaw(sql, {
limit: `${lo},${hi}`,
nm: true,
})
if (result.type === QuestDB.Type.DQL) {
rendererFn(result)
}
} catch (err) {
dispatch(actions.query.stopRunning())
dispatch(
actions.query.addNotification({
content: <Text color="red">{(err as ErrorResult).error}</Text>,
sideContent: <QueryInNotification query={sql} />,
type: NotificationType.ERROR,
}),
)
}
},
)
Expand Down

0 comments on commit eb23981

Please sign in to comment.