()
| 1920 | } |
| 1921 | |
| 1922 | protected Graph duplicate() { |
| 1923 | // There are two choices on how we duplicate the logical plan |
| 1924 | // 1 - we really clone each operator and connect up the cloned operators |
| 1925 | // 2 - we cache away the script till the point we need to clone |
| 1926 | // and then simply re-parse the script. |
| 1927 | // The latter approach is used here |
| 1928 | // FIXME: There is one open issue with this now: |
| 1929 | // Consider the following script: |
| 1930 | // A = load 'file:/somefile'; |
| 1931 | // B = filter A by $0 > 10; |
| 1932 | // store B into 'bla'; |
| 1933 | // rm 'file:/somefile'; |
| 1934 | // A = load 'file:/someotherfile' |
| 1935 | // when we try to clone - we try to reparse |
| 1936 | // from the beginning and currently the parser |
| 1937 | // checks for file existence of files in the load |
| 1938 | // in the case where the file is a local one -i.e. with file: prefix |
| 1939 | // This will be a known issue now and we will need to revisit later |
| 1940 | |
| 1941 | // parse each line of the cached script |
| 1942 | int lineNumber = 1; |
| 1943 | |
| 1944 | // create data structures needed for parsing |
| 1945 | Graph graph = new Graph(isBatchOn()); |
| 1946 | graph.processedStores = processedStores; |
| 1947 | graph.fileNameMap = new HashMap<String, String>(fileNameMap); |
| 1948 | |
| 1949 | try { |
| 1950 | for (Iterator<String> it = scriptCache.iterator(); it.hasNext(); lineNumber++) { |
| 1951 | // always doing registerQuery irrespective of the batch mode |
| 1952 | // TODO: Need to figure out if anything different needs to happen if batch |
| 1953 | // mode is not on |
| 1954 | // Don't have to do the validation again, so set validateEachStatement param to false |
| 1955 | graph.registerQuery(it.next(), lineNumber, false, false); |
| 1956 | } |
| 1957 | graph.postProcess(); |
| 1958 | } catch (IOException ioe) { |
| 1959 | ioe.printStackTrace(); |
| 1960 | graph = null; |
| 1961 | } |
| 1962 | return graph; |
| 1963 | } |
| 1964 | } |
| 1965 | |
| 1966 | /** |
no test coverage detected