Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RC4 rebase master #2034

Merged
merged 37 commits into from
Apr 1, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
6bb3269
Upgrade rocksdb to 6.7.3 (#1948)
dangleptr Mar 20, 2020
806459e
Detect OS type and exit if not built in Linux (#1951)
JaySon-Huang Mar 23, 2020
01b008c
[doc] user-permission-mng (#1929)
amber-moe Mar 23, 2020
3f28146
[doc] ttl doc modification (#1939)
amber-moe Mar 23, 2020
0871c69
Let action not fail fast. (#1909)
Shylock-Hg Mar 23, 2020
6499c64
Remove removePrefix interface in kvstore (#1953)
dangleptr Mar 24, 2020
c2ea941
using admin client in MetaServiceHandler (#1864)
Mar 25, 2020
ae61c81
[doc] fix typo (#1954)
amber-moe Mar 25, 2020
7b26043
[doc]show statements (#1924)
amber-moe Mar 25, 2020
44bea75
[doc]customized dir (#1906)
amber-moe Mar 25, 2020
4008778
Fixed a bug caused by not filtering the versions of edges (#1962)
monadbobo Mar 25, 2020
498c2bb
[doc]modify job manger doc (#1957)
amber-moe Mar 26, 2020
82e4b48
Fix delete verticse (#1970)
Mar 26, 2020
1c1aae5
Fix the read performance issue after delete range with rocksdb-5.15.1…
dangleptr Mar 26, 2020
f114b21
Remove the LOG(FATAL) when encounting the unknown log type (#1978)
dangleptr Mar 26, 2020
f940ddb
1,Improve customer friendliness; 2, fixed typo error (#1980)
bright-starry-sky Mar 26, 2020
f08cc44
upgrade spark download address (#1981)
Mar 26, 2020
b14428f
fix-typo-in-doc (#1976)
Liuxue-Yang Mar 26, 2020
f81ec23
modify commands in build doc (#1969)
amber-moe Mar 26, 2020
cd6e965
modify log level (#1945)
laura-ding Mar 27, 2020
249b46c
use bloom filter, add event listener to collect stats of compaction, …
critical27 Mar 27, 2020
7d838d4
Update the interface atomicOp to support empty string (#2002)
dangleptr Mar 27, 2020
5a203d9
update to rc4 (#1968)
Mar 30, 2020
576d62e
Fixed if you execute "go from xx over *", and when there is no edge u…
monadbobo Mar 30, 2020
0297487
[doc]pr-commit-msg (#1993)
amber-moe Mar 30, 2020
a45eb66
doc:modify ttl query (#2006)
amber-moe Mar 30, 2020
6e79fe0
Let merge coverage report faster by fastcov instead of lcov. (#1943)
Shylock-Hg Mar 30, 2020
76e2529
Auto check keyword (#1922)
laura-ding Mar 30, 2020
4e434a5
Fix coredump for update if encountering bad format row (#2024)
dangleptr Mar 31, 2020
f4c8361
fixed loop depend problem for compile link (#1995)
bright-starry-sky Mar 31, 2020
f9a2a08
Check all reader is null or not before using it (#2029)
dangleptr Mar 31, 2020
9082f41
fix go without yield return errror result (#2012)
panda-sheep Mar 31, 2020
00ad503
fixed bug for delete vertex without edge (#2001)
monadbobo Mar 31, 2020
a5b7c9f
add alias for lookup (#2000)
bright-starry-sky Mar 31, 2020
70a0601
fix bug 1990/1991 (#2007)
liuyu85cn Mar 31, 2020
9fee5de
upload package to oss (#1972)
laura-ding Apr 1, 2020
7fa476e
Merge branch 'v1.0.0-rc4' into mergemaster
jude-zhu Apr 1, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Auto check keyword (#1922)
* Supports the detection keyword, name_label supports string

* add tests

* address Shylock's comment

* modify  to add reserved keyword

Co-authored-by: dutor <440396+dutor@users.noreply.github.com>
  • Loading branch information
laura-ding and dutor authored Mar 30, 2020
commit 76e2529bbca4042330ab0919391394cc6b74314d
139 changes: 139 additions & 0 deletions .linters/cpp/checkKeyword.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# signout--coding:utf-8--

# Copyright (c) 2019 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License,
# attached with Common Clause Condition 1.0, found in the LICENSES directory.

import os
import sys
import re


PASER_FILE_PATH = 'src/parser/parser.yy'
SCANNER_FILE_PATH = 'src/parser/scanner.lex'

reserved_key_words = [
'KW_GO',
'KW_AS',
'KW_TO',
'KW_OR',
'KW_AND',
'KW_XOR',
'KW_USE',
'KW_SET',
'KW_FROM',
'KW_WHERE',
'KW_MATCH',
'KW_INSERT',
'KW_YIELD',
'KW_RETURN',
'KW_DESCRIBE',
'KW_DESC',
'KW_VERTEX',
'KW_EDGE',
'KW_EDGES',
'KW_UPDATE',
'KW_UPSERT',
'KW_WHEN',
'KW_DELETE',
'KW_FIND',
'KW_LOOKUP',
'KW_ALTER',
'KW_STEPS',
'KW_OVER',
'KW_UPTO',
'KW_REVERSELY',
'KW_INDEX',
'KW_INDEXES',
'KW_REBUILD',
'KW_INT',
'KW_BIGINT',
'KW_DOUBLE',
'KW_STRING',
'KW_BOOL',
'KW_TIMESTAMP',
'KW_TAG',
'KW_TAGS',
'KW_UNION',
'KW_INTERSECT',
'KW_MINUS',
'KW_NO',
'KW_OVERWRITE',
'KW_SHOW',
'KW_ADD',
'KW_CREATE',
'KW_DROP',
'KW_REMOVE',
'KW_IF',
'KW_NOT',
'KW_EXISTS',
'KW_WITH',
'KW_CHANGE',
'KW_GRANT',
'KW_REVOKE',
'KW_ON',
'KW_BY',
'KW_IN',
'KW_DOWNLOAD',
'KW_GET',
'KW_OF',
'KW_ORDER',
'KW_INGEST',
'KW_COMPACT',
'KW_FLUSH',
'KW_SUBMIT',
'KW_ASC',
'KW_DISTINCT',
'KW_FETCH',
'KW_PROP',
'KW_BALANCE',
'KW_STOP',
'KW_LIMIT',
'KW_OFFSET',
'KW_GROUP',
'KW_IS',
'KW_NULL',
'KW_FORCE',
'KW_RECOVER'
]


def get_unreserved_keyword(file_path):
parser_file = open(file_path)
flag = 0
unreserved_key_words = []
for line in parser_file.readlines():
if line.strip() == 'unreserved_keyword':
flag = 1
continue
if flag == 1:
if line.strip() == ';':
break
unreserved_key_words.append(re.sub('\\s+[:|]\\s+(\\w+)\\s+.*', '\\1', line).strip())
continue

parser_file.close()
return unreserved_key_words


if __name__ == '__main__':
cmd = 'git diff --diff-filter=ACMRTUXB HEAD -p ' + SCANNER_FILE_PATH + '|grep "^+"|grep -v "^+++"|grep "KW_"'
content = os.popen(cmd)
keywords=[]
for line in content.readlines():
keyword = re.sub('.*(KW_\\w+)\s*;.*','\\1',line.strip())
keywords.append(keyword)

if len(keywords) == 0:
exit(0)
unreserved_key_words = get_unreserved_keyword(PASER_FILE_PATH)
new_key_words = [word for word in keywords if word not in reserved_key_words]
if len(new_key_words) == 0:
exit(0)
result = [word for word in new_key_words if word not in unreserved_key_words]
if len(result) == 0:
exit(0)
print('Keywords \"{}\" in src/parser/scanner.lex are not in the unreserved keyword list.'.format(result))
print('Please add them to the unreserved keyword in the src/parser/parser.yy.')
exit(1)
9 changes: 9 additions & 0 deletions .linters/cpp/hooks/pre-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
# attached with Common Clause Condition 1.0, found in the LICENSES directory.

CPPLINT=`dirname $0`/../../.linters/cpp/cpplint.py
CHECKKEYWORD=`dirname $0`/../../.linters/cpp/checkKeyword.py

echo "Performing checkout keyword..."
python $CHECKKEYWORD

if [ $? -ne 0 ]; then
echo "Checkout keyword failed"
exit 1
fi

if [ $# -eq 0 ];then
# Since cpplint.py could only apply on our working tree,
Expand Down
16 changes: 16 additions & 0 deletions src/graph/test/SchemaTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,22 @@ TEST_F(SchemaTest, TestTagAndEdge) {
code = client->execute(query, resp);
ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code);
}
// Test tagName is reserved keyword
{
cpp2::ExecutionResponse resp;
std::string query = "USE my_space; CREATE TAG `tag` (`edge` string)";
auto code = client->execute(query, resp);
ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code);
}
{
cpp2::ExecutionResponse resp;
std::string query = "DESCRIBE TAG `tag`";
client->execute(query, resp);
std::vector<uniform_tuple_t<std::string, 2>> expected{
{"edge", "string"},
};
ASSERT_TRUE(verifyResult(resp, expected));
}
{
cpp2::ExecutionResponse resp;
std::string query = "SHOW SPACES";
Expand Down
24 changes: 17 additions & 7 deletions src/parser/parser.yy
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ static constexpr size_t MAX_ABS_INTEGER = 9223372036854775808ULL;
%token KW_IF KW_NOT KW_EXISTS KW_WITH
%token KW_COUNT KW_COUNT_DISTINCT KW_SUM KW_AVG KW_MAX KW_MIN KW_STD KW_BIT_AND KW_BIT_OR KW_BIT_XOR
%token KW_BY KW_DOWNLOAD KW_HDFS KW_UUID KW_CONFIGS KW_FORCE KW_STATUS
%token KW_VARIABLES KW_GET KW_DECLARE KW_GRAPH KW_META KW_STORAGE
%token KW_GET KW_DECLARE KW_GRAPH KW_META KW_STORAGE
%token KW_TTL KW_TTL_DURATION KW_TTL_COL KW_DATA KW_STOP
%token KW_FETCH KW_PROP KW_UPDATE KW_UPSERT KW_WHEN
%token KW_ORDER KW_ASC KW_LIMIT KW_OFFSET KW_GROUP
Expand Down Expand Up @@ -281,23 +281,33 @@ unreserved_keyword
| KW_DATA { $$ = new std::string("data"); }
| KW_LEADER { $$ = new std::string("leader"); }
| KW_UUID { $$ = new std::string("uuid"); }
| KW_VARIABLES { $$ = new std::string("variables"); }
| KW_JOB { $$ = new std::string("job"); }
| KW_JOBS { $$ = new std::string("jobs"); }
| KW_SUBMIT { $$ = new std::string("submit"); }
| KW_RECOVER { $$ = new std::string("recover"); }
| KW_FLUSH { $$ = new std::string("flush"); }
| KW_COMPACT { $$ = new std::string("compact"); }
| KW_BIDIRECT { $$ = new std::string("bidirect"); }
| KW_OFFLINE { $$ = new std::string("offline"); }
| KW_FORCE { $$ = new std::string("force"); }
| KW_STATUS { $$ = new std::string("status"); }
| KW_REBUILD { $$ = new std::string("rebuild"); }
| KW_PART { $$ = new std::string("part"); }
| KW_PARTS { $$ = new std::string("parts"); }
| KW_DEFAULT { $$ = new std::string("default"); }
| KW_CONFIGS { $$ = new std::string("configs"); }
| KW_ACCOUNT { $$ = new std::string("account"); }
| KW_HDFS { $$ = new std::string("hdfs"); }
| KW_PARTITION_NUM { $$ = new std::string("partition_num"); }
| KW_REPLICA_FACTOR { $$ = new std::string("replica_factor"); }
| KW_CHARSET { $$ = new std::string("charset"); }
| KW_COLLATE { $$ = new std::string("collate"); }
| KW_COLLATION { $$ = new std::string("collation"); }
| KW_TTL_DURATION { $$ = new std::string("ttl_duration"); }
| KW_TTL_COL { $$ = new std::string("ttl_col"); }
| KW_SNAPSHOT { $$ = new std::string("snapshot"); }
| KW_SNAPSHOTS { $$ = new std::string("snapshots"); }
| KW_GRAPH { $$ = new std::string("graph"); }
| KW_META { $$ = new std::string("meta"); }
| KW_STORAGE { $$ = new std::string("storage"); }
| KW_ALL { $$ = new std::string("all"); }
| KW_SHORTEST { $$ = new std::string("shortest"); }
| KW_COUNT_DISTINCT { $$ = new std::string("count_distinct"); }
;

agg_function
Expand Down
Loading