Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jobily
Questdb
提交
86c8a18a
Q
Questdb
项目概览
jobily
/
Questdb
12 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
Questdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
86c8a18a
编写于
5月 12, 2016
作者:
V
Vlad Ilyushchenko
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
optimisation + test
上级
d3dd53dc
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
34 addition
and
23 deletion
+34
-23
core/src/main/java/com/questdb/ql/parser/LiteralMatcher.java
core/src/main/java/com/questdb/ql/parser/LiteralMatcher.java
+17
-19
core/src/test/java/com/questdb/net/http/QueryResponse.java
core/src/test/java/com/questdb/net/http/QueryResponse.java
+1
-0
core/src/test/java/com/questdb/net/http/handlers/QueryHandlerTest.java
.../java/com/questdb/net/http/handlers/QueryHandlerTest.java
+16
-4
未找到文件。
core/src/main/java/com/questdb/ql/parser/LiteralMatcher.java
浏览文件 @
86c8a18a
...
...
@@ -58,30 +58,28 @@ class LiteralMatcher implements PostOrderTreeTraversalAlgo.Visitor {
@Override
public
void
visit
(
ExprNode
node
)
throws
ParserException
{
if
(
node
.
type
==
ExprNode
.
NodeType
.
LITERAL
)
{
if
(
match
)
{
if
(
names
.
contains
(
node
.
token
))
{
return
;
}
if
(
alias
==
null
)
{
match
=
false
;
return
;
}
if
(
node
.
type
==
ExprNode
.
NodeType
.
LITERAL
&&
match
)
{
if
(
names
.
contains
(
node
.
token
))
{
return
;
}
ColumnName
columnName
=
ColumnName
.
singleton
(
node
.
token
);
if
(
alias
==
null
)
{
match
=
false
;
return
;
}
if
(
columnName
.
alias
()
==
null
)
{
match
=
false
;
return
;
}
ColumnName
columnName
=
ColumnName
.
singleton
(
node
.
token
);
if
(
Chars
.
equals
(
columnName
.
alias
(),
alias
)
&&
names
.
contains
(
columnName
.
name
()))
{
node
.
token
=
columnName
.
name
().
toString
();
return
;
}
if
(
columnName
.
alias
()
==
null
)
{
match
=
false
;
return
;
}
if
(
Chars
.
equals
(
columnName
.
alias
(),
alias
)
&&
names
.
contains
(
columnName
.
name
()))
{
node
.
token
=
columnName
.
name
().
toString
();
return
;
}
match
=
false
;
}
}
...
...
core/src/test/java/com/questdb/net/http/QueryResponse.java
浏览文件 @
86c8a18a
...
...
@@ -42,6 +42,7 @@ public class QueryResponse {
public
String
error
;
public
String
query
;
public
List
<
String
[]>
result
;
public
long
count
;
public
static
class
Tab
{
public
String
id
;
...
...
core/src/test/java/com/questdb/net/http/handlers/QueryHandlerTest.java
浏览文件 @
86c8a18a
...
...
@@ -209,11 +209,19 @@ public class QueryHandlerTest extends AbstractOptimiserTest {
@Test
public
void
testJsonSimpleNoMeta
()
throws
Exception
{
QueryResponse
queryResponse
=
download
(
"select 1 z from tab limit 10"
,
0
,
10
,
true
,
temp
);
QueryResponse
queryResponse
=
download
(
"select 1 z from tab limit 10"
,
0
,
10
,
true
,
false
,
temp
);
Assert
.
assertEquals
(
10
,
queryResponse
.
result
.
size
());
Assert
.
assertNull
(
queryResponse
.
query
);
}
@Test
public
void
testJsonSimpleNoMetaAndCount
()
throws
Exception
{
QueryResponse
queryResponse
=
download
(
"select 1 z from tab"
,
0
,
10
,
true
,
true
,
temp
);
Assert
.
assertEquals
(
10
,
queryResponse
.
result
.
size
());
Assert
.
assertEquals
(
1000
,
queryResponse
.
count
);
Assert
.
assertNull
(
queryResponse
.
query
);
}
@Test
public
void
testJsonTakeLimit
()
throws
Exception
{
QueryResponse
queryResponse
=
download
(
"tab limit 10"
,
2
,
-
1
);
...
...
@@ -227,7 +235,7 @@ public class QueryHandlerTest extends AbstractOptimiserTest {
}
static
QueryResponse
download
(
String
queryUrl
,
TemporaryFolder
temp
)
throws
Exception
{
return
download
(
queryUrl
,
-
1
,
-
1
,
false
,
temp
);
return
download
(
queryUrl
,
-
1
,
-
1
,
false
,
false
,
temp
);
}
static
void
generateJournal
(
String
name
,
int
count
)
throws
JournalException
,
NumericException
{
...
...
@@ -245,7 +253,7 @@ public class QueryHandlerTest extends AbstractOptimiserTest {
generateJournal
(
name
,
new
QueryResponse
.
Tab
[]{
record
},
1000
);
}
private
static
QueryResponse
download
(
String
queryUrl
,
int
limitFrom
,
int
limitTo
,
boolean
noMeta
,
TemporaryFolder
temp
)
throws
Exception
{
private
static
QueryResponse
download
(
String
queryUrl
,
int
limitFrom
,
int
limitTo
,
boolean
noMeta
,
boolean
count
,
TemporaryFolder
temp
)
throws
Exception
{
File
f
=
temp
.
newFile
();
String
url
=
"http://localhost:9000/js?query="
+
URLEncoder
.
encode
(
queryUrl
,
"UTF-8"
);
if
(
limitFrom
>=
0
)
{
...
...
@@ -259,6 +267,10 @@ public class QueryHandlerTest extends AbstractOptimiserTest {
url
+=
"&nm=true"
;
}
if
(
count
)
{
url
+=
"&count=true"
;
}
HttpTestUtils
.
download
(
HttpTestUtils
.
clientBuilder
(
false
),
url
,
f
);
Gson
gson
=
new
GsonBuilder
().
setDateFormat
(
"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
).
create
();
String
s
=
Files
.
readStringFromFile
(
f
);
...
...
@@ -317,6 +329,6 @@ public class QueryHandlerTest extends AbstractOptimiserTest {
}
private
static
QueryResponse
download
(
String
queryUrl
,
int
limitFrom
,
int
limitTo
)
throws
Exception
{
return
download
(
queryUrl
,
limitFrom
,
limitTo
,
false
,
temp
);
return
download
(
queryUrl
,
limitFrom
,
limitTo
,
false
,
false
,
temp
);
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录