@@ -13,6 +13,9 @@ a_cdb2config=$4
1313a_dbdir=$5
1414a_testdir=$6
1515
16+ # TEST1 checking for missed table followed by good tables
17+ echo " TEST1 checking for missed table followed by good tables"
18+
1619output=run.out
1720
1821REM_CDB2_OPTIONS=" --cdb2cfg ${a_remcdb2config} "
@@ -51,7 +54,6 @@ cdb2sql ${SRC_CDB2_OPTIONS} --host $mach $a_dbname "select * from LOCAL_${a_remd
5154cdb2sql ${SRC_CDB2_OPTIONS} --tabs --host $mach $a_dbname " exec procedure sys.cmd.send(\" fdb info db\" )" 2>&1 | cut -f 5- -d ' ' >> $output
5255
5356
54-
5557# convert the table to actual dbname
5658sed " s/dorintdb/${a_remdbname} /g" output.log > output.log.actual
5759
@@ -74,7 +76,8 @@ if [[ "$testcase_output" != "$expected_output" ]]; then
7476 exit 1
7577fi
7678
77- # TEST2 start by accessing a missing table, followed by good tables
79+ # TEST2 following test one, again try to access a missing table, followed by good tables
80+ echo " TEST2 following test one, again try to access a missing table, followed by good tables"
7881
7982output=run.2.out
8083
@@ -109,6 +112,7 @@ cdb2sql ${SRC_CDB2_OPTIONS} --host $mach $a_dbname "select dbname, tablename, in
109112sed " s/dorintdb/${a_remdbname} /g" output_2.log > output_2.log.actual
110113
111114# validate results
115+
112116testcase_output=$( cat $output )
113117expected_output=$( cat output_2.log.actual)
114118if [[ " $testcase_output " != " $expected_output " ]]; then
@@ -127,5 +131,44 @@ if [[ "$testcase_output" != "$expected_output" ]]; then
127131 exit 1
128132fi
129133
134+ # TEST3 check that json_extract works - patch for function context
135+ echo " TEST3 check that json_extract works - patch for function context"
136+
137+ output=run.3.out
138+
139+ cdb2sql ${REM_CDB2_OPTIONS} $a_remdbname default " analyze t" > $output 2>&1
140+
141+ echo cdb2sql ${SRC_CDB2_OPTIONS} $a_dbname default " select * from LOCAL_${a_remdbname} .t where json_extract( '{\" bb\" :123}', '$.bb') = id"
142+ cdb2sql ${SRC_CDB2_OPTIONS} $a_dbname default " select * from LOCAL_${a_remdbname} .t where json_extract( '{\" bb\" :123}', '$.bb') = id" > $output 2>&1
143+ cdb2sql ${SRC_CDB2_OPTIONS} $a_dbname default " select * from LOCAL_${a_remdbname} .t where json_extract( '{\" bb\" :123}', '$.bb' ) = id"
144+
145+ if (( $? != 0 )) ; then
146+ echo " Failure: select exit code $? "
147+ exit 1
148+ fi
149+
150+ # convert the table to actual dbname
151+ sed " s/dorintdb/${a_remdbname} /g" output_3.log > output_3.log.actual
152+
153+ # validate results
154+
155+ testcase_output=$( cat $output )
156+ expected_output=$( cat output_3.log.actual)
157+ if [[ " $testcase_output " != " $expected_output " ]]; then
158+
159+ # print message
160+ echo " ^^^^^^^^^^^^"
161+ echo " The above testcase (${testcase} ) has failed!!!"
162+ echo " "
163+ echo " Use 'diff <expected-output> <my-output>' to see why:"
164+ echo " > diff ${PWD} /{output_2.log.actual,$output }"
165+ echo " "
166+ diff output_3.log.actual $output
167+ echo " "
168+
169+ # quit
170+ exit 1
171+ fi
172+
130173
131174echo " Testcase passed."
0 commit comments