{"push_id":1477407370,"size":1,"distinct_size":1,"ref":"refs/heads/nvanbenschoten/noInferenceReal","head":"f12f96ab5527c99318c1eafe543b10dd82bab80b","before":"01bf5f4f22371c35adbdb259826f6c58b2442978","commits":[{"sha":"f12f96ab5527c99318c1eafe543b10dd82bab80b","author":{"name":"Nathan VanBenschoten","email":"b4a34fbdb14efbe352ced896f3acfafd868eb64f@gmail.com"},"message":"sql/parser: Document limitation with StrVal.AvailableTypes\n\nThis change addresses a TODO to improve string literal type inference.\nThe TODO will not be addressed at this time, because of the reasons\nadded to the method comment:\n\n> To fully take advantage of literal type inference, this method would\n> determine exactly which types are available for a given string. This would\n> entail attempting to parse the literal string as a date, a timestamp, an\n> interval, etc. and having more fine-grained results than strValAvailAllParsable.\n> However, this is not feasible in practice because of the associated parsing\n> overhead.\n>\n> Conservative approaches like checking the string's length have been investigated\n> to reduce ambiguity and improve type inference in some cases. When doing so, the\n> length of the string literal was compared against all valid date and timestamp\n> formats to quickly gain limited insight into whether parsing the string as the\n> respective datum types could succeed. The hope was to eliminate impossibilities\n> and constrain the returned type sets as much as possible. Unfortunately, two issues\n> were found with this approach:\n> - date and timestamp formats do not always imply a fixed-length valid input. For\n>   instance, timestamp formats that take fractional seconds can successfully parse\n>   inputs of varied length.\n> - the set of date and timestamp formats are not disjoint, which means that ambiguity\n>   can not be eliminated when inferring the type of string literals that use these\n>   shared formats.\n> While these limitations still permitted improved type inference in many cases, they\n> resulted in behavior that was ultimately incomplete, resulted in unpredictable levels\n> of inference, and occasionally failed to eliminate ambiguity. Further heuristics could\n> have been applied to improve the accuracy of the inference, like checking that all\n> or some characters were digits, but it would not have circumvented the fundamental\n> issues here. Fully parsing the literal into each type would be the only way to\n> concretely avoid the issue of unpredictable inference behavior.","distinct":true,"url":"https://api.github.com/repos/nvanbenschoten/cockroach/commits/f12f96ab5527c99318c1eafe543b10dd82bab80b"}]}
{"actor":{"display_login":"nvanbenschoten"}}