Skip to content

Commit

Permalink
support more JSON builtin functions (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kingwl authored and zz-jason committed Oct 12, 2018
1 parent cacfda7 commit 11e33c7
Show file tree
Hide file tree
Showing 9 changed files with 2,316 additions and 2,591 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
target
Cargo.lock
.DS_Store
581 changes: 296 additions & 285 deletions go-tipb/expression.pb.go

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions proto/expression.proto
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ enum ExprType {
VarPop = 3015;
VarSamp = 3016;
Variance = 3017;
JsonArrayAgg = 3018;
JsonObjectAgg = 3019;

/* Scalar Function */
ScalarFunc = 10000;
Expand Down Expand Up @@ -416,6 +418,7 @@ enum ScalarFuncSig {
JsonDepthSig = 5022;
JsonKeysSig = 5023;
JsonLengthSig = 5024;
JsonKeys2ArgsSig = 5025;

/*time*/
DateFormatSig = 6001;
Expand Down
423 changes: 180 additions & 243 deletions src/analyze.rs

Large diffs are not rendered by default.

126 changes: 46 additions & 80 deletions src/checksum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,87 +596,53 @@ static file_descriptor_proto_data: &'static [u8] = b"\
\x04R\ntotalBytesB\x04\xc8\xde\x1f\0*&\n\x0eChecksumScanOn\x12\t\n\x05Ta\
ble\x10\0\x12\t\n\x05Index\x10\x01*\"\n\x11ChecksumAlgorithm\x12\r\n\tCr\
c64_Xor\x10\0B%\n\x15com.pingcap.tidb.tipbP\x01\xc8\xe2\x1e\x01\xd0\xe2\
\x1e\x01\xe0\xe2\x1e\x01J\xb6\r\n\x06\x12\x04\0\0\x20\x01\n\x08\n\x01\
\x1e\x01\xe0\xe2\x1e\x01J\xc9\x07\n\x06\x12\x04\0\0\x20\x01\n\x08\n\x01\
\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\x12\x03\x02\x08\x0c\n\x08\n\x01\x08\
\x12\x03\x04\0\"\n\x0b\n\x04\x08\xe7\x07\0\x12\x03\x04\0\"\n\x0c\n\x05\
\x08\xe7\x07\0\x02\x12\x03\x04\x07\x1a\n\r\n\x06\x08\xe7\x07\0\x02\0\x12\
\x03\x04\x07\x1a\n\x0e\n\x07\x08\xe7\x07\0\x02\0\x01\x12\x03\x04\x07\x1a\
\n\x0c\n\x05\x08\xe7\x07\0\x03\x12\x03\x04\x1d!\n\x08\n\x01\x08\x12\x03\
\x05\0.\n\x0b\n\x04\x08\xe7\x07\x01\x12\x03\x05\0.\n\x0c\n\x05\x08\xe7\
\x07\x01\x02\x12\x03\x05\x07\x13\n\r\n\x06\x08\xe7\x07\x01\x02\0\x12\x03\
\x05\x07\x13\n\x0e\n\x07\x08\xe7\x07\x01\x02\0\x01\x12\x03\x05\x07\x13\n\
\x0c\n\x05\x08\xe7\x07\x01\x07\x12\x03\x05\x16-\n\t\n\x02\x03\0\x12\x03\
\x07\x07\x1d\n\x08\n\x01\x08\x12\x03\t\0$\n\x0b\n\x04\x08\xe7\x07\x02\
\x12\x03\t\0$\n\x0c\n\x05\x08\xe7\x07\x02\x02\x12\x03\t\x07\x1c\n\r\n\
\x06\x08\xe7\x07\x02\x02\0\x12\x03\t\x07\x1c\n\x0e\n\x07\x08\xe7\x07\x02\
\x02\0\x01\x12\x03\t\x08\x1b\n\x0c\n\x05\x08\xe7\x07\x02\x03\x12\x03\t\
\x1f#\n\x08\n\x01\x08\x12\x03\n\0(\n\x0b\n\x04\x08\xe7\x07\x03\x12\x03\n\
\0(\n\x0c\n\x05\x08\xe7\x07\x03\x02\x12\x03\n\x07\x20\n\r\n\x06\x08\xe7\
\x07\x03\x02\0\x12\x03\n\x07\x20\n\x0e\n\x07\x08\xe7\x07\x03\x02\0\x01\
\x12\x03\n\x08\x1f\n\x0c\n\x05\x08\xe7\x07\x03\x03\x12\x03\n#'\n\x08\n\
\x01\x08\x12\x03\x0b\0*\n\x0b\n\x04\x08\xe7\x07\x04\x12\x03\x0b\0*\n\x0c\
\n\x05\x08\xe7\x07\x04\x02\x12\x03\x0b\x07\"\n\r\n\x06\x08\xe7\x07\x04\
\x02\0\x12\x03\x0b\x07\"\n\x0e\n\x07\x08\xe7\x07\x04\x02\0\x01\x12\x03\
\x0b\x08!\n\x0c\n\x05\x08\xe7\x07\x04\x03\x12\x03\x0b%)\n\n\n\x02\x05\0\
\x12\x04\r\0\x10\x01\n\n\n\x03\x05\0\x01\x12\x03\r\x05\x13\n\x0b\n\x04\
\x05\0\x02\0\x12\x03\x0e\x04\x0e\n\x0c\n\x05\x05\0\x02\0\x01\x12\x03\x0e\
\x04\t\n\x0c\n\x05\x05\0\x02\0\x02\x12\x03\x0e\x0c\r\n\x0b\n\x04\x05\0\
\x02\x01\x12\x03\x0f\x04\x0e\n\x0c\n\x05\x05\0\x02\x01\x01\x12\x03\x0f\
\x04\t\n\x0c\n\x05\x05\0\x02\x01\x02\x12\x03\x0f\x0c\r\n\n\n\x02\x05\x01\
\x12\x04\x12\0\x14\x01\n\n\n\x03\x05\x01\x01\x12\x03\x12\x05\x16\n\x0b\n\
\x04\x05\x01\x02\0\x12\x03\x13\x04\x12\n\x0c\n\x05\x05\x01\x02\0\x01\x12\
\x03\x13\x04\r\n\x0c\n\x05\x05\x01\x02\0\x02\x12\x03\x13\x10\x11\n\n\n\
\x02\x04\0\x12\x04\x16\0\x1a\x01\n\n\n\x03\x04\0\x01\x12\x03\x16\x08\x17\
\n\x0b\n\x04\x04\0\x02\0\x12\x03\x17\x04@\n\x0c\n\x05\x04\0\x02\0\x04\
\x12\x03\x17\x04\x0c\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x17\r\x13\n\x0c\
\n\x05\x04\0\x02\0\x01\x12\x03\x17\x14\x1c\n\x0c\n\x05\x04\0\x02\0\x03\
\x12\x03\x17\x1f\x20\n\x0c\n\x05\x04\0\x02\0\x08\x12\x03\x17!?\n\x0f\n\
\x08\x04\0\x02\0\x08\xe7\x07\0\x12\x03\x17\">\n\x10\n\t\x04\0\x02\0\x08\
\xe7\x07\0\x02\x12\x03\x17\"6\n\x11\n\n\x04\0\x02\0\x08\xe7\x07\0\x02\0\
\x12\x03\x17\"6\n\x12\n\x0b\x04\0\x02\0\x08\xe7\x07\0\x02\0\x01\x12\x03\
\x17#5\n\x10\n\t\x04\0\x02\0\x08\xe7\x07\0\x03\x12\x03\x179>\n\x0b\n\x04\
\x04\0\x02\x01\x12\x03\x18\x04G\n\x0c\n\x05\x04\0\x02\x01\x04\x12\x03\
\x18\x04\x0c\n\x0c\n\x05\x04\0\x02\x01\x06\x12\x03\x18\r\x1b\n\x0c\n\x05\
\x04\0\x02\x01\x01\x12\x03\x18\x1c#\n\x0c\n\x05\x04\0\x02\x01\x03\x12\
\x03\x18&'\n\x0c\n\x05\x04\0\x02\x01\x08\x12\x03\x18(F\n\x0f\n\x08\x04\0\
\x02\x01\x08\xe7\x07\0\x12\x03\x18)E\n\x10\n\t\x04\0\x02\x01\x08\xe7\x07\
\0\x02\x12\x03\x18)=\n\x11\n\n\x04\0\x02\x01\x08\xe7\x07\0\x02\0\x12\x03\
\x18)=\n\x12\n\x0b\x04\0\x02\x01\x08\xe7\x07\0\x02\0\x01\x12\x03\x18*<\n\
\x10\n\t\x04\0\x02\x01\x08\xe7\x07\0\x03\x12\x03\x18@E\n\x0b\n\x04\x04\0\
\x02\x02\x12\x03\x19\x04L\n\x0c\n\x05\x04\0\x02\x02\x04\x12\x03\x19\x04\
\x0c\n\x0c\n\x05\x04\0\x02\x02\x06\x12\x03\x19\r\x1e\n\x0c\n\x05\x04\0\
\x02\x02\x01\x12\x03\x19\x1f(\n\x0c\n\x05\x04\0\x02\x02\x03\x12\x03\x19+\
,\n\x0c\n\x05\x04\0\x02\x02\x08\x12\x03\x19-K\n\x0f\n\x08\x04\0\x02\x02\
\x08\xe7\x07\0\x12\x03\x19.J\n\x10\n\t\x04\0\x02\x02\x08\xe7\x07\0\x02\
\x12\x03\x19.B\n\x11\n\n\x04\0\x02\x02\x08\xe7\x07\0\x02\0\x12\x03\x19.B\
\n\x12\n\x0b\x04\0\x02\x02\x08\xe7\x07\0\x02\0\x01\x12\x03\x19/A\n\x10\n\
\t\x04\0\x02\x02\x08\xe7\x07\0\x03\x12\x03\x19EJ\n\n\n\x02\x04\x01\x12\
\x04\x1c\0\x20\x01\n\n\n\x03\x04\x01\x01\x12\x03\x1c\x08\x18\n\x0b\n\x04\
\x04\x01\x02\0\x12\x03\x1d\x04@\n\x0c\n\x05\x04\x01\x02\0\x04\x12\x03\
\x1d\x04\x0c\n\x0c\n\x05\x04\x01\x02\0\x05\x12\x03\x1d\r\x13\n\x0c\n\x05\
\x04\x01\x02\0\x01\x12\x03\x1d\x14\x1c\n\x0c\n\x05\x04\x01\x02\0\x03\x12\
\x03\x1d\x1f\x20\n\x0c\n\x05\x04\x01\x02\0\x08\x12\x03\x1d!?\n\x0f\n\x08\
\x04\x01\x02\0\x08\xe7\x07\0\x12\x03\x1d\">\n\x10\n\t\x04\x01\x02\0\x08\
\xe7\x07\0\x02\x12\x03\x1d\"6\n\x11\n\n\x04\x01\x02\0\x08\xe7\x07\0\x02\
\0\x12\x03\x1d\"6\n\x12\n\x0b\x04\x01\x02\0\x08\xe7\x07\0\x02\0\x01\x12\
\x03\x1d#5\n\x10\n\t\x04\x01\x02\0\x08\xe7\x07\0\x03\x12\x03\x1d9>\n\x0b\
\n\x04\x04\x01\x02\x01\x12\x03\x1e\x04A\n\x0c\n\x05\x04\x01\x02\x01\x04\
\x12\x03\x1e\x04\x0c\n\x0c\n\x05\x04\x01\x02\x01\x05\x12\x03\x1e\r\x13\n\
\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03\x1e\x14\x1d\n\x0c\n\x05\x04\x01\
\x02\x01\x03\x12\x03\x1e\x20!\n\x0c\n\x05\x04\x01\x02\x01\x08\x12\x03\
\x1e\"@\n\x0f\n\x08\x04\x01\x02\x01\x08\xe7\x07\0\x12\x03\x1e#?\n\x10\n\
\t\x04\x01\x02\x01\x08\xe7\x07\0\x02\x12\x03\x1e#7\n\x11\n\n\x04\x01\x02\
\x01\x08\xe7\x07\0\x02\0\x12\x03\x1e#7\n\x12\n\x0b\x04\x01\x02\x01\x08\
\xe7\x07\0\x02\0\x01\x12\x03\x1e$6\n\x10\n\t\x04\x01\x02\x01\x08\xe7\x07\
\0\x03\x12\x03\x1e:?\n\x0b\n\x04\x04\x01\x02\x02\x12\x03\x1f\x04C\n\x0c\
\n\x05\x04\x01\x02\x02\x04\x12\x03\x1f\x04\x0c\n\x0c\n\x05\x04\x01\x02\
\x02\x05\x12\x03\x1f\r\x13\n\x0c\n\x05\x04\x01\x02\x02\x01\x12\x03\x1f\
\x14\x1f\n\x0c\n\x05\x04\x01\x02\x02\x03\x12\x03\x1f\"#\n\x0c\n\x05\x04\
\x01\x02\x02\x08\x12\x03\x1f$B\n\x0f\n\x08\x04\x01\x02\x02\x08\xe7\x07\0\
\x12\x03\x1f%A\n\x10\n\t\x04\x01\x02\x02\x08\xe7\x07\0\x02\x12\x03\x1f%9\
\n\x11\n\n\x04\x01\x02\x02\x08\xe7\x07\0\x02\0\x12\x03\x1f%9\n\x12\n\x0b\
\x04\x01\x02\x02\x08\xe7\x07\0\x02\0\x01\x12\x03\x1f&8\n\x10\n\t\x04\x01\
\x02\x02\x08\xe7\x07\0\x03\x12\x03\x1f<A\
\x12\x03\x04\0\"\n\t\n\x02\x08\n\x12\x03\x04\0\"\n\x08\n\x01\x08\x12\x03\
\x05\0.\n\t\n\x02\x08\x01\x12\x03\x05\0.\n\t\n\x02\x03\0\x12\x03\x07\x07\
\x1d\n\x08\n\x01\x08\x12\x03\t\0$\n\x0b\n\x04\x08\xac\xec\x03\x12\x03\t\
\0$\n\x08\n\x01\x08\x12\x03\n\0(\n\x0b\n\x04\x08\xa9\xec\x03\x12\x03\n\0\
(\n\x08\n\x01\x08\x12\x03\x0b\0*\n\x0b\n\x04\x08\xaa\xec\x03\x12\x03\x0b\
\0*\n\n\n\x02\x05\0\x12\x04\r\0\x10\x01\n\n\n\x03\x05\0\x01\x12\x03\r\
\x05\x13\n\x0b\n\x04\x05\0\x02\0\x12\x03\x0e\x04\x0e\n\x0c\n\x05\x05\0\
\x02\0\x01\x12\x03\x0e\x04\t\n\x0c\n\x05\x05\0\x02\0\x02\x12\x03\x0e\x0c\
\r\n\x0b\n\x04\x05\0\x02\x01\x12\x03\x0f\x04\x0e\n\x0c\n\x05\x05\0\x02\
\x01\x01\x12\x03\x0f\x04\t\n\x0c\n\x05\x05\0\x02\x01\x02\x12\x03\x0f\x0c\
\r\n\n\n\x02\x05\x01\x12\x04\x12\0\x14\x01\n\n\n\x03\x05\x01\x01\x12\x03\
\x12\x05\x16\n\x0b\n\x04\x05\x01\x02\0\x12\x03\x13\x04\x12\n\x0c\n\x05\
\x05\x01\x02\0\x01\x12\x03\x13\x04\r\n\x0c\n\x05\x05\x01\x02\0\x02\x12\
\x03\x13\x10\x11\n\n\n\x02\x04\0\x12\x04\x16\0\x1a\x01\n\n\n\x03\x04\0\
\x01\x12\x03\x16\x08\x17\n\x0b\n\x04\x04\0\x02\0\x12\x03\x17\x04@\n\x0c\
\n\x05\x04\0\x02\0\x04\x12\x03\x17\x04\x0c\n\x0c\n\x05\x04\0\x02\0\x05\
\x12\x03\x17\r\x13\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x17\x14\x1c\n\x0c\
\n\x05\x04\0\x02\0\x03\x12\x03\x17\x1f\x20\n\x0c\n\x05\x04\0\x02\0\x08\
\x12\x03\x17!?\n\x0f\n\x08\x04\0\x02\0\x08\xe9\xfb\x03\x12\x03\x17\">\n\
\x0b\n\x04\x04\0\x02\x01\x12\x03\x18\x04G\n\x0c\n\x05\x04\0\x02\x01\x04\
\x12\x03\x18\x04\x0c\n\x0c\n\x05\x04\0\x02\x01\x06\x12\x03\x18\r\x1b\n\
\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x18\x1c#\n\x0c\n\x05\x04\0\x02\x01\
\x03\x12\x03\x18&'\n\x0c\n\x05\x04\0\x02\x01\x08\x12\x03\x18(F\n\x0f\n\
\x08\x04\0\x02\x01\x08\xe9\xfb\x03\x12\x03\x18)E\n\x0b\n\x04\x04\0\x02\
\x02\x12\x03\x19\x04L\n\x0c\n\x05\x04\0\x02\x02\x04\x12\x03\x19\x04\x0c\
\n\x0c\n\x05\x04\0\x02\x02\x06\x12\x03\x19\r\x1e\n\x0c\n\x05\x04\0\x02\
\x02\x01\x12\x03\x19\x1f(\n\x0c\n\x05\x04\0\x02\x02\x03\x12\x03\x19+,\n\
\x0c\n\x05\x04\0\x02\x02\x08\x12\x03\x19-K\n\x0f\n\x08\x04\0\x02\x02\x08\
\xe9\xfb\x03\x12\x03\x19.J\n\n\n\x02\x04\x01\x12\x04\x1c\0\x20\x01\n\n\n\
\x03\x04\x01\x01\x12\x03\x1c\x08\x18\n\x0b\n\x04\x04\x01\x02\0\x12\x03\
\x1d\x04@\n\x0c\n\x05\x04\x01\x02\0\x04\x12\x03\x1d\x04\x0c\n\x0c\n\x05\
\x04\x01\x02\0\x05\x12\x03\x1d\r\x13\n\x0c\n\x05\x04\x01\x02\0\x01\x12\
\x03\x1d\x14\x1c\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\x1d\x1f\x20\n\x0c\
\n\x05\x04\x01\x02\0\x08\x12\x03\x1d!?\n\x0f\n\x08\x04\x01\x02\0\x08\xe9\
\xfb\x03\x12\x03\x1d\">\n\x0b\n\x04\x04\x01\x02\x01\x12\x03\x1e\x04A\n\
\x0c\n\x05\x04\x01\x02\x01\x04\x12\x03\x1e\x04\x0c\n\x0c\n\x05\x04\x01\
\x02\x01\x05\x12\x03\x1e\r\x13\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03\
\x1e\x14\x1d\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03\x1e\x20!\n\x0c\n\
\x05\x04\x01\x02\x01\x08\x12\x03\x1e\"@\n\x0f\n\x08\x04\x01\x02\x01\x08\
\xe9\xfb\x03\x12\x03\x1e#?\n\x0b\n\x04\x04\x01\x02\x02\x12\x03\x1f\x04C\
\n\x0c\n\x05\x04\x01\x02\x02\x04\x12\x03\x1f\x04\x0c\n\x0c\n\x05\x04\x01\
\x02\x02\x05\x12\x03\x1f\r\x13\n\x0c\n\x05\x04\x01\x02\x02\x01\x12\x03\
\x1f\x14\x1f\n\x0c\n\x05\x04\x01\x02\x02\x03\x12\x03\x1f\"#\n\x0c\n\x05\
\x04\x01\x02\x02\x08\x12\x03\x1f$B\n\x0f\n\x08\x04\x01\x02\x02\x08\xe9\
\xfb\x03\x12\x03\x1f%A\
";

static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy {
Expand Down
Loading

0 comments on commit 11e33c7

Please sign in to comment.