> On Aug. 7, 2014, 1:01 a.m., Jinfeng Ni wrote: > > exec/java-exec/src/main/codegen/templates/NumericFunctionsTemplates.java, > > line 85 > > <https://reviews.apache.org/r/24345/diff/1/?file=652802#file652802line85> > > > > I'm not sure if JVM will optimize or not. Here, for each input value, > > the code will compile a regex pattern, and do the match. Seems it's a big > > overhead. > > > > Maybe you can consider move the build of regex pattern into setup() > > method, since the pattern string in this case is a constant, so that the > > pattern is only built once for the whole record batch, in stead of for each > > input value. > > > > You may take a look at StringFunctions.like() or similar() operator. > >
Pattern moved to workspace level. Also reusing Matcher instead of creating new matcher every time. - Yash ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/24345/#review49822 ----------------------------------------------------------- On Aug. 5, 2014, 9:54 p.m., Yash Sharma wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/24345/ > ----------------------------------------------------------- > > (Updated Aug. 5, 2014, 9:54 p.m.) > > > Review request for drill, Aditya Kishore and Mehant Baid. > > > Repository: drill-git > > > Description > ------- > > Implemented Drill Function IsNumeric for DRILL-1141 > > > Diffs > ----- > > exec/java-exec/src/main/codegen/config.fmpp ff6135d > exec/java-exec/src/main/codegen/data/NumericTypes.tdd f37a3dd > exec/java-exec/src/main/codegen/templates/NumericFunctionsTemplates.java > PRE-CREATION > > exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestNewMathFunctions.java > 62a224e > exec/java-exec/src/test/resources/functions/testIsNumericFunction.json > PRE-CREATION > > Diff: https://reviews.apache.org/r/24345/diff/ > > > Testing > ------- > > Yes. > > > Test Case: > > $mvn test -Dtest=TestNewMathFunctions#testIsNumeric > > Sqlline Test: > > 0: jdbc:drill:zk=local> SELECT employee_id, isnumeric(employee_id) > isnumeric_1, first_name, isnumeric(first_name) isnumeric_2 FROM > cp.`employee.json` limit 10; > > +-------------+-------------+------------+-------------+ > | employee_id | isnumeric_1 | first_name | isnumeric_2 | > +-------------+-------------+------------+-------------+ > | 1 | 1 | Sheri | 0 | > | 2 | 1 | Derrick | 0 | > | 4 | 1 | Michael | 0 | > | 5 | 1 | Maya | 0 | > | 6 | 1 | Roberta | 0 | > | 7 | 1 | Rebecca | 0 | > | 8 | 1 | Kim | 0 | > | 9 | 1 | Brenda | 0 | > | 10 | 1 | Darren | 0 | > | 11 | 1 | Jonathan | 0 | > +-------------+-------------+------------+-------------+ > 10 rows selected (0.451 seconds) > > > Thanks, > > Yash Sharma > >