[ https://issues.apache.org/jira/browse/TRAFODION-2772?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16354318#comment-16354318 ]
ASF GitHub Bot commented on TRAFODION-2772: ------------------------------------------- Github user DaveBirdsall commented on a diff in the pull request: https://github.com/apache/trafodion/pull/1439#discussion_r166401395 --- Diff: core/sql/exp/exp_function.cpp --- @@ -6503,8 +6503,15 @@ ex_expr::exp_return_type ex_function_json_object_field_text::eval(char *op_data[ Int32 prec2 = ((SimpleType *)getOperand(2))->getPrecision(); len2 = Attributes::trimFillerSpaces( op_data[2], prec2, len2, cs ); } + char *rltStr = NULL; - JsonReturnType ret = json_extract_path_text(&rltStr, op_data[1], 1, op_data[2]); + char *jsonStr = new(heap) char[len1+1]; + char *jsonAttr = new(heap) char[len2+1]; --- End diff -- Here's an example. Compile this program: // Demonstrate dynamically-sized arrays on C++ stack #include <iostream> using namespace std; int main(int argc, char * argv[]) { for (size_t i = 5; i < 10; i++) { char temp[i+1]; cout << "sizeof(temp) = " << sizeof(temp) << endl; } return 0; } When you run it, you'll get this output: [birdsall@edev08 dynChar]$ ./dynChar.exe sizeof(temp) = 6 sizeof(temp) = 7 sizeof(temp) = 8 sizeof(temp) = 9 sizeof(temp) = 10 [birdsall@edev08 dynChar]$ > retrieve a value from Json string got an error: Json value is invalid > --------------------------------------------------------------------- > > Key: TRAFODION-2772 > URL: https://issues.apache.org/jira/browse/TRAFODION-2772 > Project: Apache Trafodion > Issue Type: Bug > Reporter: Yang, Yongfeng > Assignee: Yang, Yongfeng > Priority: Major > > >>create table json(str varchar(200)); > >>select json_object_field_text('{"f2":1}', 'f2') from json; > *** ERROR[8971] JSON value is invalid. > --- 0 row(s) selected. > >> > the expected result should like below. > >>select json_object_field_text('{"f2":1}', 'f2') from (values(1)) T; > (EXPR) > -------- > 1 > --- 1 row(s) selected. > >> > >>select json_object_field_text('{"f2":1}', 'f2') from (values(1)) T; > (EXPR) > -------- > 1 > --- 1 row(s) selected. > >> -- This message was sent by Atlassian JIRA (v7.6.3#76005)