{
  "schemaVersion": 1,
  "apiVersion": "DATA06-records-v1",
  "scope": "Fixed archived native SQLite / base-R programs. No browser SQL/Python/R execution.",
  "runtime": {
    "python": "Python 3.12.14",
    "r": "Rscript (R) version 4.5.1 (2025-06-13)",
    "sqlite": "3.53.1",
    "pythonExecutionPolicy": {
      "stdoutEncoding": "utf-8",
      "stderrEncoding": "utf-8",
      "nativeModule": "sqlite3",
      "database": ":memory:",
      "configurationInDownloadedSource": true
    },
    "rExecutionPolicy": {
      "commandFlags": [
        "--vanilla"
      ],
      "characterLocaleRequestOnWindows": "English_United States.utf8",
      "recorderOverridesDisplayOptions": false,
      "numericJSONFormat": "format digits=17,scientific=FALSE",
      "execution": "base R; not a SQL engine"
    }
  },
  "keys": {
    "python": {
      "valid": {
        "returnCode": 0,
        "stdout": "{\"keyColumns\": [\"iso\"], \"rows\": [[\"A\", 2023], [\"B\", 2024]], \"declaredKeyPassed\": true, \"observationalTruthCertified\": false}\n",
        "stderr": "",
        "language": "python",
        "id": "valid",
        "code": "import sys\nsys.stdout.reconfigure(encoding=\"utf-8\")\nsys.stderr.reconfigure(encoding=\"utf-8\")\nimport json,sqlite3\ndb=sqlite3.connect(\":memory:\")\ndb.execute('CREATE TABLE records(iso TEXT NOT NULL PRIMARY KEY,year INTEGER NOT NULL);')\nrows=[['A', 2023], ['B', 2024]]\ndb.executemany(\"INSERT INTO records VALUES(?,?)\",rows)\nprint(json.dumps(dict(keyColumns=['iso'],rows=rows,declaredKeyPassed=True,observationalTruthCertified=False)))\ndb.close()\n",
        "codeFile": "data06-snippets/python/keys-valid.py",
        "codeSha256": "0ab0399329fbc36ab09487a9cf7187be1b75838188a2d750a70958bf2237ff6b",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "CREATE TABLE records(iso TEXT NOT NULL PRIMARY KEY,year INTEGER NOT NULL);",
        "sqlFile": "data06-snippets/sql/keys-valid.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": true,
        "baseRCounterpart": false,
        "scenario": "valid",
        "keyColumns": [
          "iso"
        ],
        "summary": {
          "keyColumns": [
            "iso"
          ],
          "rows": [
            [
              "A",
              2023
            ],
            [
              "B",
              2024
            ]
          ],
          "declaredKeyPassed": true,
          "observationalTruthCertified": false
        }
      },
      "duplicate": {
        "returnCode": 1,
        "stdout": "",
        "stderr": "Traceback (most recent call last):\n  File \"[execution directory]\\outputs\\교재_총서_재설계\\data06-snippets\\python\\keys-duplicate.py\", line 8, in <module>\n    db.executemany(\"INSERT INTO records VALUES(?,?)\",rows)\nsqlite3.IntegrityError: UNIQUE constraint failed: records.iso\n",
        "language": "python",
        "id": "duplicate",
        "code": "import sys\nsys.stdout.reconfigure(encoding=\"utf-8\")\nsys.stderr.reconfigure(encoding=\"utf-8\")\nimport json,sqlite3\ndb=sqlite3.connect(\":memory:\")\ndb.execute('CREATE TABLE records(iso TEXT NOT NULL PRIMARY KEY,year INTEGER NOT NULL);')\nrows=[['A', 2023], ['A', 2024]]\ndb.executemany(\"INSERT INTO records VALUES(?,?)\",rows)\nprint(json.dumps(dict(keyColumns=['iso'],rows=rows,declaredKeyPassed=True,observationalTruthCertified=False)))\ndb.close()\n",
        "codeFile": "data06-snippets/python/keys-duplicate.py",
        "codeSha256": "e9eff3519e0dec115dc221d79e6c678c2f9d0facf1b2d8f2b19e0c7a741abe17",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "CREATE TABLE records(iso TEXT NOT NULL PRIMARY KEY,year INTEGER NOT NULL);",
        "sqlFile": "data06-snippets/sql/keys-duplicate.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": true,
        "baseRCounterpart": false,
        "scenario": "duplicate",
        "keyColumns": [
          "iso"
        ]
      },
      "null": {
        "returnCode": 1,
        "stdout": "",
        "stderr": "Traceback (most recent call last):\n  File \"[execution directory]\\outputs\\교재_총서_재설계\\data06-snippets\\python\\keys-null.py\", line 8, in <module>\n    db.executemany(\"INSERT INTO records VALUES(?,?)\",rows)\nsqlite3.IntegrityError: NOT NULL constraint failed: records.iso\n",
        "language": "python",
        "id": "null",
        "code": "import sys\nsys.stdout.reconfigure(encoding=\"utf-8\")\nsys.stderr.reconfigure(encoding=\"utf-8\")\nimport json,sqlite3\ndb=sqlite3.connect(\":memory:\")\ndb.execute('CREATE TABLE records(iso TEXT NOT NULL PRIMARY KEY,year INTEGER NOT NULL);')\nrows=[[None, 2023], ['B', 2024]]\ndb.executemany(\"INSERT INTO records VALUES(?,?)\",rows)\nprint(json.dumps(dict(keyColumns=['iso'],rows=rows,declaredKeyPassed=True,observationalTruthCertified=False)))\ndb.close()\n",
        "codeFile": "data06-snippets/python/keys-null.py",
        "codeSha256": "003dd709c48c6eba31aa3b057954f93c4c847fd37998a3cc7c66c834146b71a4",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "CREATE TABLE records(iso TEXT NOT NULL PRIMARY KEY,year INTEGER NOT NULL);",
        "sqlFile": "data06-snippets/sql/keys-null.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": true,
        "baseRCounterpart": false,
        "scenario": "null",
        "keyColumns": [
          "iso"
        ]
      },
      "composite": {
        "returnCode": 0,
        "stdout": "{\"keyColumns\": [\"iso\", \"year\"], \"rows\": [[\"A\", 2023], [\"A\", 2024]], \"declaredKeyPassed\": true, \"observationalTruthCertified\": false}\n",
        "stderr": "",
        "language": "python",
        "id": "composite",
        "code": "import sys\nsys.stdout.reconfigure(encoding=\"utf-8\")\nsys.stderr.reconfigure(encoding=\"utf-8\")\nimport json,sqlite3\ndb=sqlite3.connect(\":memory:\")\ndb.execute('CREATE TABLE records(iso TEXT NOT NULL,year INTEGER NOT NULL,PRIMARY KEY(iso,year));')\nrows=[['A', 2023], ['A', 2024]]\ndb.executemany(\"INSERT INTO records VALUES(?,?)\",rows)\nprint(json.dumps(dict(keyColumns=['iso', 'year'],rows=rows,declaredKeyPassed=True,observationalTruthCertified=False)))\ndb.close()\n",
        "codeFile": "data06-snippets/python/keys-composite.py",
        "codeSha256": "2f7d3f37dffa8163f5e35a682809cc32572a8470bbce258d7c43db9036d75d94",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "CREATE TABLE records(iso TEXT NOT NULL,year INTEGER NOT NULL,PRIMARY KEY(iso,year));",
        "sqlFile": "data06-snippets/sql/keys-composite.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": true,
        "baseRCounterpart": false,
        "scenario": "composite",
        "keyColumns": [
          "iso",
          "year"
        ],
        "summary": {
          "keyColumns": [
            "iso",
            "year"
          ],
          "rows": [
            [
              "A",
              2023
            ],
            [
              "A",
              2024
            ]
          ],
          "declaredKeyPassed": true,
          "observationalTruthCertified": false
        }
      }
    },
    "r": {
      "valid": {
        "returnCode": 0,
        "stdout": "{\"keyColumns\":[\"iso\"],\"rows\":[[\"A\",2023],[\"B\",2024]],\"declaredKeyPassed\":true,\"observationalTruthCertified\":false}\n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "language": "r",
        "id": "valid",
        "code": "if (.Platform$OS.type == \"windows\") invisible(Sys.setlocale(\"LC_CTYPE\", \"English_United States.utf8\"))\nto_json <- function(x) {\n  if (is.null(x)) return(\"null\")\n  if (is.list(x)) {\n    parts <- vapply(x,to_json,character(1))\n    if (is.null(names(x))) return(paste0(\"[\",paste(parts,collapse=\",\"),\"]\"))\n    keys <- vapply(names(x),function(s) encodeString(s,quote='\"'),character(1))\n    return(paste0(\"{\",paste(paste0(keys,\":\",parts),collapse=\",\"),\"}\"))\n  }\n  if (length(x)!=1L) return(to_json(as.list(x)))\n  if (is.na(x)) return(\"null\")\n  if (is.character(x)) return(encodeString(x,quote='\"'))\n  if (is.logical(x)) return(tolower(as.character(x)))\n  if (!is.finite(x)) stop(\"finite numerical display required\")\n  format(x,digits=17,scientific=FALSE,trim=TRUE)\n}\nemit <- function(x) cat(to_json(x),\"\\n\",sep=\"\")\nrow_lists <- function(d) lapply(seq_len(nrow(d)),function(i) unname(as.list(d[i,,drop=FALSE])))\nrows <- data.frame(iso=c(\"A\",\"B\"),year=c(2023L,2024L),stringsAsFactors=FALSE)\nkey_columns <- \"iso\"\nif (anyNA(rows[key_columns])) stop(\"declared key contains NA\")\nif (anyDuplicated(rows[key_columns])) stop(\"declared key is not unique\")\nemit(list(keyColumns=as.list(key_columns),rows=row_lists(rows),declaredKeyPassed=TRUE,observationalTruthCertified=FALSE))\n",
        "codeFile": "data06-snippets/r/keys-valid.R",
        "codeSha256": "c18ffb8e8360b83af330eea29793c4bd8deb6e81d239ae0593af7177d0e1ae0c",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "CREATE TABLE records(iso TEXT NOT NULL PRIMARY KEY,year INTEGER NOT NULL);",
        "sqlFile": "data06-snippets/sql/keys-valid.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": false,
        "baseRCounterpart": true,
        "scenario": "valid",
        "keyColumns": [
          "iso"
        ],
        "summary": {
          "keyColumns": [
            "iso"
          ],
          "rows": [
            [
              "A",
              2023
            ],
            [
              "B",
              2024
            ]
          ],
          "declaredKeyPassed": true,
          "observationalTruthCertified": false
        }
      },
      "duplicate": {
        "returnCode": 1,
        "stdout": "",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \nError: declared key is not unique\nExecution halted\n",
        "language": "r",
        "id": "duplicate",
        "code": "if (.Platform$OS.type == \"windows\") invisible(Sys.setlocale(\"LC_CTYPE\", \"English_United States.utf8\"))\nto_json <- function(x) {\n  if (is.null(x)) return(\"null\")\n  if (is.list(x)) {\n    parts <- vapply(x,to_json,character(1))\n    if (is.null(names(x))) return(paste0(\"[\",paste(parts,collapse=\",\"),\"]\"))\n    keys <- vapply(names(x),function(s) encodeString(s,quote='\"'),character(1))\n    return(paste0(\"{\",paste(paste0(keys,\":\",parts),collapse=\",\"),\"}\"))\n  }\n  if (length(x)!=1L) return(to_json(as.list(x)))\n  if (is.na(x)) return(\"null\")\n  if (is.character(x)) return(encodeString(x,quote='\"'))\n  if (is.logical(x)) return(tolower(as.character(x)))\n  if (!is.finite(x)) stop(\"finite numerical display required\")\n  format(x,digits=17,scientific=FALSE,trim=TRUE)\n}\nemit <- function(x) cat(to_json(x),\"\\n\",sep=\"\")\nrow_lists <- function(d) lapply(seq_len(nrow(d)),function(i) unname(as.list(d[i,,drop=FALSE])))\nrows <- data.frame(iso=c(\"A\",\"A\"),year=c(2023L,2024L),stringsAsFactors=FALSE)\nkey_columns <- \"iso\"\nif (anyNA(rows[key_columns])) stop(\"declared key contains NA\")\nif (anyDuplicated(rows[key_columns])) stop(\"declared key is not unique\")\nemit(list(keyColumns=as.list(key_columns),rows=row_lists(rows),declaredKeyPassed=TRUE,observationalTruthCertified=FALSE))\n",
        "codeFile": "data06-snippets/r/keys-duplicate.R",
        "codeSha256": "dd7f98e75641ffd482f6b39edb5c3563717197bf61accadd4cfc6755692b042e",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "CREATE TABLE records(iso TEXT NOT NULL PRIMARY KEY,year INTEGER NOT NULL);",
        "sqlFile": "data06-snippets/sql/keys-duplicate.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": false,
        "baseRCounterpart": true,
        "scenario": "duplicate",
        "keyColumns": [
          "iso"
        ]
      },
      "null": {
        "returnCode": 1,
        "stdout": "",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \nError: declared key contains NA\nExecution halted\n",
        "language": "r",
        "id": "null",
        "code": "if (.Platform$OS.type == \"windows\") invisible(Sys.setlocale(\"LC_CTYPE\", \"English_United States.utf8\"))\nto_json <- function(x) {\n  if (is.null(x)) return(\"null\")\n  if (is.list(x)) {\n    parts <- vapply(x,to_json,character(1))\n    if (is.null(names(x))) return(paste0(\"[\",paste(parts,collapse=\",\"),\"]\"))\n    keys <- vapply(names(x),function(s) encodeString(s,quote='\"'),character(1))\n    return(paste0(\"{\",paste(paste0(keys,\":\",parts),collapse=\",\"),\"}\"))\n  }\n  if (length(x)!=1L) return(to_json(as.list(x)))\n  if (is.na(x)) return(\"null\")\n  if (is.character(x)) return(encodeString(x,quote='\"'))\n  if (is.logical(x)) return(tolower(as.character(x)))\n  if (!is.finite(x)) stop(\"finite numerical display required\")\n  format(x,digits=17,scientific=FALSE,trim=TRUE)\n}\nemit <- function(x) cat(to_json(x),\"\\n\",sep=\"\")\nrow_lists <- function(d) lapply(seq_len(nrow(d)),function(i) unname(as.list(d[i,,drop=FALSE])))\nrows <- data.frame(iso=c(NA_character_,\"B\"),year=c(2023L,2024L),stringsAsFactors=FALSE)\nkey_columns <- \"iso\"\nif (anyNA(rows[key_columns])) stop(\"declared key contains NA\")\nif (anyDuplicated(rows[key_columns])) stop(\"declared key is not unique\")\nemit(list(keyColumns=as.list(key_columns),rows=row_lists(rows),declaredKeyPassed=TRUE,observationalTruthCertified=FALSE))\n",
        "codeFile": "data06-snippets/r/keys-null.R",
        "codeSha256": "409123ff851b92dcdc7b39c35908aabde5ec3db01d303296d3e27254f59d0e30",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "CREATE TABLE records(iso TEXT NOT NULL PRIMARY KEY,year INTEGER NOT NULL);",
        "sqlFile": "data06-snippets/sql/keys-null.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": false,
        "baseRCounterpart": true,
        "scenario": "null",
        "keyColumns": [
          "iso"
        ]
      },
      "composite": {
        "returnCode": 0,
        "stdout": "{\"keyColumns\":[\"iso\",\"year\"],\"rows\":[[\"A\",2023],[\"A\",2024]],\"declaredKeyPassed\":true,\"observationalTruthCertified\":false}\n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "language": "r",
        "id": "composite",
        "code": "if (.Platform$OS.type == \"windows\") invisible(Sys.setlocale(\"LC_CTYPE\", \"English_United States.utf8\"))\nto_json <- function(x) {\n  if (is.null(x)) return(\"null\")\n  if (is.list(x)) {\n    parts <- vapply(x,to_json,character(1))\n    if (is.null(names(x))) return(paste0(\"[\",paste(parts,collapse=\",\"),\"]\"))\n    keys <- vapply(names(x),function(s) encodeString(s,quote='\"'),character(1))\n    return(paste0(\"{\",paste(paste0(keys,\":\",parts),collapse=\",\"),\"}\"))\n  }\n  if (length(x)!=1L) return(to_json(as.list(x)))\n  if (is.na(x)) return(\"null\")\n  if (is.character(x)) return(encodeString(x,quote='\"'))\n  if (is.logical(x)) return(tolower(as.character(x)))\n  if (!is.finite(x)) stop(\"finite numerical display required\")\n  format(x,digits=17,scientific=FALSE,trim=TRUE)\n}\nemit <- function(x) cat(to_json(x),\"\\n\",sep=\"\")\nrow_lists <- function(d) lapply(seq_len(nrow(d)),function(i) unname(as.list(d[i,,drop=FALSE])))\nrows <- data.frame(iso=c(\"A\",\"A\"),year=c(2023L,2024L),stringsAsFactors=FALSE)\nkey_columns <- c(\"iso\",\"year\")\nif (anyNA(rows[key_columns])) stop(\"declared key contains NA\")\nif (anyDuplicated(rows[key_columns])) stop(\"declared key is not unique\")\nemit(list(keyColumns=as.list(key_columns),rows=row_lists(rows),declaredKeyPassed=TRUE,observationalTruthCertified=FALSE))\n",
        "codeFile": "data06-snippets/r/keys-composite.R",
        "codeSha256": "b1f8cd9a434cdd33b8ed24cf9afb7576213fece26573c47883129e13ac737cde",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "CREATE TABLE records(iso TEXT NOT NULL,year INTEGER NOT NULL,PRIMARY KEY(iso,year));",
        "sqlFile": "data06-snippets/sql/keys-composite.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": false,
        "baseRCounterpart": true,
        "scenario": "composite",
        "keyColumns": [
          "iso",
          "year"
        ],
        "summary": {
          "keyColumns": [
            "iso",
            "year"
          ],
          "rows": [
            [
              "A",
              2023
            ],
            [
              "A",
              2024
            ]
          ],
          "declaredKeyPassed": true,
          "observationalTruthCertified": false
        }
      }
    }
  },
  "join": {
    "python": {
      "one-to-one-inner": {
        "returnCode": 0,
        "stdout": "{\"leftRows\": 3, \"rightRows\": 2, \"resultRows\": 2, \"unmatchedLeftOutputRows\": 0, \"columns\": [\"leftSource\", \"key\", \"rightSource\", \"value\"], \"rows\": [[1, \"A\", 1, 10.0], [2, \"B\", 2, 20.0]]}\n",
        "stderr": "",
        "language": "python",
        "id": "one-to-one-inner",
        "code": "import sys\nsys.stdout.reconfigure(encoding=\"utf-8\")\nsys.stderr.reconfigure(encoding=\"utf-8\")\nimport json,sqlite3\ndb=sqlite3.connect(\":memory:\")\ndb.executescript(\"CREATE TABLE left_records(lrow INTEGER,k TEXT);CREATE TABLE right_records(rrow INTEGER,k TEXT,value REAL);\")\nleft=[[1, 'A'], [2, 'B'], [3, 'C']]\nright=[[1, 'A', 10], [2, 'B', 20]]\ndb.executemany(\"INSERT INTO left_records VALUES(?,?)\",left)\ndb.executemany(\"INSERT INTO right_records VALUES(?,?,?)\",right)\nrows=[list(r) for r in db.execute('SELECT l.lrow,l.k,r.rrow,r.value FROM left_records l INNER JOIN right_records r ON l.k=r.k ORDER BY l.lrow,r.rrow;')]\nprint(json.dumps(dict(leftRows=len(left),rightRows=len(right),resultRows=len(rows),unmatchedLeftOutputRows=sum(r[2] is None for r in rows),columns=[\"leftSource\",\"key\",\"rightSource\",\"value\"],rows=rows)))\ndb.close()\n",
        "codeFile": "data06-snippets/python/join-one-to-one-inner.py",
        "codeSha256": "b53935bf771f0d04451c7ea867ef17883fbee16eba8ac980ff70e6062e0c2060",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "SELECT l.lrow,l.k,r.rrow,r.value FROM left_records l INNER JOIN right_records r ON l.k=r.k ORDER BY l.lrow,r.rrow;",
        "sqlFile": "data06-snippets/sql/join-one-to-one-inner.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": true,
        "baseRCounterpart": false,
        "relation": "one-to-one",
        "joinKind": "inner",
        "summary": {
          "leftRows": 3,
          "rightRows": 2,
          "resultRows": 2,
          "unmatchedLeftOutputRows": 0,
          "columns": [
            "leftSource",
            "key",
            "rightSource",
            "value"
          ],
          "rows": [
            [
              1,
              "A",
              1,
              10.0
            ],
            [
              2,
              "B",
              2,
              20.0
            ]
          ]
        }
      },
      "one-to-one-left": {
        "returnCode": 0,
        "stdout": "{\"leftRows\": 3, \"rightRows\": 2, \"resultRows\": 3, \"unmatchedLeftOutputRows\": 1, \"columns\": [\"leftSource\", \"key\", \"rightSource\", \"value\"], \"rows\": [[1, \"A\", 1, 10.0], [2, \"B\", 2, 20.0], [3, \"C\", null, null]]}\n",
        "stderr": "",
        "language": "python",
        "id": "one-to-one-left",
        "code": "import sys\nsys.stdout.reconfigure(encoding=\"utf-8\")\nsys.stderr.reconfigure(encoding=\"utf-8\")\nimport json,sqlite3\ndb=sqlite3.connect(\":memory:\")\ndb.executescript(\"CREATE TABLE left_records(lrow INTEGER,k TEXT);CREATE TABLE right_records(rrow INTEGER,k TEXT,value REAL);\")\nleft=[[1, 'A'], [2, 'B'], [3, 'C']]\nright=[[1, 'A', 10], [2, 'B', 20]]\ndb.executemany(\"INSERT INTO left_records VALUES(?,?)\",left)\ndb.executemany(\"INSERT INTO right_records VALUES(?,?,?)\",right)\nrows=[list(r) for r in db.execute('SELECT l.lrow,l.k,r.rrow,r.value FROM left_records l LEFT JOIN right_records r ON l.k=r.k ORDER BY l.lrow,r.rrow;')]\nprint(json.dumps(dict(leftRows=len(left),rightRows=len(right),resultRows=len(rows),unmatchedLeftOutputRows=sum(r[2] is None for r in rows),columns=[\"leftSource\",\"key\",\"rightSource\",\"value\"],rows=rows)))\ndb.close()\n",
        "codeFile": "data06-snippets/python/join-one-to-one-left.py",
        "codeSha256": "e78972a1e9a3c44d196f6bf8eb2dfdcac37536c068209f0d0e2fc02f04d6e5c5",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "SELECT l.lrow,l.k,r.rrow,r.value FROM left_records l LEFT JOIN right_records r ON l.k=r.k ORDER BY l.lrow,r.rrow;",
        "sqlFile": "data06-snippets/sql/join-one-to-one-left.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": true,
        "baseRCounterpart": false,
        "relation": "one-to-one",
        "joinKind": "left",
        "summary": {
          "leftRows": 3,
          "rightRows": 2,
          "resultRows": 3,
          "unmatchedLeftOutputRows": 1,
          "columns": [
            "leftSource",
            "key",
            "rightSource",
            "value"
          ],
          "rows": [
            [
              1,
              "A",
              1,
              10.0
            ],
            [
              2,
              "B",
              2,
              20.0
            ],
            [
              3,
              "C",
              null,
              null
            ]
          ]
        }
      },
      "one-to-many-inner": {
        "returnCode": 0,
        "stdout": "{\"leftRows\": 3, \"rightRows\": 3, \"resultRows\": 3, \"unmatchedLeftOutputRows\": 0, \"columns\": [\"leftSource\", \"key\", \"rightSource\", \"value\"], \"rows\": [[1, \"A\", 1, 10.0], [1, \"A\", 2, 30.0], [2, \"B\", 3, 20.0]]}\n",
        "stderr": "",
        "language": "python",
        "id": "one-to-many-inner",
        "code": "import sys\nsys.stdout.reconfigure(encoding=\"utf-8\")\nsys.stderr.reconfigure(encoding=\"utf-8\")\nimport json,sqlite3\ndb=sqlite3.connect(\":memory:\")\ndb.executescript(\"CREATE TABLE left_records(lrow INTEGER,k TEXT);CREATE TABLE right_records(rrow INTEGER,k TEXT,value REAL);\")\nleft=[[1, 'A'], [2, 'B'], [3, 'C']]\nright=[[1, 'A', 10], [2, 'A', 30], [3, 'B', 20]]\ndb.executemany(\"INSERT INTO left_records VALUES(?,?)\",left)\ndb.executemany(\"INSERT INTO right_records VALUES(?,?,?)\",right)\nrows=[list(r) for r in db.execute('SELECT l.lrow,l.k,r.rrow,r.value FROM left_records l INNER JOIN right_records r ON l.k=r.k ORDER BY l.lrow,r.rrow;')]\nprint(json.dumps(dict(leftRows=len(left),rightRows=len(right),resultRows=len(rows),unmatchedLeftOutputRows=sum(r[2] is None for r in rows),columns=[\"leftSource\",\"key\",\"rightSource\",\"value\"],rows=rows)))\ndb.close()\n",
        "codeFile": "data06-snippets/python/join-one-to-many-inner.py",
        "codeSha256": "8bdbd6b008fd17bea96e7650b7bc25ab56ddb2609fb209ba024479d2fb209950",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "SELECT l.lrow,l.k,r.rrow,r.value FROM left_records l INNER JOIN right_records r ON l.k=r.k ORDER BY l.lrow,r.rrow;",
        "sqlFile": "data06-snippets/sql/join-one-to-many-inner.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": true,
        "baseRCounterpart": false,
        "relation": "one-to-many",
        "joinKind": "inner",
        "summary": {
          "leftRows": 3,
          "rightRows": 3,
          "resultRows": 3,
          "unmatchedLeftOutputRows": 0,
          "columns": [
            "leftSource",
            "key",
            "rightSource",
            "value"
          ],
          "rows": [
            [
              1,
              "A",
              1,
              10.0
            ],
            [
              1,
              "A",
              2,
              30.0
            ],
            [
              2,
              "B",
              3,
              20.0
            ]
          ]
        }
      },
      "one-to-many-left": {
        "returnCode": 0,
        "stdout": "{\"leftRows\": 3, \"rightRows\": 3, \"resultRows\": 4, \"unmatchedLeftOutputRows\": 1, \"columns\": [\"leftSource\", \"key\", \"rightSource\", \"value\"], \"rows\": [[1, \"A\", 1, 10.0], [1, \"A\", 2, 30.0], [2, \"B\", 3, 20.0], [3, \"C\", null, null]]}\n",
        "stderr": "",
        "language": "python",
        "id": "one-to-many-left",
        "code": "import sys\nsys.stdout.reconfigure(encoding=\"utf-8\")\nsys.stderr.reconfigure(encoding=\"utf-8\")\nimport json,sqlite3\ndb=sqlite3.connect(\":memory:\")\ndb.executescript(\"CREATE TABLE left_records(lrow INTEGER,k TEXT);CREATE TABLE right_records(rrow INTEGER,k TEXT,value REAL);\")\nleft=[[1, 'A'], [2, 'B'], [3, 'C']]\nright=[[1, 'A', 10], [2, 'A', 30], [3, 'B', 20]]\ndb.executemany(\"INSERT INTO left_records VALUES(?,?)\",left)\ndb.executemany(\"INSERT INTO right_records VALUES(?,?,?)\",right)\nrows=[list(r) for r in db.execute('SELECT l.lrow,l.k,r.rrow,r.value FROM left_records l LEFT JOIN right_records r ON l.k=r.k ORDER BY l.lrow,r.rrow;')]\nprint(json.dumps(dict(leftRows=len(left),rightRows=len(right),resultRows=len(rows),unmatchedLeftOutputRows=sum(r[2] is None for r in rows),columns=[\"leftSource\",\"key\",\"rightSource\",\"value\"],rows=rows)))\ndb.close()\n",
        "codeFile": "data06-snippets/python/join-one-to-many-left.py",
        "codeSha256": "2a614cce77e089d13f86d782dbcf7bba8a59025661aeb94c1d248aeb544913b1",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "SELECT l.lrow,l.k,r.rrow,r.value FROM left_records l LEFT JOIN right_records r ON l.k=r.k ORDER BY l.lrow,r.rrow;",
        "sqlFile": "data06-snippets/sql/join-one-to-many-left.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": true,
        "baseRCounterpart": false,
        "relation": "one-to-many",
        "joinKind": "left",
        "summary": {
          "leftRows": 3,
          "rightRows": 3,
          "resultRows": 4,
          "unmatchedLeftOutputRows": 1,
          "columns": [
            "leftSource",
            "key",
            "rightSource",
            "value"
          ],
          "rows": [
            [
              1,
              "A",
              1,
              10.0
            ],
            [
              1,
              "A",
              2,
              30.0
            ],
            [
              2,
              "B",
              3,
              20.0
            ],
            [
              3,
              "C",
              null,
              null
            ]
          ]
        }
      },
      "many-to-many-inner": {
        "returnCode": 0,
        "stdout": "{\"leftRows\": 4, \"rightRows\": 3, \"resultRows\": 5, \"unmatchedLeftOutputRows\": 0, \"columns\": [\"leftSource\", \"key\", \"rightSource\", \"value\"], \"rows\": [[1, \"A\", 1, 10.0], [1, \"A\", 2, 30.0], [2, \"A\", 1, 10.0], [2, \"A\", 2, 30.0], [3, \"B\", 3, 20.0]]}\n",
        "stderr": "",
        "language": "python",
        "id": "many-to-many-inner",
        "code": "import sys\nsys.stdout.reconfigure(encoding=\"utf-8\")\nsys.stderr.reconfigure(encoding=\"utf-8\")\nimport json,sqlite3\ndb=sqlite3.connect(\":memory:\")\ndb.executescript(\"CREATE TABLE left_records(lrow INTEGER,k TEXT);CREATE TABLE right_records(rrow INTEGER,k TEXT,value REAL);\")\nleft=[[1, 'A'], [2, 'A'], [3, 'B'], [4, 'C']]\nright=[[1, 'A', 10], [2, 'A', 30], [3, 'B', 20]]\ndb.executemany(\"INSERT INTO left_records VALUES(?,?)\",left)\ndb.executemany(\"INSERT INTO right_records VALUES(?,?,?)\",right)\nrows=[list(r) for r in db.execute('SELECT l.lrow,l.k,r.rrow,r.value FROM left_records l INNER JOIN right_records r ON l.k=r.k ORDER BY l.lrow,r.rrow;')]\nprint(json.dumps(dict(leftRows=len(left),rightRows=len(right),resultRows=len(rows),unmatchedLeftOutputRows=sum(r[2] is None for r in rows),columns=[\"leftSource\",\"key\",\"rightSource\",\"value\"],rows=rows)))\ndb.close()\n",
        "codeFile": "data06-snippets/python/join-many-to-many-inner.py",
        "codeSha256": "0a52b137e15c3b5dcf509ad0498b326d575b40682604cecba3d8776020f5d35d",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "SELECT l.lrow,l.k,r.rrow,r.value FROM left_records l INNER JOIN right_records r ON l.k=r.k ORDER BY l.lrow,r.rrow;",
        "sqlFile": "data06-snippets/sql/join-many-to-many-inner.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": true,
        "baseRCounterpart": false,
        "relation": "many-to-many",
        "joinKind": "inner",
        "summary": {
          "leftRows": 4,
          "rightRows": 3,
          "resultRows": 5,
          "unmatchedLeftOutputRows": 0,
          "columns": [
            "leftSource",
            "key",
            "rightSource",
            "value"
          ],
          "rows": [
            [
              1,
              "A",
              1,
              10.0
            ],
            [
              1,
              "A",
              2,
              30.0
            ],
            [
              2,
              "A",
              1,
              10.0
            ],
            [
              2,
              "A",
              2,
              30.0
            ],
            [
              3,
              "B",
              3,
              20.0
            ]
          ]
        }
      },
      "many-to-many-left": {
        "returnCode": 0,
        "stdout": "{\"leftRows\": 4, \"rightRows\": 3, \"resultRows\": 6, \"unmatchedLeftOutputRows\": 1, \"columns\": [\"leftSource\", \"key\", \"rightSource\", \"value\"], \"rows\": [[1, \"A\", 1, 10.0], [1, \"A\", 2, 30.0], [2, \"A\", 1, 10.0], [2, \"A\", 2, 30.0], [3, \"B\", 3, 20.0], [4, \"C\", null, null]]}\n",
        "stderr": "",
        "language": "python",
        "id": "many-to-many-left",
        "code": "import sys\nsys.stdout.reconfigure(encoding=\"utf-8\")\nsys.stderr.reconfigure(encoding=\"utf-8\")\nimport json,sqlite3\ndb=sqlite3.connect(\":memory:\")\ndb.executescript(\"CREATE TABLE left_records(lrow INTEGER,k TEXT);CREATE TABLE right_records(rrow INTEGER,k TEXT,value REAL);\")\nleft=[[1, 'A'], [2, 'A'], [3, 'B'], [4, 'C']]\nright=[[1, 'A', 10], [2, 'A', 30], [3, 'B', 20]]\ndb.executemany(\"INSERT INTO left_records VALUES(?,?)\",left)\ndb.executemany(\"INSERT INTO right_records VALUES(?,?,?)\",right)\nrows=[list(r) for r in db.execute('SELECT l.lrow,l.k,r.rrow,r.value FROM left_records l LEFT JOIN right_records r ON l.k=r.k ORDER BY l.lrow,r.rrow;')]\nprint(json.dumps(dict(leftRows=len(left),rightRows=len(right),resultRows=len(rows),unmatchedLeftOutputRows=sum(r[2] is None for r in rows),columns=[\"leftSource\",\"key\",\"rightSource\",\"value\"],rows=rows)))\ndb.close()\n",
        "codeFile": "data06-snippets/python/join-many-to-many-left.py",
        "codeSha256": "63f91b32daa16b05e3bf6b68c7489ee49cbfea453346c4daaeecf7d5db61931b",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "SELECT l.lrow,l.k,r.rrow,r.value FROM left_records l LEFT JOIN right_records r ON l.k=r.k ORDER BY l.lrow,r.rrow;",
        "sqlFile": "data06-snippets/sql/join-many-to-many-left.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": true,
        "baseRCounterpart": false,
        "relation": "many-to-many",
        "joinKind": "left",
        "summary": {
          "leftRows": 4,
          "rightRows": 3,
          "resultRows": 6,
          "unmatchedLeftOutputRows": 1,
          "columns": [
            "leftSource",
            "key",
            "rightSource",
            "value"
          ],
          "rows": [
            [
              1,
              "A",
              1,
              10.0
            ],
            [
              1,
              "A",
              2,
              30.0
            ],
            [
              2,
              "A",
              1,
              10.0
            ],
            [
              2,
              "A",
              2,
              30.0
            ],
            [
              3,
              "B",
              3,
              20.0
            ],
            [
              4,
              "C",
              null,
              null
            ]
          ]
        }
      }
    },
    "r": {
      "one-to-one-inner": {
        "returnCode": 0,
        "stdout": "{\"leftRows\":3,\"rightRows\":2,\"resultRows\":2,\"unmatchedLeftOutputRows\":0,\"columns\":[\"leftSource\",\"key\",\"rightSource\",\"value\"],\"rows\":[[1,\"A\",1,10],[2,\"B\",2,20]]}\n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "language": "r",
        "id": "one-to-one-inner",
        "code": "if (.Platform$OS.type == \"windows\") invisible(Sys.setlocale(\"LC_CTYPE\", \"English_United States.utf8\"))\nto_json <- function(x) {\n  if (is.null(x)) return(\"null\")\n  if (is.list(x)) {\n    parts <- vapply(x,to_json,character(1))\n    if (is.null(names(x))) return(paste0(\"[\",paste(parts,collapse=\",\"),\"]\"))\n    keys <- vapply(names(x),function(s) encodeString(s,quote='\"'),character(1))\n    return(paste0(\"{\",paste(paste0(keys,\":\",parts),collapse=\",\"),\"}\"))\n  }\n  if (length(x)!=1L) return(to_json(as.list(x)))\n  if (is.na(x)) return(\"null\")\n  if (is.character(x)) return(encodeString(x,quote='\"'))\n  if (is.logical(x)) return(tolower(as.character(x)))\n  if (!is.finite(x)) stop(\"finite numerical display required\")\n  format(x,digits=17,scientific=FALSE,trim=TRUE)\n}\nemit <- function(x) cat(to_json(x),\"\\n\",sep=\"\")\nrow_lists <- function(d) lapply(seq_len(nrow(d)),function(i) unname(as.list(d[i,,drop=FALSE])))\nleft <- data.frame(lrow=seq_len(3),k=c(\"A\",\"B\",\"C\"))\nright <- data.frame(rrow=seq_len(2),k=c(\"A\",\"B\"),value=c(10,20))\nout <- merge(left,right,by=\"k\",all.x=FALSE,sort=FALSE)\nout <- out[order(out$lrow,out$rrow,na.last=TRUE),c(\"lrow\",\"k\",\"rrow\",\"value\"),drop=FALSE]\nemit(list(leftRows=nrow(left),rightRows=nrow(right),resultRows=nrow(out),unmatchedLeftOutputRows=sum(is.na(out$rrow)),columns=as.list(c(\"leftSource\",\"key\",\"rightSource\",\"value\")),rows=row_lists(out)))\n",
        "codeFile": "data06-snippets/r/join-one-to-one-inner.R",
        "codeSha256": "abdd42264d49113c683dde6423cb81ec217196200e26711c856c9af99d30a740",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "SELECT l.lrow,l.k,r.rrow,r.value FROM left_records l INNER JOIN right_records r ON l.k=r.k ORDER BY l.lrow,r.rrow;",
        "sqlFile": "data06-snippets/sql/join-one-to-one-inner.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": false,
        "baseRCounterpart": true,
        "relation": "one-to-one",
        "joinKind": "inner",
        "summary": {
          "leftRows": 3,
          "rightRows": 2,
          "resultRows": 2,
          "unmatchedLeftOutputRows": 0,
          "columns": [
            "leftSource",
            "key",
            "rightSource",
            "value"
          ],
          "rows": [
            [
              1,
              "A",
              1,
              10
            ],
            [
              2,
              "B",
              2,
              20
            ]
          ]
        }
      },
      "one-to-one-left": {
        "returnCode": 0,
        "stdout": "{\"leftRows\":3,\"rightRows\":2,\"resultRows\":3,\"unmatchedLeftOutputRows\":1,\"columns\":[\"leftSource\",\"key\",\"rightSource\",\"value\"],\"rows\":[[1,\"A\",1,10],[2,\"B\",2,20],[3,\"C\",null,null]]}\n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "language": "r",
        "id": "one-to-one-left",
        "code": "if (.Platform$OS.type == \"windows\") invisible(Sys.setlocale(\"LC_CTYPE\", \"English_United States.utf8\"))\nto_json <- function(x) {\n  if (is.null(x)) return(\"null\")\n  if (is.list(x)) {\n    parts <- vapply(x,to_json,character(1))\n    if (is.null(names(x))) return(paste0(\"[\",paste(parts,collapse=\",\"),\"]\"))\n    keys <- vapply(names(x),function(s) encodeString(s,quote='\"'),character(1))\n    return(paste0(\"{\",paste(paste0(keys,\":\",parts),collapse=\",\"),\"}\"))\n  }\n  if (length(x)!=1L) return(to_json(as.list(x)))\n  if (is.na(x)) return(\"null\")\n  if (is.character(x)) return(encodeString(x,quote='\"'))\n  if (is.logical(x)) return(tolower(as.character(x)))\n  if (!is.finite(x)) stop(\"finite numerical display required\")\n  format(x,digits=17,scientific=FALSE,trim=TRUE)\n}\nemit <- function(x) cat(to_json(x),\"\\n\",sep=\"\")\nrow_lists <- function(d) lapply(seq_len(nrow(d)),function(i) unname(as.list(d[i,,drop=FALSE])))\nleft <- data.frame(lrow=seq_len(3),k=c(\"A\",\"B\",\"C\"))\nright <- data.frame(rrow=seq_len(2),k=c(\"A\",\"B\"),value=c(10,20))\nout <- merge(left,right,by=\"k\",all.x=TRUE,sort=FALSE)\nout <- out[order(out$lrow,out$rrow,na.last=TRUE),c(\"lrow\",\"k\",\"rrow\",\"value\"),drop=FALSE]\nemit(list(leftRows=nrow(left),rightRows=nrow(right),resultRows=nrow(out),unmatchedLeftOutputRows=sum(is.na(out$rrow)),columns=as.list(c(\"leftSource\",\"key\",\"rightSource\",\"value\")),rows=row_lists(out)))\n",
        "codeFile": "data06-snippets/r/join-one-to-one-left.R",
        "codeSha256": "130e5bf87b8c3a57672de44d53b71c105b21e2224fac0be1c5c89c4605aa81cd",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "SELECT l.lrow,l.k,r.rrow,r.value FROM left_records l LEFT JOIN right_records r ON l.k=r.k ORDER BY l.lrow,r.rrow;",
        "sqlFile": "data06-snippets/sql/join-one-to-one-left.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": false,
        "baseRCounterpart": true,
        "relation": "one-to-one",
        "joinKind": "left",
        "summary": {
          "leftRows": 3,
          "rightRows": 2,
          "resultRows": 3,
          "unmatchedLeftOutputRows": 1,
          "columns": [
            "leftSource",
            "key",
            "rightSource",
            "value"
          ],
          "rows": [
            [
              1,
              "A",
              1,
              10
            ],
            [
              2,
              "B",
              2,
              20
            ],
            [
              3,
              "C",
              null,
              null
            ]
          ]
        }
      },
      "one-to-many-inner": {
        "returnCode": 0,
        "stdout": "{\"leftRows\":3,\"rightRows\":3,\"resultRows\":3,\"unmatchedLeftOutputRows\":0,\"columns\":[\"leftSource\",\"key\",\"rightSource\",\"value\"],\"rows\":[[1,\"A\",1,10],[1,\"A\",2,30],[2,\"B\",3,20]]}\n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "language": "r",
        "id": "one-to-many-inner",
        "code": "if (.Platform$OS.type == \"windows\") invisible(Sys.setlocale(\"LC_CTYPE\", \"English_United States.utf8\"))\nto_json <- function(x) {\n  if (is.null(x)) return(\"null\")\n  if (is.list(x)) {\n    parts <- vapply(x,to_json,character(1))\n    if (is.null(names(x))) return(paste0(\"[\",paste(parts,collapse=\",\"),\"]\"))\n    keys <- vapply(names(x),function(s) encodeString(s,quote='\"'),character(1))\n    return(paste0(\"{\",paste(paste0(keys,\":\",parts),collapse=\",\"),\"}\"))\n  }\n  if (length(x)!=1L) return(to_json(as.list(x)))\n  if (is.na(x)) return(\"null\")\n  if (is.character(x)) return(encodeString(x,quote='\"'))\n  if (is.logical(x)) return(tolower(as.character(x)))\n  if (!is.finite(x)) stop(\"finite numerical display required\")\n  format(x,digits=17,scientific=FALSE,trim=TRUE)\n}\nemit <- function(x) cat(to_json(x),\"\\n\",sep=\"\")\nrow_lists <- function(d) lapply(seq_len(nrow(d)),function(i) unname(as.list(d[i,,drop=FALSE])))\nleft <- data.frame(lrow=seq_len(3),k=c(\"A\",\"B\",\"C\"))\nright <- data.frame(rrow=seq_len(3),k=c(\"A\",\"A\",\"B\"),value=c(10,30,20))\nout <- merge(left,right,by=\"k\",all.x=FALSE,sort=FALSE)\nout <- out[order(out$lrow,out$rrow,na.last=TRUE),c(\"lrow\",\"k\",\"rrow\",\"value\"),drop=FALSE]\nemit(list(leftRows=nrow(left),rightRows=nrow(right),resultRows=nrow(out),unmatchedLeftOutputRows=sum(is.na(out$rrow)),columns=as.list(c(\"leftSource\",\"key\",\"rightSource\",\"value\")),rows=row_lists(out)))\n",
        "codeFile": "data06-snippets/r/join-one-to-many-inner.R",
        "codeSha256": "0fd09a67b2dcf9afcf138a2ec575066d1997b0e3cbd73d9b3a1705afa91ee2df",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "SELECT l.lrow,l.k,r.rrow,r.value FROM left_records l INNER JOIN right_records r ON l.k=r.k ORDER BY l.lrow,r.rrow;",
        "sqlFile": "data06-snippets/sql/join-one-to-many-inner.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": false,
        "baseRCounterpart": true,
        "relation": "one-to-many",
        "joinKind": "inner",
        "summary": {
          "leftRows": 3,
          "rightRows": 3,
          "resultRows": 3,
          "unmatchedLeftOutputRows": 0,
          "columns": [
            "leftSource",
            "key",
            "rightSource",
            "value"
          ],
          "rows": [
            [
              1,
              "A",
              1,
              10
            ],
            [
              1,
              "A",
              2,
              30
            ],
            [
              2,
              "B",
              3,
              20
            ]
          ]
        }
      },
      "one-to-many-left": {
        "returnCode": 0,
        "stdout": "{\"leftRows\":3,\"rightRows\":3,\"resultRows\":4,\"unmatchedLeftOutputRows\":1,\"columns\":[\"leftSource\",\"key\",\"rightSource\",\"value\"],\"rows\":[[1,\"A\",1,10],[1,\"A\",2,30],[2,\"B\",3,20],[3,\"C\",null,null]]}\n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "language": "r",
        "id": "one-to-many-left",
        "code": "if (.Platform$OS.type == \"windows\") invisible(Sys.setlocale(\"LC_CTYPE\", \"English_United States.utf8\"))\nto_json <- function(x) {\n  if (is.null(x)) return(\"null\")\n  if (is.list(x)) {\n    parts <- vapply(x,to_json,character(1))\n    if (is.null(names(x))) return(paste0(\"[\",paste(parts,collapse=\",\"),\"]\"))\n    keys <- vapply(names(x),function(s) encodeString(s,quote='\"'),character(1))\n    return(paste0(\"{\",paste(paste0(keys,\":\",parts),collapse=\",\"),\"}\"))\n  }\n  if (length(x)!=1L) return(to_json(as.list(x)))\n  if (is.na(x)) return(\"null\")\n  if (is.character(x)) return(encodeString(x,quote='\"'))\n  if (is.logical(x)) return(tolower(as.character(x)))\n  if (!is.finite(x)) stop(\"finite numerical display required\")\n  format(x,digits=17,scientific=FALSE,trim=TRUE)\n}\nemit <- function(x) cat(to_json(x),\"\\n\",sep=\"\")\nrow_lists <- function(d) lapply(seq_len(nrow(d)),function(i) unname(as.list(d[i,,drop=FALSE])))\nleft <- data.frame(lrow=seq_len(3),k=c(\"A\",\"B\",\"C\"))\nright <- data.frame(rrow=seq_len(3),k=c(\"A\",\"A\",\"B\"),value=c(10,30,20))\nout <- merge(left,right,by=\"k\",all.x=TRUE,sort=FALSE)\nout <- out[order(out$lrow,out$rrow,na.last=TRUE),c(\"lrow\",\"k\",\"rrow\",\"value\"),drop=FALSE]\nemit(list(leftRows=nrow(left),rightRows=nrow(right),resultRows=nrow(out),unmatchedLeftOutputRows=sum(is.na(out$rrow)),columns=as.list(c(\"leftSource\",\"key\",\"rightSource\",\"value\")),rows=row_lists(out)))\n",
        "codeFile": "data06-snippets/r/join-one-to-many-left.R",
        "codeSha256": "77130496ad1589dc3429121bd732ee5ed98baf1bc088563cfb838f9dd672c120",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "SELECT l.lrow,l.k,r.rrow,r.value FROM left_records l LEFT JOIN right_records r ON l.k=r.k ORDER BY l.lrow,r.rrow;",
        "sqlFile": "data06-snippets/sql/join-one-to-many-left.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": false,
        "baseRCounterpart": true,
        "relation": "one-to-many",
        "joinKind": "left",
        "summary": {
          "leftRows": 3,
          "rightRows": 3,
          "resultRows": 4,
          "unmatchedLeftOutputRows": 1,
          "columns": [
            "leftSource",
            "key",
            "rightSource",
            "value"
          ],
          "rows": [
            [
              1,
              "A",
              1,
              10
            ],
            [
              1,
              "A",
              2,
              30
            ],
            [
              2,
              "B",
              3,
              20
            ],
            [
              3,
              "C",
              null,
              null
            ]
          ]
        }
      },
      "many-to-many-inner": {
        "returnCode": 0,
        "stdout": "{\"leftRows\":4,\"rightRows\":3,\"resultRows\":5,\"unmatchedLeftOutputRows\":0,\"columns\":[\"leftSource\",\"key\",\"rightSource\",\"value\"],\"rows\":[[1,\"A\",1,10],[1,\"A\",2,30],[2,\"A\",1,10],[2,\"A\",2,30],[3,\"B\",3,20]]}\n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "language": "r",
        "id": "many-to-many-inner",
        "code": "if (.Platform$OS.type == \"windows\") invisible(Sys.setlocale(\"LC_CTYPE\", \"English_United States.utf8\"))\nto_json <- function(x) {\n  if (is.null(x)) return(\"null\")\n  if (is.list(x)) {\n    parts <- vapply(x,to_json,character(1))\n    if (is.null(names(x))) return(paste0(\"[\",paste(parts,collapse=\",\"),\"]\"))\n    keys <- vapply(names(x),function(s) encodeString(s,quote='\"'),character(1))\n    return(paste0(\"{\",paste(paste0(keys,\":\",parts),collapse=\",\"),\"}\"))\n  }\n  if (length(x)!=1L) return(to_json(as.list(x)))\n  if (is.na(x)) return(\"null\")\n  if (is.character(x)) return(encodeString(x,quote='\"'))\n  if (is.logical(x)) return(tolower(as.character(x)))\n  if (!is.finite(x)) stop(\"finite numerical display required\")\n  format(x,digits=17,scientific=FALSE,trim=TRUE)\n}\nemit <- function(x) cat(to_json(x),\"\\n\",sep=\"\")\nrow_lists <- function(d) lapply(seq_len(nrow(d)),function(i) unname(as.list(d[i,,drop=FALSE])))\nleft <- data.frame(lrow=seq_len(4),k=c(\"A\",\"A\",\"B\",\"C\"))\nright <- data.frame(rrow=seq_len(3),k=c(\"A\",\"A\",\"B\"),value=c(10,30,20))\nout <- merge(left,right,by=\"k\",all.x=FALSE,sort=FALSE)\nout <- out[order(out$lrow,out$rrow,na.last=TRUE),c(\"lrow\",\"k\",\"rrow\",\"value\"),drop=FALSE]\nemit(list(leftRows=nrow(left),rightRows=nrow(right),resultRows=nrow(out),unmatchedLeftOutputRows=sum(is.na(out$rrow)),columns=as.list(c(\"leftSource\",\"key\",\"rightSource\",\"value\")),rows=row_lists(out)))\n",
        "codeFile": "data06-snippets/r/join-many-to-many-inner.R",
        "codeSha256": "eaa684be82aaebea30e0f9bf76ada84c72c941cef294ae9721200f481fe5d151",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "SELECT l.lrow,l.k,r.rrow,r.value FROM left_records l INNER JOIN right_records r ON l.k=r.k ORDER BY l.lrow,r.rrow;",
        "sqlFile": "data06-snippets/sql/join-many-to-many-inner.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": false,
        "baseRCounterpart": true,
        "relation": "many-to-many",
        "joinKind": "inner",
        "summary": {
          "leftRows": 4,
          "rightRows": 3,
          "resultRows": 5,
          "unmatchedLeftOutputRows": 0,
          "columns": [
            "leftSource",
            "key",
            "rightSource",
            "value"
          ],
          "rows": [
            [
              1,
              "A",
              1,
              10
            ],
            [
              1,
              "A",
              2,
              30
            ],
            [
              2,
              "A",
              1,
              10
            ],
            [
              2,
              "A",
              2,
              30
            ],
            [
              3,
              "B",
              3,
              20
            ]
          ]
        }
      },
      "many-to-many-left": {
        "returnCode": 0,
        "stdout": "{\"leftRows\":4,\"rightRows\":3,\"resultRows\":6,\"unmatchedLeftOutputRows\":1,\"columns\":[\"leftSource\",\"key\",\"rightSource\",\"value\"],\"rows\":[[1,\"A\",1,10],[1,\"A\",2,30],[2,\"A\",1,10],[2,\"A\",2,30],[3,\"B\",3,20],[4,\"C\",null,null]]}\n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "language": "r",
        "id": "many-to-many-left",
        "code": "if (.Platform$OS.type == \"windows\") invisible(Sys.setlocale(\"LC_CTYPE\", \"English_United States.utf8\"))\nto_json <- function(x) {\n  if (is.null(x)) return(\"null\")\n  if (is.list(x)) {\n    parts <- vapply(x,to_json,character(1))\n    if (is.null(names(x))) return(paste0(\"[\",paste(parts,collapse=\",\"),\"]\"))\n    keys <- vapply(names(x),function(s) encodeString(s,quote='\"'),character(1))\n    return(paste0(\"{\",paste(paste0(keys,\":\",parts),collapse=\",\"),\"}\"))\n  }\n  if (length(x)!=1L) return(to_json(as.list(x)))\n  if (is.na(x)) return(\"null\")\n  if (is.character(x)) return(encodeString(x,quote='\"'))\n  if (is.logical(x)) return(tolower(as.character(x)))\n  if (!is.finite(x)) stop(\"finite numerical display required\")\n  format(x,digits=17,scientific=FALSE,trim=TRUE)\n}\nemit <- function(x) cat(to_json(x),\"\\n\",sep=\"\")\nrow_lists <- function(d) lapply(seq_len(nrow(d)),function(i) unname(as.list(d[i,,drop=FALSE])))\nleft <- data.frame(lrow=seq_len(4),k=c(\"A\",\"A\",\"B\",\"C\"))\nright <- data.frame(rrow=seq_len(3),k=c(\"A\",\"A\",\"B\"),value=c(10,30,20))\nout <- merge(left,right,by=\"k\",all.x=TRUE,sort=FALSE)\nout <- out[order(out$lrow,out$rrow,na.last=TRUE),c(\"lrow\",\"k\",\"rrow\",\"value\"),drop=FALSE]\nemit(list(leftRows=nrow(left),rightRows=nrow(right),resultRows=nrow(out),unmatchedLeftOutputRows=sum(is.na(out$rrow)),columns=as.list(c(\"leftSource\",\"key\",\"rightSource\",\"value\")),rows=row_lists(out)))\n",
        "codeFile": "data06-snippets/r/join-many-to-many-left.R",
        "codeSha256": "1c5f2b71f597d018dccccde65a6fe891d70ef3519b4eba7eddf188e6f528f7e6",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "SELECT l.lrow,l.k,r.rrow,r.value FROM left_records l LEFT JOIN right_records r ON l.k=r.k ORDER BY l.lrow,r.rrow;",
        "sqlFile": "data06-snippets/sql/join-many-to-many-left.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": false,
        "baseRCounterpart": true,
        "relation": "many-to-many",
        "joinKind": "left",
        "summary": {
          "leftRows": 4,
          "rightRows": 3,
          "resultRows": 6,
          "unmatchedLeftOutputRows": 1,
          "columns": [
            "leftSource",
            "key",
            "rightSource",
            "value"
          ],
          "rows": [
            [
              1,
              "A",
              1,
              10
            ],
            [
              1,
              "A",
              2,
              30
            ],
            [
              2,
              "A",
              1,
              10
            ],
            [
              2,
              "A",
              2,
              30
            ],
            [
              3,
              "B",
              3,
              20
            ],
            [
              4,
              "C",
              null,
              null
            ]
          ]
        }
      }
    }
  },
  "nulls": {
    "python": {
      "on": {
        "returnCode": 0,
        "stdout": "{\"columns\": [\"leftSource\", \"leftKey\", \"rightKey\", \"value\", \"originalRightKeyExists\"], \"rows\": [[1, \"A\", \"A\", 10.0, true], [2, \"B\", null, null, true], [3, \"C\", null, null, false]], \"resultRows\": 3, \"matchedNullRows\": 0, \"nullExtendedRows\": 2, \"absentOriginalRightKeyRows\": 1, \"nullEqualsNullIsTrue\": false}\n",
        "stderr": "",
        "language": "python",
        "id": "on",
        "code": "import sys\nsys.stdout.reconfigure(encoding=\"utf-8\")\nsys.stderr.reconfigure(encoding=\"utf-8\")\nimport json,sqlite3\ndb=sqlite3.connect(\":memory:\")\ndb.executescript(\"CREATE TABLE left_records(lrow INTEGER,k TEXT);CREATE TABLE right_records(rkey TEXT,value REAL);\")\ndb.executemany(\"INSERT INTO left_records VALUES(?,?)\",[(1,\"A\"),(2,\"B\"),(3,\"C\")])\ndb.executemany(\"INSERT INTO right_records VALUES(?,?)\",[(\"A\",10),(\"B\",None)])\nrows=[list(r)+[r[1] in {\"A\",\"B\"}] for r in db.execute('SELECT l.lrow,l.k,r.rkey,r.value FROM left_records l LEFT JOIN right_records r ON l.k=r.rkey AND r.value>=5 ORDER BY l.lrow;')]\nprint(json.dumps(dict(columns=[\"leftSource\",\"leftKey\",\"rightKey\",\"value\",\"originalRightKeyExists\"],rows=rows,resultRows=len(rows),matchedNullRows=sum(r[2] is not None and r[3] is None for r in rows),nullExtendedRows=sum(r[2] is None for r in rows),absentOriginalRightKeyRows=sum(not r[4] for r in rows),nullEqualsNullIsTrue=False)))\ndb.close()\n",
        "codeFile": "data06-snippets/python/nulls-on.py",
        "codeSha256": "204846e6e205ba5e030f5ec212bc0528c7dbf550fee9860182cdfecb856f1227",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "SELECT l.lrow,l.k,r.rkey,r.value FROM left_records l LEFT JOIN right_records r ON l.k=r.rkey AND r.value>=5 ORDER BY l.lrow;",
        "sqlFile": "data06-snippets/sql/nulls-on.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": true,
        "baseRCounterpart": false,
        "mode": "on",
        "rScope": "Explicit base-R counterpart of the stated SQL predicate; R NA subsetting is handled explicitly, not presumed identical to SQL.",
        "summary": {
          "columns": [
            "leftSource",
            "leftKey",
            "rightKey",
            "value",
            "originalRightKeyExists"
          ],
          "rows": [
            [
              1,
              "A",
              "A",
              10.0,
              true
            ],
            [
              2,
              "B",
              null,
              null,
              true
            ],
            [
              3,
              "C",
              null,
              null,
              false
            ]
          ],
          "resultRows": 3,
          "matchedNullRows": 0,
          "nullExtendedRows": 2,
          "absentOriginalRightKeyRows": 1,
          "nullEqualsNullIsTrue": false
        }
      },
      "where": {
        "returnCode": 0,
        "stdout": "{\"columns\": [\"leftSource\", \"leftKey\", \"rightKey\", \"value\", \"originalRightKeyExists\"], \"rows\": [[1, \"A\", \"A\", 10.0, true]], \"resultRows\": 1, \"matchedNullRows\": 0, \"nullExtendedRows\": 0, \"absentOriginalRightKeyRows\": 0, \"nullEqualsNullIsTrue\": false}\n",
        "stderr": "",
        "language": "python",
        "id": "where",
        "code": "import sys\nsys.stdout.reconfigure(encoding=\"utf-8\")\nsys.stderr.reconfigure(encoding=\"utf-8\")\nimport json,sqlite3\ndb=sqlite3.connect(\":memory:\")\ndb.executescript(\"CREATE TABLE left_records(lrow INTEGER,k TEXT);CREATE TABLE right_records(rkey TEXT,value REAL);\")\ndb.executemany(\"INSERT INTO left_records VALUES(?,?)\",[(1,\"A\"),(2,\"B\"),(3,\"C\")])\ndb.executemany(\"INSERT INTO right_records VALUES(?,?)\",[(\"A\",10),(\"B\",None)])\nrows=[list(r)+[r[1] in {\"A\",\"B\"}] for r in db.execute('SELECT l.lrow,l.k,r.rkey,r.value FROM left_records l LEFT JOIN right_records r ON l.k=r.rkey WHERE r.value>=5 ORDER BY l.lrow;')]\nprint(json.dumps(dict(columns=[\"leftSource\",\"leftKey\",\"rightKey\",\"value\",\"originalRightKeyExists\"],rows=rows,resultRows=len(rows),matchedNullRows=sum(r[2] is not None and r[3] is None for r in rows),nullExtendedRows=sum(r[2] is None for r in rows),absentOriginalRightKeyRows=sum(not r[4] for r in rows),nullEqualsNullIsTrue=False)))\ndb.close()\n",
        "codeFile": "data06-snippets/python/nulls-where.py",
        "codeSha256": "72553bc859e11e46f440a474dfa81135f8be3549652ada1325afaaf8fcc4b528",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "SELECT l.lrow,l.k,r.rkey,r.value FROM left_records l LEFT JOIN right_records r ON l.k=r.rkey WHERE r.value>=5 ORDER BY l.lrow;",
        "sqlFile": "data06-snippets/sql/nulls-where.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": true,
        "baseRCounterpart": false,
        "mode": "where",
        "rScope": "Explicit base-R counterpart of the stated SQL predicate; R NA subsetting is handled explicitly, not presumed identical to SQL.",
        "summary": {
          "columns": [
            "leftSource",
            "leftKey",
            "rightKey",
            "value",
            "originalRightKeyExists"
          ],
          "rows": [
            [
              1,
              "A",
              "A",
              10.0,
              true
            ]
          ],
          "resultRows": 1,
          "matchedNullRows": 0,
          "nullExtendedRows": 0,
          "absentOriginalRightKeyRows": 0,
          "nullEqualsNullIsTrue": false
        }
      },
      "equal-null": {
        "returnCode": 0,
        "stdout": "{\"columns\": [\"leftSource\", \"leftKey\", \"rightKey\", \"value\", \"originalRightKeyExists\"], \"rows\": [], \"resultRows\": 0, \"matchedNullRows\": 0, \"nullExtendedRows\": 0, \"absentOriginalRightKeyRows\": 0, \"nullEqualsNullIsTrue\": false}\n",
        "stderr": "",
        "language": "python",
        "id": "equal-null",
        "code": "import sys\nsys.stdout.reconfigure(encoding=\"utf-8\")\nsys.stderr.reconfigure(encoding=\"utf-8\")\nimport json,sqlite3\ndb=sqlite3.connect(\":memory:\")\ndb.executescript(\"CREATE TABLE left_records(lrow INTEGER,k TEXT);CREATE TABLE right_records(rkey TEXT,value REAL);\")\ndb.executemany(\"INSERT INTO left_records VALUES(?,?)\",[(1,\"A\"),(2,\"B\"),(3,\"C\")])\ndb.executemany(\"INSERT INTO right_records VALUES(?,?)\",[(\"A\",10),(\"B\",None)])\nrows=[list(r)+[r[1] in {\"A\",\"B\"}] for r in db.execute('SELECT l.lrow,l.k,r.rkey,r.value FROM left_records l LEFT JOIN right_records r ON l.k=r.rkey WHERE r.value=NULL ORDER BY l.lrow;')]\nprint(json.dumps(dict(columns=[\"leftSource\",\"leftKey\",\"rightKey\",\"value\",\"originalRightKeyExists\"],rows=rows,resultRows=len(rows),matchedNullRows=sum(r[2] is not None and r[3] is None for r in rows),nullExtendedRows=sum(r[2] is None for r in rows),absentOriginalRightKeyRows=sum(not r[4] for r in rows),nullEqualsNullIsTrue=False)))\ndb.close()\n",
        "codeFile": "data06-snippets/python/nulls-equal-null.py",
        "codeSha256": "e1659d04fddf86c80871958c43a6389ebf38a58ecc8361911569e10fe8637bc5",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "SELECT l.lrow,l.k,r.rkey,r.value FROM left_records l LEFT JOIN right_records r ON l.k=r.rkey WHERE r.value=NULL ORDER BY l.lrow;",
        "sqlFile": "data06-snippets/sql/nulls-equal-null.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": true,
        "baseRCounterpart": false,
        "mode": "equal-null",
        "rScope": "Explicit base-R counterpart of the stated SQL predicate; R NA subsetting is handled explicitly, not presumed identical to SQL.",
        "summary": {
          "columns": [
            "leftSource",
            "leftKey",
            "rightKey",
            "value",
            "originalRightKeyExists"
          ],
          "rows": [],
          "resultRows": 0,
          "matchedNullRows": 0,
          "nullExtendedRows": 0,
          "absentOriginalRightKeyRows": 0,
          "nullEqualsNullIsTrue": false
        }
      },
      "is-null": {
        "returnCode": 0,
        "stdout": "{\"columns\": [\"leftSource\", \"leftKey\", \"rightKey\", \"value\", \"originalRightKeyExists\"], \"rows\": [[2, \"B\", \"B\", null, true], [3, \"C\", null, null, false]], \"resultRows\": 2, \"matchedNullRows\": 1, \"nullExtendedRows\": 1, \"absentOriginalRightKeyRows\": 1, \"nullEqualsNullIsTrue\": false}\n",
        "stderr": "",
        "language": "python",
        "id": "is-null",
        "code": "import sys\nsys.stdout.reconfigure(encoding=\"utf-8\")\nsys.stderr.reconfigure(encoding=\"utf-8\")\nimport json,sqlite3\ndb=sqlite3.connect(\":memory:\")\ndb.executescript(\"CREATE TABLE left_records(lrow INTEGER,k TEXT);CREATE TABLE right_records(rkey TEXT,value REAL);\")\ndb.executemany(\"INSERT INTO left_records VALUES(?,?)\",[(1,\"A\"),(2,\"B\"),(3,\"C\")])\ndb.executemany(\"INSERT INTO right_records VALUES(?,?)\",[(\"A\",10),(\"B\",None)])\nrows=[list(r)+[r[1] in {\"A\",\"B\"}] for r in db.execute('SELECT l.lrow,l.k,r.rkey,r.value FROM left_records l LEFT JOIN right_records r ON l.k=r.rkey WHERE r.value IS NULL ORDER BY l.lrow;')]\nprint(json.dumps(dict(columns=[\"leftSource\",\"leftKey\",\"rightKey\",\"value\",\"originalRightKeyExists\"],rows=rows,resultRows=len(rows),matchedNullRows=sum(r[2] is not None and r[3] is None for r in rows),nullExtendedRows=sum(r[2] is None for r in rows),absentOriginalRightKeyRows=sum(not r[4] for r in rows),nullEqualsNullIsTrue=False)))\ndb.close()\n",
        "codeFile": "data06-snippets/python/nulls-is-null.py",
        "codeSha256": "87c38c9b8edc479a466e090aca60a1894531b3631e9965647c9e8f607d841ecf",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "SELECT l.lrow,l.k,r.rkey,r.value FROM left_records l LEFT JOIN right_records r ON l.k=r.rkey WHERE r.value IS NULL ORDER BY l.lrow;",
        "sqlFile": "data06-snippets/sql/nulls-is-null.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": true,
        "baseRCounterpart": false,
        "mode": "is-null",
        "rScope": "Explicit base-R counterpart of the stated SQL predicate; R NA subsetting is handled explicitly, not presumed identical to SQL.",
        "summary": {
          "columns": [
            "leftSource",
            "leftKey",
            "rightKey",
            "value",
            "originalRightKeyExists"
          ],
          "rows": [
            [
              2,
              "B",
              "B",
              null,
              true
            ],
            [
              3,
              "C",
              null,
              null,
              false
            ]
          ],
          "resultRows": 2,
          "matchedNullRows": 1,
          "nullExtendedRows": 1,
          "absentOriginalRightKeyRows": 1,
          "nullEqualsNullIsTrue": false
        }
      }
    },
    "r": {
      "on": {
        "returnCode": 0,
        "stdout": "{\"columns\":[\"leftSource\",\"leftKey\",\"rightKey\",\"value\",\"originalRightKeyExists\"],\"rows\":[[1,\"A\",\"A\",10,true],[2,\"B\",null,null,true],[3,\"C\",null,null,false]],\"resultRows\":3,\"matchedNullRows\":0,\"nullExtendedRows\":2,\"absentOriginalRightKeyRows\":1,\"nullEqualsNullIsTrue\":false}\n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "language": "r",
        "id": "on",
        "code": "if (.Platform$OS.type == \"windows\") invisible(Sys.setlocale(\"LC_CTYPE\", \"English_United States.utf8\"))\nto_json <- function(x) {\n  if (is.null(x)) return(\"null\")\n  if (is.list(x)) {\n    parts <- vapply(x,to_json,character(1))\n    if (is.null(names(x))) return(paste0(\"[\",paste(parts,collapse=\",\"),\"]\"))\n    keys <- vapply(names(x),function(s) encodeString(s,quote='\"'),character(1))\n    return(paste0(\"{\",paste(paste0(keys,\":\",parts),collapse=\",\"),\"}\"))\n  }\n  if (length(x)!=1L) return(to_json(as.list(x)))\n  if (is.na(x)) return(\"null\")\n  if (is.character(x)) return(encodeString(x,quote='\"'))\n  if (is.logical(x)) return(tolower(as.character(x)))\n  if (!is.finite(x)) stop(\"finite numerical display required\")\n  format(x,digits=17,scientific=FALSE,trim=TRUE)\n}\nemit <- function(x) cat(to_json(x),\"\\n\",sep=\"\")\nrow_lists <- function(d) lapply(seq_len(nrow(d)),function(i) unname(as.list(d[i,,drop=FALSE])))\nleft <- data.frame(lrow=1:3,k=c(\"A\",\"B\",\"C\"))\nright <- data.frame(joinKey=c(\"A\",\"B\"),rkey=c(\"A\",\"B\"),value=c(10,NA_real_))\nright <- right[!is.na(right$value) & right$value>=5,,drop=FALSE]\nout <- merge(left,right,by.x=\"k\",by.y=\"joinKey\",all.x=TRUE,sort=FALSE)\nout <- out[order(out$lrow),c(\"lrow\",\"k\",\"rkey\",\"value\"),drop=FALSE]\nout$originalRightKeyExists <- out$k %in% c(\"A\",\"B\")\nemit(list(columns=as.list(c(\"leftSource\",\"leftKey\",\"rightKey\",\"value\",\"originalRightKeyExists\")),rows=row_lists(out),resultRows=nrow(out),matchedNullRows=sum(!is.na(out$rkey)&is.na(out$value)),nullExtendedRows=sum(is.na(out$rkey)),absentOriginalRightKeyRows=sum(!out$originalRightKeyExists),nullEqualsNullIsTrue=FALSE))\n",
        "codeFile": "data06-snippets/r/nulls-on.R",
        "codeSha256": "d61dc902ba555b41916e235e4361275ebd747998e40fae2344e5260d981c6fb2",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "SELECT l.lrow,l.k,r.rkey,r.value FROM left_records l LEFT JOIN right_records r ON l.k=r.rkey AND r.value>=5 ORDER BY l.lrow;",
        "sqlFile": "data06-snippets/sql/nulls-on.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": false,
        "baseRCounterpart": true,
        "mode": "on",
        "rScope": "Explicit base-R counterpart of the stated SQL predicate; R NA subsetting is handled explicitly, not presumed identical to SQL.",
        "summary": {
          "columns": [
            "leftSource",
            "leftKey",
            "rightKey",
            "value",
            "originalRightKeyExists"
          ],
          "rows": [
            [
              1,
              "A",
              "A",
              10,
              true
            ],
            [
              2,
              "B",
              null,
              null,
              true
            ],
            [
              3,
              "C",
              null,
              null,
              false
            ]
          ],
          "resultRows": 3,
          "matchedNullRows": 0,
          "nullExtendedRows": 2,
          "absentOriginalRightKeyRows": 1,
          "nullEqualsNullIsTrue": false
        }
      },
      "where": {
        "returnCode": 0,
        "stdout": "{\"columns\":[\"leftSource\",\"leftKey\",\"rightKey\",\"value\",\"originalRightKeyExists\"],\"rows\":[[1,\"A\",\"A\",10,true]],\"resultRows\":1,\"matchedNullRows\":0,\"nullExtendedRows\":0,\"absentOriginalRightKeyRows\":0,\"nullEqualsNullIsTrue\":false}\n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "language": "r",
        "id": "where",
        "code": "if (.Platform$OS.type == \"windows\") invisible(Sys.setlocale(\"LC_CTYPE\", \"English_United States.utf8\"))\nto_json <- function(x) {\n  if (is.null(x)) return(\"null\")\n  if (is.list(x)) {\n    parts <- vapply(x,to_json,character(1))\n    if (is.null(names(x))) return(paste0(\"[\",paste(parts,collapse=\",\"),\"]\"))\n    keys <- vapply(names(x),function(s) encodeString(s,quote='\"'),character(1))\n    return(paste0(\"{\",paste(paste0(keys,\":\",parts),collapse=\",\"),\"}\"))\n  }\n  if (length(x)!=1L) return(to_json(as.list(x)))\n  if (is.na(x)) return(\"null\")\n  if (is.character(x)) return(encodeString(x,quote='\"'))\n  if (is.logical(x)) return(tolower(as.character(x)))\n  if (!is.finite(x)) stop(\"finite numerical display required\")\n  format(x,digits=17,scientific=FALSE,trim=TRUE)\n}\nemit <- function(x) cat(to_json(x),\"\\n\",sep=\"\")\nrow_lists <- function(d) lapply(seq_len(nrow(d)),function(i) unname(as.list(d[i,,drop=FALSE])))\nleft <- data.frame(lrow=1:3,k=c(\"A\",\"B\",\"C\"))\nright <- data.frame(joinKey=c(\"A\",\"B\"),rkey=c(\"A\",\"B\"),value=c(10,NA_real_))\nout <- merge(left,right,by.x=\"k\",by.y=\"joinKey\",all.x=TRUE,sort=FALSE)\nout <- out[!is.na(out$value) & out$value>=5,,drop=FALSE]\nout <- out[order(out$lrow),c(\"lrow\",\"k\",\"rkey\",\"value\"),drop=FALSE]\nout$originalRightKeyExists <- out$k %in% c(\"A\",\"B\")\nemit(list(columns=as.list(c(\"leftSource\",\"leftKey\",\"rightKey\",\"value\",\"originalRightKeyExists\")),rows=row_lists(out),resultRows=nrow(out),matchedNullRows=sum(!is.na(out$rkey)&is.na(out$value)),nullExtendedRows=sum(is.na(out$rkey)),absentOriginalRightKeyRows=sum(!out$originalRightKeyExists),nullEqualsNullIsTrue=FALSE))\n",
        "codeFile": "data06-snippets/r/nulls-where.R",
        "codeSha256": "f3cc74900130d0f16554604a0ed2778bfcad5398a72f7e83fea4246d24fda0d4",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "SELECT l.lrow,l.k,r.rkey,r.value FROM left_records l LEFT JOIN right_records r ON l.k=r.rkey WHERE r.value>=5 ORDER BY l.lrow;",
        "sqlFile": "data06-snippets/sql/nulls-where.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": false,
        "baseRCounterpart": true,
        "mode": "where",
        "rScope": "Explicit base-R counterpart of the stated SQL predicate; R NA subsetting is handled explicitly, not presumed identical to SQL.",
        "summary": {
          "columns": [
            "leftSource",
            "leftKey",
            "rightKey",
            "value",
            "originalRightKeyExists"
          ],
          "rows": [
            [
              1,
              "A",
              "A",
              10,
              true
            ]
          ],
          "resultRows": 1,
          "matchedNullRows": 0,
          "nullExtendedRows": 0,
          "absentOriginalRightKeyRows": 0,
          "nullEqualsNullIsTrue": false
        }
      },
      "equal-null": {
        "returnCode": 0,
        "stdout": "{\"columns\":[\"leftSource\",\"leftKey\",\"rightKey\",\"value\",\"originalRightKeyExists\"],\"rows\":[],\"resultRows\":0,\"matchedNullRows\":0,\"nullExtendedRows\":0,\"absentOriginalRightKeyRows\":0,\"nullEqualsNullIsTrue\":false}\n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "language": "r",
        "id": "equal-null",
        "code": "if (.Platform$OS.type == \"windows\") invisible(Sys.setlocale(\"LC_CTYPE\", \"English_United States.utf8\"))\nto_json <- function(x) {\n  if (is.null(x)) return(\"null\")\n  if (is.list(x)) {\n    parts <- vapply(x,to_json,character(1))\n    if (is.null(names(x))) return(paste0(\"[\",paste(parts,collapse=\",\"),\"]\"))\n    keys <- vapply(names(x),function(s) encodeString(s,quote='\"'),character(1))\n    return(paste0(\"{\",paste(paste0(keys,\":\",parts),collapse=\",\"),\"}\"))\n  }\n  if (length(x)!=1L) return(to_json(as.list(x)))\n  if (is.na(x)) return(\"null\")\n  if (is.character(x)) return(encodeString(x,quote='\"'))\n  if (is.logical(x)) return(tolower(as.character(x)))\n  if (!is.finite(x)) stop(\"finite numerical display required\")\n  format(x,digits=17,scientific=FALSE,trim=TRUE)\n}\nemit <- function(x) cat(to_json(x),\"\\n\",sep=\"\")\nrow_lists <- function(d) lapply(seq_len(nrow(d)),function(i) unname(as.list(d[i,,drop=FALSE])))\nleft <- data.frame(lrow=1:3,k=c(\"A\",\"B\",\"C\"))\nright <- data.frame(joinKey=c(\"A\",\"B\"),rkey=c(\"A\",\"B\"),value=c(10,NA_real_))\nout <- merge(left,right,by.x=\"k\",by.y=\"joinKey\",all.x=TRUE,sort=FALSE)\nout <- out[rep(FALSE,nrow(out)),,drop=FALSE] # SQL = NULL never yields TRUE\nout <- out[order(out$lrow),c(\"lrow\",\"k\",\"rkey\",\"value\"),drop=FALSE]\nout$originalRightKeyExists <- out$k %in% c(\"A\",\"B\")\nemit(list(columns=as.list(c(\"leftSource\",\"leftKey\",\"rightKey\",\"value\",\"originalRightKeyExists\")),rows=row_lists(out),resultRows=nrow(out),matchedNullRows=sum(!is.na(out$rkey)&is.na(out$value)),nullExtendedRows=sum(is.na(out$rkey)),absentOriginalRightKeyRows=sum(!out$originalRightKeyExists),nullEqualsNullIsTrue=FALSE))\n",
        "codeFile": "data06-snippets/r/nulls-equal-null.R",
        "codeSha256": "7f33d767daee2fb30501faf0a332e06132eb824a051e66ed70217e8d62d8815c",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "SELECT l.lrow,l.k,r.rkey,r.value FROM left_records l LEFT JOIN right_records r ON l.k=r.rkey WHERE r.value=NULL ORDER BY l.lrow;",
        "sqlFile": "data06-snippets/sql/nulls-equal-null.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": false,
        "baseRCounterpart": true,
        "mode": "equal-null",
        "rScope": "Explicit base-R counterpart of the stated SQL predicate; R NA subsetting is handled explicitly, not presumed identical to SQL.",
        "summary": {
          "columns": [
            "leftSource",
            "leftKey",
            "rightKey",
            "value",
            "originalRightKeyExists"
          ],
          "rows": [],
          "resultRows": 0,
          "matchedNullRows": 0,
          "nullExtendedRows": 0,
          "absentOriginalRightKeyRows": 0,
          "nullEqualsNullIsTrue": false
        }
      },
      "is-null": {
        "returnCode": 0,
        "stdout": "{\"columns\":[\"leftSource\",\"leftKey\",\"rightKey\",\"value\",\"originalRightKeyExists\"],\"rows\":[[2,\"B\",\"B\",null,true],[3,\"C\",null,null,false]],\"resultRows\":2,\"matchedNullRows\":1,\"nullExtendedRows\":1,\"absentOriginalRightKeyRows\":1,\"nullEqualsNullIsTrue\":false}\n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "language": "r",
        "id": "is-null",
        "code": "if (.Platform$OS.type == \"windows\") invisible(Sys.setlocale(\"LC_CTYPE\", \"English_United States.utf8\"))\nto_json <- function(x) {\n  if (is.null(x)) return(\"null\")\n  if (is.list(x)) {\n    parts <- vapply(x,to_json,character(1))\n    if (is.null(names(x))) return(paste0(\"[\",paste(parts,collapse=\",\"),\"]\"))\n    keys <- vapply(names(x),function(s) encodeString(s,quote='\"'),character(1))\n    return(paste0(\"{\",paste(paste0(keys,\":\",parts),collapse=\",\"),\"}\"))\n  }\n  if (length(x)!=1L) return(to_json(as.list(x)))\n  if (is.na(x)) return(\"null\")\n  if (is.character(x)) return(encodeString(x,quote='\"'))\n  if (is.logical(x)) return(tolower(as.character(x)))\n  if (!is.finite(x)) stop(\"finite numerical display required\")\n  format(x,digits=17,scientific=FALSE,trim=TRUE)\n}\nemit <- function(x) cat(to_json(x),\"\\n\",sep=\"\")\nrow_lists <- function(d) lapply(seq_len(nrow(d)),function(i) unname(as.list(d[i,,drop=FALSE])))\nleft <- data.frame(lrow=1:3,k=c(\"A\",\"B\",\"C\"))\nright <- data.frame(joinKey=c(\"A\",\"B\"),rkey=c(\"A\",\"B\"),value=c(10,NA_real_))\nout <- merge(left,right,by.x=\"k\",by.y=\"joinKey\",all.x=TRUE,sort=FALSE)\nout <- out[is.na(out$value),,drop=FALSE]\nout <- out[order(out$lrow),c(\"lrow\",\"k\",\"rkey\",\"value\"),drop=FALSE]\nout$originalRightKeyExists <- out$k %in% c(\"A\",\"B\")\nemit(list(columns=as.list(c(\"leftSource\",\"leftKey\",\"rightKey\",\"value\",\"originalRightKeyExists\")),rows=row_lists(out),resultRows=nrow(out),matchedNullRows=sum(!is.na(out$rkey)&is.na(out$value)),nullExtendedRows=sum(is.na(out$rkey)),absentOriginalRightKeyRows=sum(!out$originalRightKeyExists),nullEqualsNullIsTrue=FALSE))\n",
        "codeFile": "data06-snippets/r/nulls-is-null.R",
        "codeSha256": "005c4547de43544c797a2ea1bf9a1272ad5ced248da7d65cc56f910db7cab81e",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "SELECT l.lrow,l.k,r.rkey,r.value FROM left_records l LEFT JOIN right_records r ON l.k=r.rkey WHERE r.value IS NULL ORDER BY l.lrow;",
        "sqlFile": "data06-snippets/sql/nulls-is-null.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": false,
        "baseRCounterpart": true,
        "mode": "is-null",
        "rScope": "Explicit base-R counterpart of the stated SQL predicate; R NA subsetting is handled explicitly, not presumed identical to SQL.",
        "summary": {
          "columns": [
            "leftSource",
            "leftKey",
            "rightKey",
            "value",
            "originalRightKeyExists"
          ],
          "rows": [
            [
              2,
              "B",
              "B",
              null,
              true
            ],
            [
              3,
              "C",
              null,
              null,
              false
            ]
          ],
          "resultRows": 2,
          "matchedNullRows": 1,
          "nullExtendedRows": 1,
          "absentOriginalRightKeyRows": 1,
          "nullEqualsNullIsTrue": false
        }
      }
    }
  },
  "aggregation": {
    "python": {
      "available": {
        "returnCode": 0,
        "stdout": "{\"columns\": [\"group\", \"allRows\", \"availableRows\", \"availableSum\", \"reportedMean\"], \"rows\": [[\"A\", 2, 2, 2.0, 1.0], [\"B\", 2, 1, 4.0, 4.0], [\"C\", 1, 0, null, null]], \"observedZeroRetained\": true, \"coalesceIsSourceRecovery\": false, \"zeroComparison\": false}\n",
        "stderr": "",
        "language": "python",
        "id": "available",
        "code": "import sys\nsys.stdout.reconfigure(encoding=\"utf-8\")\nsys.stderr.reconfigure(encoding=\"utf-8\")\nimport json,sqlite3\ndb=sqlite3.connect(\":memory:\")\ndb.execute(\"CREATE TABLE records(g TEXT,x REAL)\")\ndb.executemany(\"INSERT INTO records VALUES(?,?)\",[(\"A\",0),(\"A\",2),(\"B\",None),(\"B\",4),(\"C\",None)])\nrows=[list(r) for r in db.execute('SELECT g,COUNT(*) AS all_rows,COUNT(x) AS available_rows,SUM(x) AS available_sum,AVG(x) AS reported_mean FROM records GROUP BY g ORDER BY g;')]\nprint(json.dumps(dict(columns=[\"group\",\"allRows\",\"availableRows\",\"availableSum\",\"reportedMean\"],rows=rows,observedZeroRetained=True,coalesceIsSourceRecovery=False,zeroComparison=False)))\ndb.close()\n",
        "codeFile": "data06-snippets/python/aggregation-available.py",
        "codeSha256": "cbe0c9278e819f2e686458e2ee0f2954f24885a2f854c0744b41c217bfbf0bfa",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "SELECT g,COUNT(*) AS all_rows,COUNT(x) AS available_rows,SUM(x) AS available_sum,AVG(x) AS reported_mean FROM records GROUP BY g ORDER BY g;",
        "sqlFile": "data06-snippets/sql/aggregation-available.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": true,
        "baseRCounterpart": false,
        "mode": "available",
        "summary": {
          "columns": [
            "group",
            "allRows",
            "availableRows",
            "availableSum",
            "reportedMean"
          ],
          "rows": [
            [
              "A",
              2,
              2,
              2.0,
              1.0
            ],
            [
              "B",
              2,
              1,
              4.0,
              4.0
            ],
            [
              "C",
              1,
              0,
              null,
              null
            ]
          ],
          "observedZeroRetained": true,
          "coalesceIsSourceRecovery": false,
          "zeroComparison": false
        }
      },
      "zero-comparison": {
        "returnCode": 0,
        "stdout": "{\"columns\": [\"group\", \"allRows\", \"availableRows\", \"availableSum\", \"reportedMean\"], \"rows\": [[\"A\", 2, 2, 2.0, 1.0], [\"B\", 2, 1, 4.0, 2.0], [\"C\", 1, 0, null, 0.0]], \"observedZeroRetained\": true, \"coalesceIsSourceRecovery\": false, \"zeroComparison\": true}\n",
        "stderr": "",
        "language": "python",
        "id": "zero-comparison",
        "code": "import sys\nsys.stdout.reconfigure(encoding=\"utf-8\")\nsys.stderr.reconfigure(encoding=\"utf-8\")\nimport json,sqlite3\ndb=sqlite3.connect(\":memory:\")\ndb.execute(\"CREATE TABLE records(g TEXT,x REAL)\")\ndb.executemany(\"INSERT INTO records VALUES(?,?)\",[(\"A\",0),(\"A\",2),(\"B\",None),(\"B\",4),(\"C\",None)])\nrows=[list(r) for r in db.execute('SELECT g,COUNT(*) AS all_rows,COUNT(x) AS available_rows,SUM(x) AS available_sum,AVG(COALESCE(x,0)) AS reported_mean FROM records GROUP BY g ORDER BY g;')]\nprint(json.dumps(dict(columns=[\"group\",\"allRows\",\"availableRows\",\"availableSum\",\"reportedMean\"],rows=rows,observedZeroRetained=True,coalesceIsSourceRecovery=False,zeroComparison=True)))\ndb.close()\n",
        "codeFile": "data06-snippets/python/aggregation-zero-comparison.py",
        "codeSha256": "4b1f9fa47ee6c364afae100fd549a4763ddceffc50e1a735dc1d612dff2c5719",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "SELECT g,COUNT(*) AS all_rows,COUNT(x) AS available_rows,SUM(x) AS available_sum,AVG(COALESCE(x,0)) AS reported_mean FROM records GROUP BY g ORDER BY g;",
        "sqlFile": "data06-snippets/sql/aggregation-zero-comparison.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": true,
        "baseRCounterpart": false,
        "mode": "zero-comparison",
        "summary": {
          "columns": [
            "group",
            "allRows",
            "availableRows",
            "availableSum",
            "reportedMean"
          ],
          "rows": [
            [
              "A",
              2,
              2,
              2.0,
              1.0
            ],
            [
              "B",
              2,
              1,
              4.0,
              2.0
            ],
            [
              "C",
              1,
              0,
              null,
              0.0
            ]
          ],
          "observedZeroRetained": true,
          "coalesceIsSourceRecovery": false,
          "zeroComparison": true
        }
      },
      "having": {
        "returnCode": 0,
        "stdout": "{\"columns\": [\"group\", \"allRows\", \"availableRows\", \"availableSum\", \"reportedMean\"], \"rows\": [[\"A\", 2, 2, 2.0, 1.0]], \"observedZeroRetained\": true, \"coalesceIsSourceRecovery\": false, \"zeroComparison\": false}\n",
        "stderr": "",
        "language": "python",
        "id": "having",
        "code": "import sys\nsys.stdout.reconfigure(encoding=\"utf-8\")\nsys.stderr.reconfigure(encoding=\"utf-8\")\nimport json,sqlite3\ndb=sqlite3.connect(\":memory:\")\ndb.execute(\"CREATE TABLE records(g TEXT,x REAL)\")\ndb.executemany(\"INSERT INTO records VALUES(?,?)\",[(\"A\",0),(\"A\",2),(\"B\",None),(\"B\",4),(\"C\",None)])\nrows=[list(r) for r in db.execute('SELECT g,COUNT(*) AS all_rows,COUNT(x) AS available_rows,SUM(x) AS available_sum,AVG(x) AS reported_mean FROM records GROUP BY g HAVING COUNT(x)>=2 ORDER BY g;')]\nprint(json.dumps(dict(columns=[\"group\",\"allRows\",\"availableRows\",\"availableSum\",\"reportedMean\"],rows=rows,observedZeroRetained=True,coalesceIsSourceRecovery=False,zeroComparison=False)))\ndb.close()\n",
        "codeFile": "data06-snippets/python/aggregation-having.py",
        "codeSha256": "db592f8ad931dbfb07d77f0b42f4b1ead5ae72b48e9856dfc4b2d0918bbd02f7",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "SELECT g,COUNT(*) AS all_rows,COUNT(x) AS available_rows,SUM(x) AS available_sum,AVG(x) AS reported_mean FROM records GROUP BY g HAVING COUNT(x)>=2 ORDER BY g;",
        "sqlFile": "data06-snippets/sql/aggregation-having.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": true,
        "baseRCounterpart": false,
        "mode": "having",
        "summary": {
          "columns": [
            "group",
            "allRows",
            "availableRows",
            "availableSum",
            "reportedMean"
          ],
          "rows": [
            [
              "A",
              2,
              2,
              2.0,
              1.0
            ]
          ],
          "observedZeroRetained": true,
          "coalesceIsSourceRecovery": false,
          "zeroComparison": false
        }
      }
    },
    "r": {
      "available": {
        "returnCode": 0,
        "stdout": "{\"columns\":[\"group\",\"allRows\",\"availableRows\",\"availableSum\",\"reportedMean\"],\"rows\":[[\"A\",2,2,2,1],[\"B\",2,1,4,4],[\"C\",1,0,null,null]],\"observedZeroRetained\":true,\"coalesceIsSourceRecovery\":false,\"zeroComparison\":false}\n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "language": "r",
        "id": "available",
        "code": "if (.Platform$OS.type == \"windows\") invisible(Sys.setlocale(\"LC_CTYPE\", \"English_United States.utf8\"))\nto_json <- function(x) {\n  if (is.null(x)) return(\"null\")\n  if (is.list(x)) {\n    parts <- vapply(x,to_json,character(1))\n    if (is.null(names(x))) return(paste0(\"[\",paste(parts,collapse=\",\"),\"]\"))\n    keys <- vapply(names(x),function(s) encodeString(s,quote='\"'),character(1))\n    return(paste0(\"{\",paste(paste0(keys,\":\",parts),collapse=\",\"),\"}\"))\n  }\n  if (length(x)!=1L) return(to_json(as.list(x)))\n  if (is.na(x)) return(\"null\")\n  if (is.character(x)) return(encodeString(x,quote='\"'))\n  if (is.logical(x)) return(tolower(as.character(x)))\n  if (!is.finite(x)) stop(\"finite numerical display required\")\n  format(x,digits=17,scientific=FALSE,trim=TRUE)\n}\nemit <- function(x) cat(to_json(x),\"\\n\",sep=\"\")\nrow_lists <- function(d) lapply(seq_len(nrow(d)),function(i) unname(as.list(d[i,,drop=FALSE])))\nrows <- data.frame(g=c(\"A\",\"A\",\"B\",\"B\",\"C\"),x=c(0,2,NA_real_,4,NA_real_))\nout <- lapply(sort(unique(rows$g)),function(g) {x <- rows$x[rows$g==g];v <- x[!is.na(x)];list(g,length(x),length(v),if(length(v)) sum(v) else NULL,if(length(v)) mean(v) else NULL)})\nemit(list(columns=as.list(c(\"group\",\"allRows\",\"availableRows\",\"availableSum\",\"reportedMean\")),rows=out,observedZeroRetained=TRUE,coalesceIsSourceRecovery=FALSE,zeroComparison=FALSE))\n",
        "codeFile": "data06-snippets/r/aggregation-available.R",
        "codeSha256": "33565789b25f8c65b6949b294336e4c0c9d6f3ea5762d1a2ac3cf55ab0ab298f",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "SELECT g,COUNT(*) AS all_rows,COUNT(x) AS available_rows,SUM(x) AS available_sum,AVG(x) AS reported_mean FROM records GROUP BY g ORDER BY g;",
        "sqlFile": "data06-snippets/sql/aggregation-available.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": false,
        "baseRCounterpart": true,
        "mode": "available",
        "summary": {
          "columns": [
            "group",
            "allRows",
            "availableRows",
            "availableSum",
            "reportedMean"
          ],
          "rows": [
            [
              "A",
              2,
              2,
              2,
              1
            ],
            [
              "B",
              2,
              1,
              4,
              4
            ],
            [
              "C",
              1,
              0,
              null,
              null
            ]
          ],
          "observedZeroRetained": true,
          "coalesceIsSourceRecovery": false,
          "zeroComparison": false
        }
      },
      "zero-comparison": {
        "returnCode": 0,
        "stdout": "{\"columns\":[\"group\",\"allRows\",\"availableRows\",\"availableSum\",\"reportedMean\"],\"rows\":[[\"A\",2,2,2,1],[\"B\",2,1,4,2],[\"C\",1,0,null,0]],\"observedZeroRetained\":true,\"coalesceIsSourceRecovery\":false,\"zeroComparison\":true}\n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "language": "r",
        "id": "zero-comparison",
        "code": "if (.Platform$OS.type == \"windows\") invisible(Sys.setlocale(\"LC_CTYPE\", \"English_United States.utf8\"))\nto_json <- function(x) {\n  if (is.null(x)) return(\"null\")\n  if (is.list(x)) {\n    parts <- vapply(x,to_json,character(1))\n    if (is.null(names(x))) return(paste0(\"[\",paste(parts,collapse=\",\"),\"]\"))\n    keys <- vapply(names(x),function(s) encodeString(s,quote='\"'),character(1))\n    return(paste0(\"{\",paste(paste0(keys,\":\",parts),collapse=\",\"),\"}\"))\n  }\n  if (length(x)!=1L) return(to_json(as.list(x)))\n  if (is.na(x)) return(\"null\")\n  if (is.character(x)) return(encodeString(x,quote='\"'))\n  if (is.logical(x)) return(tolower(as.character(x)))\n  if (!is.finite(x)) stop(\"finite numerical display required\")\n  format(x,digits=17,scientific=FALSE,trim=TRUE)\n}\nemit <- function(x) cat(to_json(x),\"\\n\",sep=\"\")\nrow_lists <- function(d) lapply(seq_len(nrow(d)),function(i) unname(as.list(d[i,,drop=FALSE])))\nrows <- data.frame(g=c(\"A\",\"A\",\"B\",\"B\",\"C\"),x=c(0,2,NA_real_,4,NA_real_))\nout <- lapply(sort(unique(rows$g)),function(g) {x <- rows$x[rows$g==g];v <- x[!is.na(x)];list(g,length(x),length(v),if(length(v)) sum(v) else NULL,mean(replace(x,is.na(x),0)))})\nemit(list(columns=as.list(c(\"group\",\"allRows\",\"availableRows\",\"availableSum\",\"reportedMean\")),rows=out,observedZeroRetained=TRUE,coalesceIsSourceRecovery=FALSE,zeroComparison=TRUE))\n",
        "codeFile": "data06-snippets/r/aggregation-zero-comparison.R",
        "codeSha256": "ddf96108e3076caac6e09da6682c5f7cc52c091f56fa518ec81505283734b716",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "SELECT g,COUNT(*) AS all_rows,COUNT(x) AS available_rows,SUM(x) AS available_sum,AVG(COALESCE(x,0)) AS reported_mean FROM records GROUP BY g ORDER BY g;",
        "sqlFile": "data06-snippets/sql/aggregation-zero-comparison.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": false,
        "baseRCounterpart": true,
        "mode": "zero-comparison",
        "summary": {
          "columns": [
            "group",
            "allRows",
            "availableRows",
            "availableSum",
            "reportedMean"
          ],
          "rows": [
            [
              "A",
              2,
              2,
              2,
              1
            ],
            [
              "B",
              2,
              1,
              4,
              2
            ],
            [
              "C",
              1,
              0,
              null,
              0
            ]
          ],
          "observedZeroRetained": true,
          "coalesceIsSourceRecovery": false,
          "zeroComparison": true
        }
      },
      "having": {
        "returnCode": 0,
        "stdout": "{\"columns\":[\"group\",\"allRows\",\"availableRows\",\"availableSum\",\"reportedMean\"],\"rows\":[[\"A\",2,2,2,1]],\"observedZeroRetained\":true,\"coalesceIsSourceRecovery\":false,\"zeroComparison\":false}\n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "language": "r",
        "id": "having",
        "code": "if (.Platform$OS.type == \"windows\") invisible(Sys.setlocale(\"LC_CTYPE\", \"English_United States.utf8\"))\nto_json <- function(x) {\n  if (is.null(x)) return(\"null\")\n  if (is.list(x)) {\n    parts <- vapply(x,to_json,character(1))\n    if (is.null(names(x))) return(paste0(\"[\",paste(parts,collapse=\",\"),\"]\"))\n    keys <- vapply(names(x),function(s) encodeString(s,quote='\"'),character(1))\n    return(paste0(\"{\",paste(paste0(keys,\":\",parts),collapse=\",\"),\"}\"))\n  }\n  if (length(x)!=1L) return(to_json(as.list(x)))\n  if (is.na(x)) return(\"null\")\n  if (is.character(x)) return(encodeString(x,quote='\"'))\n  if (is.logical(x)) return(tolower(as.character(x)))\n  if (!is.finite(x)) stop(\"finite numerical display required\")\n  format(x,digits=17,scientific=FALSE,trim=TRUE)\n}\nemit <- function(x) cat(to_json(x),\"\\n\",sep=\"\")\nrow_lists <- function(d) lapply(seq_len(nrow(d)),function(i) unname(as.list(d[i,,drop=FALSE])))\nrows <- data.frame(g=c(\"A\",\"A\",\"B\",\"B\",\"C\"),x=c(0,2,NA_real_,4,NA_real_))\nout <- lapply(sort(unique(rows$g)),function(g) {x <- rows$x[rows$g==g];v <- x[!is.na(x)];list(g,length(x),length(v),if(length(v)) sum(v) else NULL,if(length(v)) mean(v) else NULL)})\nout <- Filter(function(r) r[[3]]>=2,out)\nemit(list(columns=as.list(c(\"group\",\"allRows\",\"availableRows\",\"availableSum\",\"reportedMean\")),rows=out,observedZeroRetained=TRUE,coalesceIsSourceRecovery=FALSE,zeroComparison=FALSE))\n",
        "codeFile": "data06-snippets/r/aggregation-having.R",
        "codeSha256": "0b96bcf9c748ead73d40921efe974b6668a9ccf538d5c90d705f9175d581fd69",
        "inputDirectory": null,
        "inputFiles": [],
        "sql": "SELECT g,COUNT(*) AS all_rows,COUNT(x) AS available_rows,SUM(x) AS available_sum,AVG(x) AS reported_mean FROM records GROUP BY g HAVING COUNT(x)>=2 ORDER BY g;",
        "sqlFile": "data06-snippets/sql/aggregation-having.sql",
        "recordedActualProcess": true,
        "browserExecutesLanguage": false,
        "originalSourceModified": false,
        "executesNativeSQLite": false,
        "baseRCounterpart": true,
        "mode": "having",
        "summary": {
          "columns": [
            "group",
            "allRows",
            "availableRows",
            "availableSum",
            "reportedMean"
          ],
          "rows": [
            [
              "A",
              2,
              2,
              2,
              1
            ]
          ],
          "observedZeroRetained": true,
          "coalesceIsSourceRecovery": false,
          "zeroComparison": false
        }
      }
    }
  },
  "query": {
    "country_correct": {
      "returnCode": 0,
      "stdout": "{\"columns\": [\"joined_rows\"], \"rows\": [[720]], \"nativeSQLiteVersion\": \"3.53.1\", \"meanStorage\": \"SQLite REAL / binary64 approximation\", \"originalSourceModified\": false}\n",
      "stderr": "",
      "language": "python",
      "id": "country_correct",
      "code": "import sys\nsys.stdout.reconfigure(encoding=\"utf-8\")\nsys.stderr.reconfigure(encoding=\"utf-8\")\nimport json,sqlite3\nimport csv\nfrom pathlib import Path\nfrom fractions import Fraction\nfolder=Path(sys.argv[1])\ndef load(file):\n    with open(folder/file,encoding=\"utf-8-sig\",newline=\"\") as handle:return list(csv.DictReader(handle))\ndef number(text):return float(Fraction(text)) if text!=\"\" else None\ndb=sqlite3.connect(\":memory:\")\ndb.executescript(\"CREATE TABLE gdp(iso TEXT NOT NULL,year TEXT NOT NULL,gdp REAL,PRIMARY KEY(iso,year));CREATE TABLE life(iso TEXT NOT NULL,year TEXT NOT NULL,life REAL,PRIMARY KEY(iso,year));CREATE TABLE people(source_row_id INTEGER PRIMARY KEY,school_group TEXT);CREATE TABLE outcome_full(source_row_id INTEGER PRIMARY KEY,log_wage REAL);CREATE TABLE outcome_available(source_row_id INTEGER PRIMARY KEY,log_wage REAL);CREATE TABLE before_wave(source_row_id INTEGER PRIMARY KEY,store_code TEXT,before_FTE REAL);CREATE TABLE after_wave(source_row_id INTEGER PRIMARY KEY,store_code TEXT,after_FTE REAL);\")\nfor table,file in [(\"gdp\",\"actual720-GDP-table-with-composite-keys.csv\"),(\"life\",\"actual720-life-table-with-composite-keys.csv\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?,?)\",[(r[\"country_ISO\"],r[\"year\"],number(r[\"value_source_decimal\"])) for r in load(file)])\ndb.executemany(\"INSERT INTO people VALUES(?,?)\",[(int(r[\"source_row_id\"]),r[\"school_group\"]) for r in load(\"actual3613-person-demographics-keyed.csv\")])\nfor table,file in [(\"outcome_full\",\"actual3613-outcome-keys-including603-NULL-values.csv\"),(\"outcome_available\",\"actual3010-available-only-outcome-keys.csv\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?)\",[(int(r[\"source_row_id\"]),number(r[\"log_wage_source_decimal\"])) for r in load(file)])\nfor table,file,value in [(\"before_wave\",\"actual410-before-wave-keyed-source-records.csv\",\"before_FTE_source_decimal\"),(\"after_wave\",\"actual410-after-wave-keyed-source-records.csv\",\"after_FTE_source_decimal\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?,?)\",[(int(r[\"source_row_id\"]),r[\"original_store_code\"],number(r[value])) for r in load(file)])\ncursor=db.execute('SELECT COUNT(*) AS joined_rows FROM gdp g JOIN life l ON g.iso=l.iso AND g.year=l.year;')\ncolumns=[r[0] for r in cursor.description]\nrows=[list(r) for r in cursor.fetchall()]\nprint(json.dumps(dict(columns=columns,rows=rows,nativeSQLiteVersion=sqlite3.sqlite_version,meanStorage=\"SQLite REAL / binary64 approximation\",originalSourceModified=False)))\ndb.close()\n",
      "codeFile": "data06-snippets/python/query-country_correct.py",
      "codeSha256": "fada039061a43735cdd1b6b557b2c93f76e273171639c108c3a7606b5dc32730",
      "inputDirectory": "data06-sources",
      "inputFiles": [
        {
          "file": "data06-sources/actual720-GDP-table-with-composite-keys.csv",
          "sha256": "76d79622279e4246f73cd0ef60fd8741db145e23ab2955ec5d096a84c707f0c0"
        },
        {
          "file": "data06-sources/actual720-life-table-with-composite-keys.csv",
          "sha256": "21589e57f3ddedb38738d5ef7e8a85f27ecaad89d4566da331e2531d12c7e474"
        },
        {
          "file": "data06-sources/actual3613-person-demographics-keyed.csv",
          "sha256": "625d07555c5a5ddf5ef7133b3653123ad8d566ce04c8e4b95f76bded85a0740f"
        },
        {
          "file": "data06-sources/actual3613-outcome-keys-including603-NULL-values.csv",
          "sha256": "cf3aefbce9a41cd04aecedaea4e9277818a826f036b48f5e0d608d6dfd5a75f1"
        },
        {
          "file": "data06-sources/actual3010-available-only-outcome-keys.csv",
          "sha256": "f085f3ecabb304e8fa299d85049037463e335b095229f4beeeb3ff91895ca186"
        },
        {
          "file": "data06-sources/actual410-before-wave-keyed-source-records.csv",
          "sha256": "9434152adc2a12552244320a9baad4dd9a499788a35cadd87fdec1e877e2db43"
        },
        {
          "file": "data06-sources/actual410-after-wave-keyed-source-records.csv",
          "sha256": "9f268919007818f53dcccf808e9e39c809c421b2f252baa3b6a4bc77493c5e9b"
        }
      ],
      "sql": "SELECT COUNT(*) AS joined_rows FROM gdp g JOIN life l ON g.iso=l.iso AND g.year=l.year;",
      "sqlFile": "data06-snippets/sql/query-country_correct.sql",
      "recordedActualProcess": true,
      "browserExecutesLanguage": false,
      "originalSourceModified": false,
      "executesNativeSQLite": true,
      "baseRCounterpart": false,
      "name": "country_correct",
      "summary": {
        "columns": [
          "joined_rows"
        ],
        "rows": [
          [
            720
          ]
        ],
        "nativeSQLiteVersion": "3.53.1",
        "meanStorage": "SQLite REAL / binary64 approximation",
        "originalSourceModified": false
      },
      "matchesFrozenCaseQueryOutput": true
    },
    "country_wrong": {
      "returnCode": 0,
      "stdout": "{\"columns\": [\"invalid_crossyear_combinations\"], \"rows\": [[32400]], \"nativeSQLiteVersion\": \"3.53.1\", \"meanStorage\": \"SQLite REAL / binary64 approximation\", \"originalSourceModified\": false}\n",
      "stderr": "",
      "language": "python",
      "id": "country_wrong",
      "code": "import sys\nsys.stdout.reconfigure(encoding=\"utf-8\")\nsys.stderr.reconfigure(encoding=\"utf-8\")\nimport json,sqlite3\nimport csv\nfrom pathlib import Path\nfrom fractions import Fraction\nfolder=Path(sys.argv[1])\ndef load(file):\n    with open(folder/file,encoding=\"utf-8-sig\",newline=\"\") as handle:return list(csv.DictReader(handle))\ndef number(text):return float(Fraction(text)) if text!=\"\" else None\ndb=sqlite3.connect(\":memory:\")\ndb.executescript(\"CREATE TABLE gdp(iso TEXT NOT NULL,year TEXT NOT NULL,gdp REAL,PRIMARY KEY(iso,year));CREATE TABLE life(iso TEXT NOT NULL,year TEXT NOT NULL,life REAL,PRIMARY KEY(iso,year));CREATE TABLE people(source_row_id INTEGER PRIMARY KEY,school_group TEXT);CREATE TABLE outcome_full(source_row_id INTEGER PRIMARY KEY,log_wage REAL);CREATE TABLE outcome_available(source_row_id INTEGER PRIMARY KEY,log_wage REAL);CREATE TABLE before_wave(source_row_id INTEGER PRIMARY KEY,store_code TEXT,before_FTE REAL);CREATE TABLE after_wave(source_row_id INTEGER PRIMARY KEY,store_code TEXT,after_FTE REAL);\")\nfor table,file in [(\"gdp\",\"actual720-GDP-table-with-composite-keys.csv\"),(\"life\",\"actual720-life-table-with-composite-keys.csv\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?,?)\",[(r[\"country_ISO\"],r[\"year\"],number(r[\"value_source_decimal\"])) for r in load(file)])\ndb.executemany(\"INSERT INTO people VALUES(?,?)\",[(int(r[\"source_row_id\"]),r[\"school_group\"]) for r in load(\"actual3613-person-demographics-keyed.csv\")])\nfor table,file in [(\"outcome_full\",\"actual3613-outcome-keys-including603-NULL-values.csv\"),(\"outcome_available\",\"actual3010-available-only-outcome-keys.csv\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?)\",[(int(r[\"source_row_id\"]),number(r[\"log_wage_source_decimal\"])) for r in load(file)])\nfor table,file,value in [(\"before_wave\",\"actual410-before-wave-keyed-source-records.csv\",\"before_FTE_source_decimal\"),(\"after_wave\",\"actual410-after-wave-keyed-source-records.csv\",\"after_FTE_source_decimal\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?,?)\",[(int(r[\"source_row_id\"]),r[\"original_store_code\"],number(r[value])) for r in load(file)])\ncursor=db.execute('SELECT COUNT(*) AS invalid_crossyear_combinations FROM gdp g JOIN life l ON g.iso=l.iso;')\ncolumns=[r[0] for r in cursor.description]\nrows=[list(r) for r in cursor.fetchall()]\nprint(json.dumps(dict(columns=columns,rows=rows,nativeSQLiteVersion=sqlite3.sqlite_version,meanStorage=\"SQLite REAL / binary64 approximation\",originalSourceModified=False)))\ndb.close()\n",
      "codeFile": "data06-snippets/python/query-country_wrong.py",
      "codeSha256": "8fcbecce12c8ee15282f66d7a0e375812bcb979fc66b63216b71db21c12f9639",
      "inputDirectory": "data06-sources",
      "inputFiles": [
        {
          "file": "data06-sources/actual720-GDP-table-with-composite-keys.csv",
          "sha256": "76d79622279e4246f73cd0ef60fd8741db145e23ab2955ec5d096a84c707f0c0"
        },
        {
          "file": "data06-sources/actual720-life-table-with-composite-keys.csv",
          "sha256": "21589e57f3ddedb38738d5ef7e8a85f27ecaad89d4566da331e2531d12c7e474"
        },
        {
          "file": "data06-sources/actual3613-person-demographics-keyed.csv",
          "sha256": "625d07555c5a5ddf5ef7133b3653123ad8d566ce04c8e4b95f76bded85a0740f"
        },
        {
          "file": "data06-sources/actual3613-outcome-keys-including603-NULL-values.csv",
          "sha256": "cf3aefbce9a41cd04aecedaea4e9277818a826f036b48f5e0d608d6dfd5a75f1"
        },
        {
          "file": "data06-sources/actual3010-available-only-outcome-keys.csv",
          "sha256": "f085f3ecabb304e8fa299d85049037463e335b095229f4beeeb3ff91895ca186"
        },
        {
          "file": "data06-sources/actual410-before-wave-keyed-source-records.csv",
          "sha256": "9434152adc2a12552244320a9baad4dd9a499788a35cadd87fdec1e877e2db43"
        },
        {
          "file": "data06-sources/actual410-after-wave-keyed-source-records.csv",
          "sha256": "9f268919007818f53dcccf808e9e39c809c421b2f252baa3b6a4bc77493c5e9b"
        }
      ],
      "sql": "SELECT COUNT(*) AS invalid_crossyear_combinations FROM gdp g JOIN life l ON g.iso=l.iso;",
      "sqlFile": "data06-snippets/sql/query-country_wrong.sql",
      "recordedActualProcess": true,
      "browserExecutesLanguage": false,
      "originalSourceModified": false,
      "executesNativeSQLite": true,
      "baseRCounterpart": false,
      "name": "country_wrong",
      "summary": {
        "columns": [
          "invalid_crossyear_combinations"
        ],
        "rows": [
          [
            32400
          ]
        ],
        "nativeSQLiteVersion": "3.53.1",
        "meanStorage": "SQLite REAL / binary64 approximation",
        "originalSourceModified": false
      },
      "matchesFrozenCaseQueryOutput": true
    },
    "person_full_inner": {
      "returnCode": 0,
      "stdout": "{\"columns\": [\"joined_rows\", \"available_logs\"], \"rows\": [[3613, 3010]], \"nativeSQLiteVersion\": \"3.53.1\", \"meanStorage\": \"SQLite REAL / binary64 approximation\", \"originalSourceModified\": false}\n",
      "stderr": "",
      "language": "python",
      "id": "person_full_inner",
      "code": "import sys\nsys.stdout.reconfigure(encoding=\"utf-8\")\nsys.stderr.reconfigure(encoding=\"utf-8\")\nimport json,sqlite3\nimport csv\nfrom pathlib import Path\nfrom fractions import Fraction\nfolder=Path(sys.argv[1])\ndef load(file):\n    with open(folder/file,encoding=\"utf-8-sig\",newline=\"\") as handle:return list(csv.DictReader(handle))\ndef number(text):return float(Fraction(text)) if text!=\"\" else None\ndb=sqlite3.connect(\":memory:\")\ndb.executescript(\"CREATE TABLE gdp(iso TEXT NOT NULL,year TEXT NOT NULL,gdp REAL,PRIMARY KEY(iso,year));CREATE TABLE life(iso TEXT NOT NULL,year TEXT NOT NULL,life REAL,PRIMARY KEY(iso,year));CREATE TABLE people(source_row_id INTEGER PRIMARY KEY,school_group TEXT);CREATE TABLE outcome_full(source_row_id INTEGER PRIMARY KEY,log_wage REAL);CREATE TABLE outcome_available(source_row_id INTEGER PRIMARY KEY,log_wage REAL);CREATE TABLE before_wave(source_row_id INTEGER PRIMARY KEY,store_code TEXT,before_FTE REAL);CREATE TABLE after_wave(source_row_id INTEGER PRIMARY KEY,store_code TEXT,after_FTE REAL);\")\nfor table,file in [(\"gdp\",\"actual720-GDP-table-with-composite-keys.csv\"),(\"life\",\"actual720-life-table-with-composite-keys.csv\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?,?)\",[(r[\"country_ISO\"],r[\"year\"],number(r[\"value_source_decimal\"])) for r in load(file)])\ndb.executemany(\"INSERT INTO people VALUES(?,?)\",[(int(r[\"source_row_id\"]),r[\"school_group\"]) for r in load(\"actual3613-person-demographics-keyed.csv\")])\nfor table,file in [(\"outcome_full\",\"actual3613-outcome-keys-including603-NULL-values.csv\"),(\"outcome_available\",\"actual3010-available-only-outcome-keys.csv\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?)\",[(int(r[\"source_row_id\"]),number(r[\"log_wage_source_decimal\"])) for r in load(file)])\nfor table,file,value in [(\"before_wave\",\"actual410-before-wave-keyed-source-records.csv\",\"before_FTE_source_decimal\"),(\"after_wave\",\"actual410-after-wave-keyed-source-records.csv\",\"after_FTE_source_decimal\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?,?)\",[(int(r[\"source_row_id\"]),r[\"original_store_code\"],number(r[value])) for r in load(file)])\ncursor=db.execute('SELECT COUNT(*) AS joined_rows,COUNT(w.log_wage) AS available_logs FROM people p INNER JOIN outcome_full w ON p.source_row_id=w.source_row_id;')\ncolumns=[r[0] for r in cursor.description]\nrows=[list(r) for r in cursor.fetchall()]\nprint(json.dumps(dict(columns=columns,rows=rows,nativeSQLiteVersion=sqlite3.sqlite_version,meanStorage=\"SQLite REAL / binary64 approximation\",originalSourceModified=False)))\ndb.close()\n",
      "codeFile": "data06-snippets/python/query-person_full_inner.py",
      "codeSha256": "d5ef05ba3df1003f95858d4af007733895322354f9fbc80c50d0022174795f16",
      "inputDirectory": "data06-sources",
      "inputFiles": [
        {
          "file": "data06-sources/actual720-GDP-table-with-composite-keys.csv",
          "sha256": "76d79622279e4246f73cd0ef60fd8741db145e23ab2955ec5d096a84c707f0c0"
        },
        {
          "file": "data06-sources/actual720-life-table-with-composite-keys.csv",
          "sha256": "21589e57f3ddedb38738d5ef7e8a85f27ecaad89d4566da331e2531d12c7e474"
        },
        {
          "file": "data06-sources/actual3613-person-demographics-keyed.csv",
          "sha256": "625d07555c5a5ddf5ef7133b3653123ad8d566ce04c8e4b95f76bded85a0740f"
        },
        {
          "file": "data06-sources/actual3613-outcome-keys-including603-NULL-values.csv",
          "sha256": "cf3aefbce9a41cd04aecedaea4e9277818a826f036b48f5e0d608d6dfd5a75f1"
        },
        {
          "file": "data06-sources/actual3010-available-only-outcome-keys.csv",
          "sha256": "f085f3ecabb304e8fa299d85049037463e335b095229f4beeeb3ff91895ca186"
        },
        {
          "file": "data06-sources/actual410-before-wave-keyed-source-records.csv",
          "sha256": "9434152adc2a12552244320a9baad4dd9a499788a35cadd87fdec1e877e2db43"
        },
        {
          "file": "data06-sources/actual410-after-wave-keyed-source-records.csv",
          "sha256": "9f268919007818f53dcccf808e9e39c809c421b2f252baa3b6a4bc77493c5e9b"
        }
      ],
      "sql": "SELECT COUNT(*) AS joined_rows,COUNT(w.log_wage) AS available_logs FROM people p INNER JOIN outcome_full w ON p.source_row_id=w.source_row_id;",
      "sqlFile": "data06-snippets/sql/query-person_full_inner.sql",
      "recordedActualProcess": true,
      "browserExecutesLanguage": false,
      "originalSourceModified": false,
      "executesNativeSQLite": true,
      "baseRCounterpart": false,
      "name": "person_full_inner",
      "summary": {
        "columns": [
          "joined_rows",
          "available_logs"
        ],
        "rows": [
          [
            3613,
            3010
          ]
        ],
        "nativeSQLiteVersion": "3.53.1",
        "meanStorage": "SQLite REAL / binary64 approximation",
        "originalSourceModified": false
      },
      "matchesFrozenCaseQueryOutput": true
    },
    "person_available_inner": {
      "returnCode": 0,
      "stdout": "{\"columns\": [\"joined_rows\", \"available_logs\"], \"rows\": [[3010, 3010]], \"nativeSQLiteVersion\": \"3.53.1\", \"meanStorage\": \"SQLite REAL / binary64 approximation\", \"originalSourceModified\": false}\n",
      "stderr": "",
      "language": "python",
      "id": "person_available_inner",
      "code": "import sys\nsys.stdout.reconfigure(encoding=\"utf-8\")\nsys.stderr.reconfigure(encoding=\"utf-8\")\nimport json,sqlite3\nimport csv\nfrom pathlib import Path\nfrom fractions import Fraction\nfolder=Path(sys.argv[1])\ndef load(file):\n    with open(folder/file,encoding=\"utf-8-sig\",newline=\"\") as handle:return list(csv.DictReader(handle))\ndef number(text):return float(Fraction(text)) if text!=\"\" else None\ndb=sqlite3.connect(\":memory:\")\ndb.executescript(\"CREATE TABLE gdp(iso TEXT NOT NULL,year TEXT NOT NULL,gdp REAL,PRIMARY KEY(iso,year));CREATE TABLE life(iso TEXT NOT NULL,year TEXT NOT NULL,life REAL,PRIMARY KEY(iso,year));CREATE TABLE people(source_row_id INTEGER PRIMARY KEY,school_group TEXT);CREATE TABLE outcome_full(source_row_id INTEGER PRIMARY KEY,log_wage REAL);CREATE TABLE outcome_available(source_row_id INTEGER PRIMARY KEY,log_wage REAL);CREATE TABLE before_wave(source_row_id INTEGER PRIMARY KEY,store_code TEXT,before_FTE REAL);CREATE TABLE after_wave(source_row_id INTEGER PRIMARY KEY,store_code TEXT,after_FTE REAL);\")\nfor table,file in [(\"gdp\",\"actual720-GDP-table-with-composite-keys.csv\"),(\"life\",\"actual720-life-table-with-composite-keys.csv\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?,?)\",[(r[\"country_ISO\"],r[\"year\"],number(r[\"value_source_decimal\"])) for r in load(file)])\ndb.executemany(\"INSERT INTO people VALUES(?,?)\",[(int(r[\"source_row_id\"]),r[\"school_group\"]) for r in load(\"actual3613-person-demographics-keyed.csv\")])\nfor table,file in [(\"outcome_full\",\"actual3613-outcome-keys-including603-NULL-values.csv\"),(\"outcome_available\",\"actual3010-available-only-outcome-keys.csv\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?)\",[(int(r[\"source_row_id\"]),number(r[\"log_wage_source_decimal\"])) for r in load(file)])\nfor table,file,value in [(\"before_wave\",\"actual410-before-wave-keyed-source-records.csv\",\"before_FTE_source_decimal\"),(\"after_wave\",\"actual410-after-wave-keyed-source-records.csv\",\"after_FTE_source_decimal\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?,?)\",[(int(r[\"source_row_id\"]),r[\"original_store_code\"],number(r[value])) for r in load(file)])\ncursor=db.execute('SELECT COUNT(*) AS joined_rows,COUNT(w.log_wage) AS available_logs FROM people p INNER JOIN outcome_available w ON p.source_row_id=w.source_row_id;')\ncolumns=[r[0] for r in cursor.description]\nrows=[list(r) for r in cursor.fetchall()]\nprint(json.dumps(dict(columns=columns,rows=rows,nativeSQLiteVersion=sqlite3.sqlite_version,meanStorage=\"SQLite REAL / binary64 approximation\",originalSourceModified=False)))\ndb.close()\n",
      "codeFile": "data06-snippets/python/query-person_available_inner.py",
      "codeSha256": "cabd5c85bfca5d8d4dac4abefc8709bf2c31bcdb9166ed27a2364aa0e9e47fd7",
      "inputDirectory": "data06-sources",
      "inputFiles": [
        {
          "file": "data06-sources/actual720-GDP-table-with-composite-keys.csv",
          "sha256": "76d79622279e4246f73cd0ef60fd8741db145e23ab2955ec5d096a84c707f0c0"
        },
        {
          "file": "data06-sources/actual720-life-table-with-composite-keys.csv",
          "sha256": "21589e57f3ddedb38738d5ef7e8a85f27ecaad89d4566da331e2531d12c7e474"
        },
        {
          "file": "data06-sources/actual3613-person-demographics-keyed.csv",
          "sha256": "625d07555c5a5ddf5ef7133b3653123ad8d566ce04c8e4b95f76bded85a0740f"
        },
        {
          "file": "data06-sources/actual3613-outcome-keys-including603-NULL-values.csv",
          "sha256": "cf3aefbce9a41cd04aecedaea4e9277818a826f036b48f5e0d608d6dfd5a75f1"
        },
        {
          "file": "data06-sources/actual3010-available-only-outcome-keys.csv",
          "sha256": "f085f3ecabb304e8fa299d85049037463e335b095229f4beeeb3ff91895ca186"
        },
        {
          "file": "data06-sources/actual410-before-wave-keyed-source-records.csv",
          "sha256": "9434152adc2a12552244320a9baad4dd9a499788a35cadd87fdec1e877e2db43"
        },
        {
          "file": "data06-sources/actual410-after-wave-keyed-source-records.csv",
          "sha256": "9f268919007818f53dcccf808e9e39c809c421b2f252baa3b6a4bc77493c5e9b"
        }
      ],
      "sql": "SELECT COUNT(*) AS joined_rows,COUNT(w.log_wage) AS available_logs FROM people p INNER JOIN outcome_available w ON p.source_row_id=w.source_row_id;",
      "sqlFile": "data06-snippets/sql/query-person_available_inner.sql",
      "recordedActualProcess": true,
      "browserExecutesLanguage": false,
      "originalSourceModified": false,
      "executesNativeSQLite": true,
      "baseRCounterpart": false,
      "name": "person_available_inner",
      "summary": {
        "columns": [
          "joined_rows",
          "available_logs"
        ],
        "rows": [
          [
            3010,
            3010
          ]
        ],
        "nativeSQLiteVersion": "3.53.1",
        "meanStorage": "SQLite REAL / binary64 approximation",
        "originalSourceModified": false
      },
      "matchesFrozenCaseQueryOutput": true
    },
    "person_available_left": {
      "returnCode": 0,
      "stdout": "{\"columns\": [\"joined_rows\", \"available_logs\"], \"rows\": [[3613, 3010]], \"nativeSQLiteVersion\": \"3.53.1\", \"meanStorage\": \"SQLite REAL / binary64 approximation\", \"originalSourceModified\": false}\n",
      "stderr": "",
      "language": "python",
      "id": "person_available_left",
      "code": "import sys\nsys.stdout.reconfigure(encoding=\"utf-8\")\nsys.stderr.reconfigure(encoding=\"utf-8\")\nimport json,sqlite3\nimport csv\nfrom pathlib import Path\nfrom fractions import Fraction\nfolder=Path(sys.argv[1])\ndef load(file):\n    with open(folder/file,encoding=\"utf-8-sig\",newline=\"\") as handle:return list(csv.DictReader(handle))\ndef number(text):return float(Fraction(text)) if text!=\"\" else None\ndb=sqlite3.connect(\":memory:\")\ndb.executescript(\"CREATE TABLE gdp(iso TEXT NOT NULL,year TEXT NOT NULL,gdp REAL,PRIMARY KEY(iso,year));CREATE TABLE life(iso TEXT NOT NULL,year TEXT NOT NULL,life REAL,PRIMARY KEY(iso,year));CREATE TABLE people(source_row_id INTEGER PRIMARY KEY,school_group TEXT);CREATE TABLE outcome_full(source_row_id INTEGER PRIMARY KEY,log_wage REAL);CREATE TABLE outcome_available(source_row_id INTEGER PRIMARY KEY,log_wage REAL);CREATE TABLE before_wave(source_row_id INTEGER PRIMARY KEY,store_code TEXT,before_FTE REAL);CREATE TABLE after_wave(source_row_id INTEGER PRIMARY KEY,store_code TEXT,after_FTE REAL);\")\nfor table,file in [(\"gdp\",\"actual720-GDP-table-with-composite-keys.csv\"),(\"life\",\"actual720-life-table-with-composite-keys.csv\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?,?)\",[(r[\"country_ISO\"],r[\"year\"],number(r[\"value_source_decimal\"])) for r in load(file)])\ndb.executemany(\"INSERT INTO people VALUES(?,?)\",[(int(r[\"source_row_id\"]),r[\"school_group\"]) for r in load(\"actual3613-person-demographics-keyed.csv\")])\nfor table,file in [(\"outcome_full\",\"actual3613-outcome-keys-including603-NULL-values.csv\"),(\"outcome_available\",\"actual3010-available-only-outcome-keys.csv\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?)\",[(int(r[\"source_row_id\"]),number(r[\"log_wage_source_decimal\"])) for r in load(file)])\nfor table,file,value in [(\"before_wave\",\"actual410-before-wave-keyed-source-records.csv\",\"before_FTE_source_decimal\"),(\"after_wave\",\"actual410-after-wave-keyed-source-records.csv\",\"after_FTE_source_decimal\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?,?)\",[(int(r[\"source_row_id\"]),r[\"original_store_code\"],number(r[value])) for r in load(file)])\ncursor=db.execute('SELECT COUNT(*) AS joined_rows,COUNT(w.log_wage) AS available_logs FROM people p LEFT JOIN outcome_available w ON p.source_row_id=w.source_row_id;')\ncolumns=[r[0] for r in cursor.description]\nrows=[list(r) for r in cursor.fetchall()]\nprint(json.dumps(dict(columns=columns,rows=rows,nativeSQLiteVersion=sqlite3.sqlite_version,meanStorage=\"SQLite REAL / binary64 approximation\",originalSourceModified=False)))\ndb.close()\n",
      "codeFile": "data06-snippets/python/query-person_available_left.py",
      "codeSha256": "4ca10615319020262eccc8b1babb8bcea79c2713f388a0a95ac331e570385452",
      "inputDirectory": "data06-sources",
      "inputFiles": [
        {
          "file": "data06-sources/actual720-GDP-table-with-composite-keys.csv",
          "sha256": "76d79622279e4246f73cd0ef60fd8741db145e23ab2955ec5d096a84c707f0c0"
        },
        {
          "file": "data06-sources/actual720-life-table-with-composite-keys.csv",
          "sha256": "21589e57f3ddedb38738d5ef7e8a85f27ecaad89d4566da331e2531d12c7e474"
        },
        {
          "file": "data06-sources/actual3613-person-demographics-keyed.csv",
          "sha256": "625d07555c5a5ddf5ef7133b3653123ad8d566ce04c8e4b95f76bded85a0740f"
        },
        {
          "file": "data06-sources/actual3613-outcome-keys-including603-NULL-values.csv",
          "sha256": "cf3aefbce9a41cd04aecedaea4e9277818a826f036b48f5e0d608d6dfd5a75f1"
        },
        {
          "file": "data06-sources/actual3010-available-only-outcome-keys.csv",
          "sha256": "f085f3ecabb304e8fa299d85049037463e335b095229f4beeeb3ff91895ca186"
        },
        {
          "file": "data06-sources/actual410-before-wave-keyed-source-records.csv",
          "sha256": "9434152adc2a12552244320a9baad4dd9a499788a35cadd87fdec1e877e2db43"
        },
        {
          "file": "data06-sources/actual410-after-wave-keyed-source-records.csv",
          "sha256": "9f268919007818f53dcccf808e9e39c809c421b2f252baa3b6a4bc77493c5e9b"
        }
      ],
      "sql": "SELECT COUNT(*) AS joined_rows,COUNT(w.log_wage) AS available_logs FROM people p LEFT JOIN outcome_available w ON p.source_row_id=w.source_row_id;",
      "sqlFile": "data06-snippets/sql/query-person_available_left.sql",
      "recordedActualProcess": true,
      "browserExecutesLanguage": false,
      "originalSourceModified": false,
      "executesNativeSQLite": true,
      "baseRCounterpart": false,
      "name": "person_available_left",
      "summary": {
        "columns": [
          "joined_rows",
          "available_logs"
        ],
        "rows": [
          [
            3613,
            3010
          ]
        ],
        "nativeSQLiteVersion": "3.53.1",
        "meanStorage": "SQLite REAL / binary64 approximation",
        "originalSourceModified": false
      },
      "matchesFrozenCaseQueryOutput": true
    },
    "person_left_then_where": {
      "returnCode": 0,
      "stdout": "{\"columns\": [\"joined_rows\", \"available_logs\"], \"rows\": [[3010, 3010]], \"nativeSQLiteVersion\": \"3.53.1\", \"meanStorage\": \"SQLite REAL / binary64 approximation\", \"originalSourceModified\": false}\n",
      "stderr": "",
      "language": "python",
      "id": "person_left_then_where",
      "code": "import sys\nsys.stdout.reconfigure(encoding=\"utf-8\")\nsys.stderr.reconfigure(encoding=\"utf-8\")\nimport json,sqlite3\nimport csv\nfrom pathlib import Path\nfrom fractions import Fraction\nfolder=Path(sys.argv[1])\ndef load(file):\n    with open(folder/file,encoding=\"utf-8-sig\",newline=\"\") as handle:return list(csv.DictReader(handle))\ndef number(text):return float(Fraction(text)) if text!=\"\" else None\ndb=sqlite3.connect(\":memory:\")\ndb.executescript(\"CREATE TABLE gdp(iso TEXT NOT NULL,year TEXT NOT NULL,gdp REAL,PRIMARY KEY(iso,year));CREATE TABLE life(iso TEXT NOT NULL,year TEXT NOT NULL,life REAL,PRIMARY KEY(iso,year));CREATE TABLE people(source_row_id INTEGER PRIMARY KEY,school_group TEXT);CREATE TABLE outcome_full(source_row_id INTEGER PRIMARY KEY,log_wage REAL);CREATE TABLE outcome_available(source_row_id INTEGER PRIMARY KEY,log_wage REAL);CREATE TABLE before_wave(source_row_id INTEGER PRIMARY KEY,store_code TEXT,before_FTE REAL);CREATE TABLE after_wave(source_row_id INTEGER PRIMARY KEY,store_code TEXT,after_FTE REAL);\")\nfor table,file in [(\"gdp\",\"actual720-GDP-table-with-composite-keys.csv\"),(\"life\",\"actual720-life-table-with-composite-keys.csv\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?,?)\",[(r[\"country_ISO\"],r[\"year\"],number(r[\"value_source_decimal\"])) for r in load(file)])\ndb.executemany(\"INSERT INTO people VALUES(?,?)\",[(int(r[\"source_row_id\"]),r[\"school_group\"]) for r in load(\"actual3613-person-demographics-keyed.csv\")])\nfor table,file in [(\"outcome_full\",\"actual3613-outcome-keys-including603-NULL-values.csv\"),(\"outcome_available\",\"actual3010-available-only-outcome-keys.csv\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?)\",[(int(r[\"source_row_id\"]),number(r[\"log_wage_source_decimal\"])) for r in load(file)])\nfor table,file,value in [(\"before_wave\",\"actual410-before-wave-keyed-source-records.csv\",\"before_FTE_source_decimal\"),(\"after_wave\",\"actual410-after-wave-keyed-source-records.csv\",\"after_FTE_source_decimal\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?,?)\",[(int(r[\"source_row_id\"]),r[\"original_store_code\"],number(r[value])) for r in load(file)])\ncursor=db.execute('SELECT COUNT(*) AS joined_rows,COUNT(w.log_wage) AS available_logs FROM people p LEFT JOIN outcome_available w ON p.source_row_id=w.source_row_id WHERE w.log_wage IS NOT NULL;')\ncolumns=[r[0] for r in cursor.description]\nrows=[list(r) for r in cursor.fetchall()]\nprint(json.dumps(dict(columns=columns,rows=rows,nativeSQLiteVersion=sqlite3.sqlite_version,meanStorage=\"SQLite REAL / binary64 approximation\",originalSourceModified=False)))\ndb.close()\n",
      "codeFile": "data06-snippets/python/query-person_left_then_where.py",
      "codeSha256": "1f1c1218ea987b4f64df3a6ea021d82ce77d271451195f4f3b740eedb9ed0615",
      "inputDirectory": "data06-sources",
      "inputFiles": [
        {
          "file": "data06-sources/actual720-GDP-table-with-composite-keys.csv",
          "sha256": "76d79622279e4246f73cd0ef60fd8741db145e23ab2955ec5d096a84c707f0c0"
        },
        {
          "file": "data06-sources/actual720-life-table-with-composite-keys.csv",
          "sha256": "21589e57f3ddedb38738d5ef7e8a85f27ecaad89d4566da331e2531d12c7e474"
        },
        {
          "file": "data06-sources/actual3613-person-demographics-keyed.csv",
          "sha256": "625d07555c5a5ddf5ef7133b3653123ad8d566ce04c8e4b95f76bded85a0740f"
        },
        {
          "file": "data06-sources/actual3613-outcome-keys-including603-NULL-values.csv",
          "sha256": "cf3aefbce9a41cd04aecedaea4e9277818a826f036b48f5e0d608d6dfd5a75f1"
        },
        {
          "file": "data06-sources/actual3010-available-only-outcome-keys.csv",
          "sha256": "f085f3ecabb304e8fa299d85049037463e335b095229f4beeeb3ff91895ca186"
        },
        {
          "file": "data06-sources/actual410-before-wave-keyed-source-records.csv",
          "sha256": "9434152adc2a12552244320a9baad4dd9a499788a35cadd87fdec1e877e2db43"
        },
        {
          "file": "data06-sources/actual410-after-wave-keyed-source-records.csv",
          "sha256": "9f268919007818f53dcccf808e9e39c809c421b2f252baa3b6a4bc77493c5e9b"
        }
      ],
      "sql": "SELECT COUNT(*) AS joined_rows,COUNT(w.log_wage) AS available_logs FROM people p LEFT JOIN outcome_available w ON p.source_row_id=w.source_row_id WHERE w.log_wage IS NOT NULL;",
      "sqlFile": "data06-snippets/sql/query-person_left_then_where.sql",
      "recordedActualProcess": true,
      "browserExecutesLanguage": false,
      "originalSourceModified": false,
      "executesNativeSQLite": true,
      "baseRCounterpart": false,
      "name": "person_left_then_where",
      "summary": {
        "columns": [
          "joined_rows",
          "available_logs"
        ],
        "rows": [
          [
            3010,
            3010
          ]
        ],
        "nativeSQLiteVersion": "3.53.1",
        "meanStorage": "SQLite REAL / binary64 approximation",
        "originalSourceModified": false
      },
      "matchesFrozenCaseQueryOutput": true
    },
    "person_groups": {
      "returnCode": 0,
      "stdout": "{\"columns\": [\"school_group\", \"all_rows\", \"available_logs\", \"available_mean\", \"invalid_zero_mean\"], \"rows\": [[\"schooling_gt12\", 1807, 1521, 6.3579433061932935, 5.351650121040398], [\"schooling_le12\", 1806, 1489, 6.163655005836132, 5.081773147115172]], \"nativeSQLiteVersion\": \"3.53.1\", \"meanStorage\": \"SQLite REAL / binary64 approximation\", \"originalSourceModified\": false}\n",
      "stderr": "",
      "language": "python",
      "id": "person_groups",
      "code": "import sys\nsys.stdout.reconfigure(encoding=\"utf-8\")\nsys.stderr.reconfigure(encoding=\"utf-8\")\nimport json,sqlite3\nimport csv\nfrom pathlib import Path\nfrom fractions import Fraction\nfolder=Path(sys.argv[1])\ndef load(file):\n    with open(folder/file,encoding=\"utf-8-sig\",newline=\"\") as handle:return list(csv.DictReader(handle))\ndef number(text):return float(Fraction(text)) if text!=\"\" else None\ndb=sqlite3.connect(\":memory:\")\ndb.executescript(\"CREATE TABLE gdp(iso TEXT NOT NULL,year TEXT NOT NULL,gdp REAL,PRIMARY KEY(iso,year));CREATE TABLE life(iso TEXT NOT NULL,year TEXT NOT NULL,life REAL,PRIMARY KEY(iso,year));CREATE TABLE people(source_row_id INTEGER PRIMARY KEY,school_group TEXT);CREATE TABLE outcome_full(source_row_id INTEGER PRIMARY KEY,log_wage REAL);CREATE TABLE outcome_available(source_row_id INTEGER PRIMARY KEY,log_wage REAL);CREATE TABLE before_wave(source_row_id INTEGER PRIMARY KEY,store_code TEXT,before_FTE REAL);CREATE TABLE after_wave(source_row_id INTEGER PRIMARY KEY,store_code TEXT,after_FTE REAL);\")\nfor table,file in [(\"gdp\",\"actual720-GDP-table-with-composite-keys.csv\"),(\"life\",\"actual720-life-table-with-composite-keys.csv\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?,?)\",[(r[\"country_ISO\"],r[\"year\"],number(r[\"value_source_decimal\"])) for r in load(file)])\ndb.executemany(\"INSERT INTO people VALUES(?,?)\",[(int(r[\"source_row_id\"]),r[\"school_group\"]) for r in load(\"actual3613-person-demographics-keyed.csv\")])\nfor table,file in [(\"outcome_full\",\"actual3613-outcome-keys-including603-NULL-values.csv\"),(\"outcome_available\",\"actual3010-available-only-outcome-keys.csv\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?)\",[(int(r[\"source_row_id\"]),number(r[\"log_wage_source_decimal\"])) for r in load(file)])\nfor table,file,value in [(\"before_wave\",\"actual410-before-wave-keyed-source-records.csv\",\"before_FTE_source_decimal\"),(\"after_wave\",\"actual410-after-wave-keyed-source-records.csv\",\"after_FTE_source_decimal\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?,?)\",[(int(r[\"source_row_id\"]),r[\"original_store_code\"],number(r[value])) for r in load(file)])\ncursor=db.execute('SELECT p.school_group,COUNT(*) AS all_rows,COUNT(w.log_wage) AS available_logs,AVG(w.log_wage) AS available_mean,AVG(COALESCE(w.log_wage,0)) AS invalid_zero_mean FROM people p LEFT JOIN outcome_full w ON p.source_row_id=w.source_row_id GROUP BY p.school_group ORDER BY p.school_group;')\ncolumns=[r[0] for r in cursor.description]\nrows=[list(r) for r in cursor.fetchall()]\nprint(json.dumps(dict(columns=columns,rows=rows,nativeSQLiteVersion=sqlite3.sqlite_version,meanStorage=\"SQLite REAL / binary64 approximation\",originalSourceModified=False)))\ndb.close()\n",
      "codeFile": "data06-snippets/python/query-person_groups.py",
      "codeSha256": "71320d4a53252075088e449a6dfc4dd1e11e9337c42344f7579f5fc9749745e4",
      "inputDirectory": "data06-sources",
      "inputFiles": [
        {
          "file": "data06-sources/actual720-GDP-table-with-composite-keys.csv",
          "sha256": "76d79622279e4246f73cd0ef60fd8741db145e23ab2955ec5d096a84c707f0c0"
        },
        {
          "file": "data06-sources/actual720-life-table-with-composite-keys.csv",
          "sha256": "21589e57f3ddedb38738d5ef7e8a85f27ecaad89d4566da331e2531d12c7e474"
        },
        {
          "file": "data06-sources/actual3613-person-demographics-keyed.csv",
          "sha256": "625d07555c5a5ddf5ef7133b3653123ad8d566ce04c8e4b95f76bded85a0740f"
        },
        {
          "file": "data06-sources/actual3613-outcome-keys-including603-NULL-values.csv",
          "sha256": "cf3aefbce9a41cd04aecedaea4e9277818a826f036b48f5e0d608d6dfd5a75f1"
        },
        {
          "file": "data06-sources/actual3010-available-only-outcome-keys.csv",
          "sha256": "f085f3ecabb304e8fa299d85049037463e335b095229f4beeeb3ff91895ca186"
        },
        {
          "file": "data06-sources/actual410-before-wave-keyed-source-records.csv",
          "sha256": "9434152adc2a12552244320a9baad4dd9a499788a35cadd87fdec1e877e2db43"
        },
        {
          "file": "data06-sources/actual410-after-wave-keyed-source-records.csv",
          "sha256": "9f268919007818f53dcccf808e9e39c809c421b2f252baa3b6a4bc77493c5e9b"
        }
      ],
      "sql": "SELECT p.school_group,COUNT(*) AS all_rows,COUNT(w.log_wage) AS available_logs,AVG(w.log_wage) AS available_mean,AVG(COALESCE(w.log_wage,0)) AS invalid_zero_mean FROM people p LEFT JOIN outcome_full w ON p.source_row_id=w.source_row_id GROUP BY p.school_group ORDER BY p.school_group;",
      "sqlFile": "data06-snippets/sql/query-person_groups.sql",
      "recordedActualProcess": true,
      "browserExecutesLanguage": false,
      "originalSourceModified": false,
      "executesNativeSQLite": true,
      "baseRCounterpart": false,
      "name": "person_groups",
      "summary": {
        "columns": [
          "school_group",
          "all_rows",
          "available_logs",
          "available_mean",
          "invalid_zero_mean"
        ],
        "rows": [
          [
            "schooling_gt12",
            1807,
            1521,
            6.3579433061932935,
            5.351650121040398
          ],
          [
            "schooling_le12",
            1806,
            1489,
            6.163655005836132,
            5.081773147115172
          ]
        ],
        "nativeSQLiteVersion": "3.53.1",
        "meanStorage": "SQLite REAL / binary64 approximation",
        "originalSourceModified": false
      },
      "matchesFrozenCaseQueryOutput": true
    },
    "company_correct": {
      "returnCode": 0,
      "stdout": "{\"columns\": [\"joined_rows\", \"complete_values\", \"mean_difference\"], \"rows\": [[410, 384, -0.07044270833333334]], \"nativeSQLiteVersion\": \"3.53.1\", \"meanStorage\": \"SQLite REAL / binary64 approximation\", \"originalSourceModified\": false}\n",
      "stderr": "",
      "language": "python",
      "id": "company_correct",
      "code": "import sys\nsys.stdout.reconfigure(encoding=\"utf-8\")\nsys.stderr.reconfigure(encoding=\"utf-8\")\nimport json,sqlite3\nimport csv\nfrom pathlib import Path\nfrom fractions import Fraction\nfolder=Path(sys.argv[1])\ndef load(file):\n    with open(folder/file,encoding=\"utf-8-sig\",newline=\"\") as handle:return list(csv.DictReader(handle))\ndef number(text):return float(Fraction(text)) if text!=\"\" else None\ndb=sqlite3.connect(\":memory:\")\ndb.executescript(\"CREATE TABLE gdp(iso TEXT NOT NULL,year TEXT NOT NULL,gdp REAL,PRIMARY KEY(iso,year));CREATE TABLE life(iso TEXT NOT NULL,year TEXT NOT NULL,life REAL,PRIMARY KEY(iso,year));CREATE TABLE people(source_row_id INTEGER PRIMARY KEY,school_group TEXT);CREATE TABLE outcome_full(source_row_id INTEGER PRIMARY KEY,log_wage REAL);CREATE TABLE outcome_available(source_row_id INTEGER PRIMARY KEY,log_wage REAL);CREATE TABLE before_wave(source_row_id INTEGER PRIMARY KEY,store_code TEXT,before_FTE REAL);CREATE TABLE after_wave(source_row_id INTEGER PRIMARY KEY,store_code TEXT,after_FTE REAL);\")\nfor table,file in [(\"gdp\",\"actual720-GDP-table-with-composite-keys.csv\"),(\"life\",\"actual720-life-table-with-composite-keys.csv\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?,?)\",[(r[\"country_ISO\"],r[\"year\"],number(r[\"value_source_decimal\"])) for r in load(file)])\ndb.executemany(\"INSERT INTO people VALUES(?,?)\",[(int(r[\"source_row_id\"]),r[\"school_group\"]) for r in load(\"actual3613-person-demographics-keyed.csv\")])\nfor table,file in [(\"outcome_full\",\"actual3613-outcome-keys-including603-NULL-values.csv\"),(\"outcome_available\",\"actual3010-available-only-outcome-keys.csv\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?)\",[(int(r[\"source_row_id\"]),number(r[\"log_wage_source_decimal\"])) for r in load(file)])\nfor table,file,value in [(\"before_wave\",\"actual410-before-wave-keyed-source-records.csv\",\"before_FTE_source_decimal\"),(\"after_wave\",\"actual410-after-wave-keyed-source-records.csv\",\"after_FTE_source_decimal\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?,?)\",[(int(r[\"source_row_id\"]),r[\"original_store_code\"],number(r[value])) for r in load(file)])\ncursor=db.execute('SELECT COUNT(*) AS joined_rows,COUNT(a.after_FTE-b.before_FTE) AS complete_values,AVG(a.after_FTE-b.before_FTE) AS mean_difference FROM before_wave b JOIN after_wave a ON b.source_row_id=a.source_row_id;')\ncolumns=[r[0] for r in cursor.description]\nrows=[list(r) for r in cursor.fetchall()]\nprint(json.dumps(dict(columns=columns,rows=rows,nativeSQLiteVersion=sqlite3.sqlite_version,meanStorage=\"SQLite REAL / binary64 approximation\",originalSourceModified=False)))\ndb.close()\n",
      "codeFile": "data06-snippets/python/query-company_correct.py",
      "codeSha256": "1cbea372affe6f8ab973e90d76a98ba671c11757baefc73a9a69755b0c5fe096",
      "inputDirectory": "data06-sources",
      "inputFiles": [
        {
          "file": "data06-sources/actual720-GDP-table-with-composite-keys.csv",
          "sha256": "76d79622279e4246f73cd0ef60fd8741db145e23ab2955ec5d096a84c707f0c0"
        },
        {
          "file": "data06-sources/actual720-life-table-with-composite-keys.csv",
          "sha256": "21589e57f3ddedb38738d5ef7e8a85f27ecaad89d4566da331e2531d12c7e474"
        },
        {
          "file": "data06-sources/actual3613-person-demographics-keyed.csv",
          "sha256": "625d07555c5a5ddf5ef7133b3653123ad8d566ce04c8e4b95f76bded85a0740f"
        },
        {
          "file": "data06-sources/actual3613-outcome-keys-including603-NULL-values.csv",
          "sha256": "cf3aefbce9a41cd04aecedaea4e9277818a826f036b48f5e0d608d6dfd5a75f1"
        },
        {
          "file": "data06-sources/actual3010-available-only-outcome-keys.csv",
          "sha256": "f085f3ecabb304e8fa299d85049037463e335b095229f4beeeb3ff91895ca186"
        },
        {
          "file": "data06-sources/actual410-before-wave-keyed-source-records.csv",
          "sha256": "9434152adc2a12552244320a9baad4dd9a499788a35cadd87fdec1e877e2db43"
        },
        {
          "file": "data06-sources/actual410-after-wave-keyed-source-records.csv",
          "sha256": "9f268919007818f53dcccf808e9e39c809c421b2f252baa3b6a4bc77493c5e9b"
        }
      ],
      "sql": "SELECT COUNT(*) AS joined_rows,COUNT(a.after_FTE-b.before_FTE) AS complete_values,AVG(a.after_FTE-b.before_FTE) AS mean_difference FROM before_wave b JOIN after_wave a ON b.source_row_id=a.source_row_id;",
      "sqlFile": "data06-snippets/sql/query-company_correct.sql",
      "recordedActualProcess": true,
      "browserExecutesLanguage": false,
      "originalSourceModified": false,
      "executesNativeSQLite": true,
      "baseRCounterpart": false,
      "name": "company_correct",
      "summary": {
        "columns": [
          "joined_rows",
          "complete_values",
          "mean_difference"
        ],
        "rows": [
          [
            410,
            384,
            -0.07044270833333334
          ]
        ],
        "nativeSQLiteVersion": "3.53.1",
        "meanStorage": "SQLite REAL / binary64 approximation",
        "originalSourceModified": false
      },
      "matchesFrozenCaseQueryOutput": true
    },
    "company_wrong": {
      "returnCode": 0,
      "stdout": "{\"columns\": [\"invalid_code_combinations\", \"complete_combinations\", \"invalid_mean\"], \"rows\": [[412, 386, -0.06360103626943005]], \"nativeSQLiteVersion\": \"3.53.1\", \"meanStorage\": \"SQLite REAL / binary64 approximation\", \"originalSourceModified\": false}\n",
      "stderr": "",
      "language": "python",
      "id": "company_wrong",
      "code": "import sys\nsys.stdout.reconfigure(encoding=\"utf-8\")\nsys.stderr.reconfigure(encoding=\"utf-8\")\nimport json,sqlite3\nimport csv\nfrom pathlib import Path\nfrom fractions import Fraction\nfolder=Path(sys.argv[1])\ndef load(file):\n    with open(folder/file,encoding=\"utf-8-sig\",newline=\"\") as handle:return list(csv.DictReader(handle))\ndef number(text):return float(Fraction(text)) if text!=\"\" else None\ndb=sqlite3.connect(\":memory:\")\ndb.executescript(\"CREATE TABLE gdp(iso TEXT NOT NULL,year TEXT NOT NULL,gdp REAL,PRIMARY KEY(iso,year));CREATE TABLE life(iso TEXT NOT NULL,year TEXT NOT NULL,life REAL,PRIMARY KEY(iso,year));CREATE TABLE people(source_row_id INTEGER PRIMARY KEY,school_group TEXT);CREATE TABLE outcome_full(source_row_id INTEGER PRIMARY KEY,log_wage REAL);CREATE TABLE outcome_available(source_row_id INTEGER PRIMARY KEY,log_wage REAL);CREATE TABLE before_wave(source_row_id INTEGER PRIMARY KEY,store_code TEXT,before_FTE REAL);CREATE TABLE after_wave(source_row_id INTEGER PRIMARY KEY,store_code TEXT,after_FTE REAL);\")\nfor table,file in [(\"gdp\",\"actual720-GDP-table-with-composite-keys.csv\"),(\"life\",\"actual720-life-table-with-composite-keys.csv\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?,?)\",[(r[\"country_ISO\"],r[\"year\"],number(r[\"value_source_decimal\"])) for r in load(file)])\ndb.executemany(\"INSERT INTO people VALUES(?,?)\",[(int(r[\"source_row_id\"]),r[\"school_group\"]) for r in load(\"actual3613-person-demographics-keyed.csv\")])\nfor table,file in [(\"outcome_full\",\"actual3613-outcome-keys-including603-NULL-values.csv\"),(\"outcome_available\",\"actual3010-available-only-outcome-keys.csv\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?)\",[(int(r[\"source_row_id\"]),number(r[\"log_wage_source_decimal\"])) for r in load(file)])\nfor table,file,value in [(\"before_wave\",\"actual410-before-wave-keyed-source-records.csv\",\"before_FTE_source_decimal\"),(\"after_wave\",\"actual410-after-wave-keyed-source-records.csv\",\"after_FTE_source_decimal\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?,?)\",[(int(r[\"source_row_id\"]),r[\"original_store_code\"],number(r[value])) for r in load(file)])\ncursor=db.execute('SELECT COUNT(*) AS invalid_code_combinations,COUNT(a.after_FTE-b.before_FTE) AS complete_combinations,AVG(a.after_FTE-b.before_FTE) AS invalid_mean FROM before_wave b JOIN after_wave a ON b.store_code=a.store_code;')\ncolumns=[r[0] for r in cursor.description]\nrows=[list(r) for r in cursor.fetchall()]\nprint(json.dumps(dict(columns=columns,rows=rows,nativeSQLiteVersion=sqlite3.sqlite_version,meanStorage=\"SQLite REAL / binary64 approximation\",originalSourceModified=False)))\ndb.close()\n",
      "codeFile": "data06-snippets/python/query-company_wrong.py",
      "codeSha256": "bb1985fa361bc4de311d8d6511ac370901bdae944ee5714ee67c9c085be69128",
      "inputDirectory": "data06-sources",
      "inputFiles": [
        {
          "file": "data06-sources/actual720-GDP-table-with-composite-keys.csv",
          "sha256": "76d79622279e4246f73cd0ef60fd8741db145e23ab2955ec5d096a84c707f0c0"
        },
        {
          "file": "data06-sources/actual720-life-table-with-composite-keys.csv",
          "sha256": "21589e57f3ddedb38738d5ef7e8a85f27ecaad89d4566da331e2531d12c7e474"
        },
        {
          "file": "data06-sources/actual3613-person-demographics-keyed.csv",
          "sha256": "625d07555c5a5ddf5ef7133b3653123ad8d566ce04c8e4b95f76bded85a0740f"
        },
        {
          "file": "data06-sources/actual3613-outcome-keys-including603-NULL-values.csv",
          "sha256": "cf3aefbce9a41cd04aecedaea4e9277818a826f036b48f5e0d608d6dfd5a75f1"
        },
        {
          "file": "data06-sources/actual3010-available-only-outcome-keys.csv",
          "sha256": "f085f3ecabb304e8fa299d85049037463e335b095229f4beeeb3ff91895ca186"
        },
        {
          "file": "data06-sources/actual410-before-wave-keyed-source-records.csv",
          "sha256": "9434152adc2a12552244320a9baad4dd9a499788a35cadd87fdec1e877e2db43"
        },
        {
          "file": "data06-sources/actual410-after-wave-keyed-source-records.csv",
          "sha256": "9f268919007818f53dcccf808e9e39c809c421b2f252baa3b6a4bc77493c5e9b"
        }
      ],
      "sql": "SELECT COUNT(*) AS invalid_code_combinations,COUNT(a.after_FTE-b.before_FTE) AS complete_combinations,AVG(a.after_FTE-b.before_FTE) AS invalid_mean FROM before_wave b JOIN after_wave a ON b.store_code=a.store_code;",
      "sqlFile": "data06-snippets/sql/query-company_wrong.sql",
      "recordedActualProcess": true,
      "browserExecutesLanguage": false,
      "originalSourceModified": false,
      "executesNativeSQLite": true,
      "baseRCounterpart": false,
      "name": "company_wrong",
      "summary": {
        "columns": [
          "invalid_code_combinations",
          "complete_combinations",
          "invalid_mean"
        ],
        "rows": [
          [
            412,
            386,
            -0.06360103626943005
          ]
        ],
        "nativeSQLiteVersion": "3.53.1",
        "meanStorage": "SQLite REAL / binary64 approximation",
        "originalSourceModified": false
      },
      "matchesFrozenCaseQueryOutput": true
    },
    "company407_wrong_pairs": {
      "returnCode": 0,
      "stdout": "{\"columns\": [\"before_row\", \"after_row\", \"difference\"], \"rows\": [[42, 42, 0.0], [42, 168, 3.5], [168, 42, -1.0], [168, 168, 2.5]], \"nativeSQLiteVersion\": \"3.53.1\", \"meanStorage\": \"SQLite REAL / binary64 approximation\", \"originalSourceModified\": false}\n",
      "stderr": "",
      "language": "python",
      "id": "company407_wrong_pairs",
      "code": "import sys\nsys.stdout.reconfigure(encoding=\"utf-8\")\nsys.stderr.reconfigure(encoding=\"utf-8\")\nimport json,sqlite3\nimport csv\nfrom pathlib import Path\nfrom fractions import Fraction\nfolder=Path(sys.argv[1])\ndef load(file):\n    with open(folder/file,encoding=\"utf-8-sig\",newline=\"\") as handle:return list(csv.DictReader(handle))\ndef number(text):return float(Fraction(text)) if text!=\"\" else None\ndb=sqlite3.connect(\":memory:\")\ndb.executescript(\"CREATE TABLE gdp(iso TEXT NOT NULL,year TEXT NOT NULL,gdp REAL,PRIMARY KEY(iso,year));CREATE TABLE life(iso TEXT NOT NULL,year TEXT NOT NULL,life REAL,PRIMARY KEY(iso,year));CREATE TABLE people(source_row_id INTEGER PRIMARY KEY,school_group TEXT);CREATE TABLE outcome_full(source_row_id INTEGER PRIMARY KEY,log_wage REAL);CREATE TABLE outcome_available(source_row_id INTEGER PRIMARY KEY,log_wage REAL);CREATE TABLE before_wave(source_row_id INTEGER PRIMARY KEY,store_code TEXT,before_FTE REAL);CREATE TABLE after_wave(source_row_id INTEGER PRIMARY KEY,store_code TEXT,after_FTE REAL);\")\nfor table,file in [(\"gdp\",\"actual720-GDP-table-with-composite-keys.csv\"),(\"life\",\"actual720-life-table-with-composite-keys.csv\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?,?)\",[(r[\"country_ISO\"],r[\"year\"],number(r[\"value_source_decimal\"])) for r in load(file)])\ndb.executemany(\"INSERT INTO people VALUES(?,?)\",[(int(r[\"source_row_id\"]),r[\"school_group\"]) for r in load(\"actual3613-person-demographics-keyed.csv\")])\nfor table,file in [(\"outcome_full\",\"actual3613-outcome-keys-including603-NULL-values.csv\"),(\"outcome_available\",\"actual3010-available-only-outcome-keys.csv\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?)\",[(int(r[\"source_row_id\"]),number(r[\"log_wage_source_decimal\"])) for r in load(file)])\nfor table,file,value in [(\"before_wave\",\"actual410-before-wave-keyed-source-records.csv\",\"before_FTE_source_decimal\"),(\"after_wave\",\"actual410-after-wave-keyed-source-records.csv\",\"after_FTE_source_decimal\")]:\n    db.executemany(\"INSERT INTO \"+table+\" VALUES(?,?,?)\",[(int(r[\"source_row_id\"]),r[\"original_store_code\"],number(r[value])) for r in load(file)])\ncursor=db.execute(\"SELECT b.source_row_id AS before_row,a.source_row_id AS after_row,a.after_FTE-b.before_FTE AS difference FROM before_wave b JOIN after_wave a ON b.store_code=a.store_code WHERE b.store_code='407' ORDER BY b.source_row_id,a.source_row_id;\")\ncolumns=[r[0] for r in cursor.description]\nrows=[list(r) for r in cursor.fetchall()]\nprint(json.dumps(dict(columns=columns,rows=rows,nativeSQLiteVersion=sqlite3.sqlite_version,meanStorage=\"SQLite REAL / binary64 approximation\",originalSourceModified=False)))\ndb.close()\n",
      "codeFile": "data06-snippets/python/query-company407_wrong_pairs.py",
      "codeSha256": "31943451474fe92300b53860877eb861c061fabeda2fb19f5c3ee8458aea7c2d",
      "inputDirectory": "data06-sources",
      "inputFiles": [
        {
          "file": "data06-sources/actual720-GDP-table-with-composite-keys.csv",
          "sha256": "76d79622279e4246f73cd0ef60fd8741db145e23ab2955ec5d096a84c707f0c0"
        },
        {
          "file": "data06-sources/actual720-life-table-with-composite-keys.csv",
          "sha256": "21589e57f3ddedb38738d5ef7e8a85f27ecaad89d4566da331e2531d12c7e474"
        },
        {
          "file": "data06-sources/actual3613-person-demographics-keyed.csv",
          "sha256": "625d07555c5a5ddf5ef7133b3653123ad8d566ce04c8e4b95f76bded85a0740f"
        },
        {
          "file": "data06-sources/actual3613-outcome-keys-including603-NULL-values.csv",
          "sha256": "cf3aefbce9a41cd04aecedaea4e9277818a826f036b48f5e0d608d6dfd5a75f1"
        },
        {
          "file": "data06-sources/actual3010-available-only-outcome-keys.csv",
          "sha256": "f085f3ecabb304e8fa299d85049037463e335b095229f4beeeb3ff91895ca186"
        },
        {
          "file": "data06-sources/actual410-before-wave-keyed-source-records.csv",
          "sha256": "9434152adc2a12552244320a9baad4dd9a499788a35cadd87fdec1e877e2db43"
        },
        {
          "file": "data06-sources/actual410-after-wave-keyed-source-records.csv",
          "sha256": "9f268919007818f53dcccf808e9e39c809c421b2f252baa3b6a4bc77493c5e9b"
        }
      ],
      "sql": "SELECT b.source_row_id AS before_row,a.source_row_id AS after_row,a.after_FTE-b.before_FTE AS difference FROM before_wave b JOIN after_wave a ON b.store_code=a.store_code WHERE b.store_code='407' ORDER BY b.source_row_id,a.source_row_id;",
      "sqlFile": "data06-snippets/sql/query-company407_wrong_pairs.sql",
      "recordedActualProcess": true,
      "browserExecutesLanguage": false,
      "originalSourceModified": false,
      "executesNativeSQLite": true,
      "baseRCounterpart": false,
      "name": "company407_wrong_pairs",
      "summary": {
        "columns": [
          "before_row",
          "after_row",
          "difference"
        ],
        "rows": [
          [
            42,
            42,
            0.0
          ],
          [
            42,
            168,
            3.5
          ],
          [
            168,
            42,
            -1.0
          ],
          [
            168,
            168,
            2.5
          ]
        ],
        "nativeSQLiteVersion": "3.53.1",
        "meanStorage": "SQLite REAL / binary64 approximation",
        "originalSourceModified": false
      },
      "matchesFrozenCaseQueryOutput": true
    }
  },
  "actualTeachingProcessCounts": {
    "keys": 8,
    "join": 12,
    "nulls": 8,
    "aggregation": 6,
    "query": 10,
    "total": 44
  },
  "artifactManifest": [
    {
      "file": "data06-snippets/python/aggregation-available.py",
      "sha256": "cbe0c9278e819f2e686458e2ee0f2954f24885a2f854c0744b41c217bfbf0bfa",
      "bytes": 669
    },
    {
      "file": "data06-snippets/python/aggregation-having.py",
      "sha256": "db592f8ad931dbfb07d77f0b42f4b1ead5ae72b48e9856dfc4b2d0918bbd02f7",
      "bytes": 688
    },
    {
      "file": "data06-snippets/python/aggregation-zero-comparison.py",
      "sha256": "4b1f9fa47ee6c364afae100fd549a4763ddceffc50e1a735dc1d612dff2c5719",
      "bytes": 680
    },
    {
      "file": "data06-snippets/python/join-many-to-many-inner.py",
      "sha256": "0a52b137e15c3b5dcf509ad0498b326d575b40682604cecba3d8776020f5d35d",
      "bytes": 857
    },
    {
      "file": "data06-snippets/python/join-many-to-many-left.py",
      "sha256": "63f91b32daa16b05e3bf6b68c7489ee49cbfea453346c4daaeecf7d5db61931b",
      "bytes": 856
    },
    {
      "file": "data06-snippets/python/join-one-to-many-inner.py",
      "sha256": "8bdbd6b008fd17bea96e7650b7bc25ab56ddb2609fb209ba024479d2fb209950",
      "bytes": 847
    },
    {
      "file": "data06-snippets/python/join-one-to-many-left.py",
      "sha256": "2a614cce77e089d13f86d782dbcf7bba8a59025661aeb94c1d248aeb544913b1",
      "bytes": 846
    },
    {
      "file": "data06-snippets/python/join-one-to-one-inner.py",
      "sha256": "b53935bf771f0d04451c7ea867ef17883fbee16eba8ac980ff70e6062e0c2060",
      "bytes": 833
    },
    {
      "file": "data06-snippets/python/join-one-to-one-left.py",
      "sha256": "e78972a1e9a3c44d196f6bf8eb2dfdcac37536c068209f0d0e2fc02f04d6e5c5",
      "bytes": 832
    },
    {
      "file": "data06-snippets/python/keys-composite.py",
      "sha256": "2f7d3f37dffa8163f5e35a682809cc32572a8470bbce258d7c43db9036d75d94",
      "bytes": 460
    },
    {
      "file": "data06-snippets/python/keys-duplicate.py",
      "sha256": "e9eff3519e0dec115dc221d79e6c678c2f9d0facf1b2d8f2b19e0c7a741abe17",
      "bytes": 442
    },
    {
      "file": "data06-snippets/python/keys-null.py",
      "sha256": "003dd709c48c6eba31aa3b057954f93c4c847fd37998a3cc7c66c834146b71a4",
      "bytes": 443
    },
    {
      "file": "data06-snippets/python/keys-valid.py",
      "sha256": "0ab0399329fbc36ab09487a9cf7187be1b75838188a2d750a70958bf2237ff6b",
      "bytes": 442
    },
    {
      "file": "data06-snippets/python/nulls-equal-null.py",
      "sha256": "e1659d04fddf86c80871958c43a6389ebf38a58ecc8361911569e10fe8637bc5",
      "bytes": 951
    },
    {
      "file": "data06-snippets/python/nulls-is-null.py",
      "sha256": "87c38c9b8edc479a466e090aca60a1894531b3631e9965647c9e8f607d841ecf",
      "bytes": 954
    },
    {
      "file": "data06-snippets/python/nulls-on.py",
      "sha256": "204846e6e205ba5e030f5ec212bc0528c7dbf550fee9860182cdfecb856f1227",
      "bytes": 947
    },
    {
      "file": "data06-snippets/python/nulls-where.py",
      "sha256": "72553bc859e11e46f440a474dfa81135f8be3549652ada1325afaaf8fcc4b528",
      "bytes": 949
    },
    {
      "file": "data06-snippets/python/query-company407_wrong_pairs.py",
      "sha256": "31943451474fe92300b53860877eb861c061fabeda2fb19f5c3ee8458aea7c2d",
      "bytes": 2645
    },
    {
      "file": "data06-snippets/python/query-company_correct.py",
      "sha256": "1cbea372affe6f8ab973e90d76a98ba671c11757baefc73a9a69755b0c5fe096",
      "bytes": 2611
    },
    {
      "file": "data06-snippets/python/query-company_wrong.py",
      "sha256": "bb1985fa361bc4de311d8d6511ac370901bdae944ee5714ee67c9c085be69128",
      "bytes": 2622
    },
    {
      "file": "data06-snippets/python/query-country_correct.py",
      "sha256": "fada039061a43735cdd1b6b557b2c93f76e273171639c108c3a7606b5dc32730",
      "bytes": 2495
    },
    {
      "file": "data06-snippets/python/query-country_wrong.py",
      "sha256": "8fcbecce12c8ee15282f66d7a0e375812bcb979fc66b63216b71db21c12f9639",
      "bytes": 2496
    },
    {
      "file": "data06-snippets/python/query-person_available_inner.py",
      "sha256": "cabd5c85bfca5d8d4dac4abefc8709bf2c31bcdb9166ed27a2364aa0e9e47fd7",
      "bytes": 2555
    },
    {
      "file": "data06-snippets/python/query-person_available_left.py",
      "sha256": "4ca10615319020262eccc8b1babb8bcea79c2713f388a0a95ac331e570385452",
      "bytes": 2554
    },
    {
      "file": "data06-snippets/python/query-person_full_inner.py",
      "sha256": "d5ef05ba3df1003f95858d4af007733895322354f9fbc80c50d0022174795f16",
      "bytes": 2550
    },
    {
      "file": "data06-snippets/python/query-person_groups.py",
      "sha256": "71320d4a53252075088e449a6dfc4dd1e11e9337c42344f7579f5fc9749745e4",
      "bytes": 2692
    },
    {
      "file": "data06-snippets/python/query-person_left_then_where.py",
      "sha256": "1f1c1218ea987b4f64df3a6ea021d82ce77d271451195f4f3b740eedb9ed0615",
      "bytes": 2583
    },
    {
      "file": "data06-snippets/r/aggregation-available.R",
      "sha256": "33565789b25f8c65b6949b294336e4c0c9d6f3ea5762d1a2ac3cf55ab0ab298f",
      "bytes": 1345
    },
    {
      "file": "data06-snippets/r/aggregation-having.R",
      "sha256": "0b96bcf9c748ead73d40921efe974b6668a9ccf538d5c90d705f9175d581fd69",
      "bytes": 1386
    },
    {
      "file": "data06-snippets/r/aggregation-zero-comparison.R",
      "sha256": "ddf96108e3076caac6e09da6682c5f7cc52c091f56fa518ec81505283734b716",
      "bytes": 1340
    },
    {
      "file": "data06-snippets/r/join-many-to-many-inner.R",
      "sha256": "eaa684be82aaebea30e0f9bf76ada84c72c941cef294ae9721200f481fe5d151",
      "bytes": 1381
    },
    {
      "file": "data06-snippets/r/join-many-to-many-left.R",
      "sha256": "1c5f2b71f597d018dccccde65a6fe891d70ef3519b4eba7eddf188e6f528f7e6",
      "bytes": 1380
    },
    {
      "file": "data06-snippets/r/join-one-to-many-inner.R",
      "sha256": "0fd09a67b2dcf9afcf138a2ec575066d1997b0e3cbd73d9b3a1705afa91ee2df",
      "bytes": 1377
    },
    {
      "file": "data06-snippets/r/join-one-to-many-left.R",
      "sha256": "77130496ad1589dc3429121bd732ee5ed98baf1bc088563cfb838f9dd672c120",
      "bytes": 1376
    },
    {
      "file": "data06-snippets/r/join-one-to-one-inner.R",
      "sha256": "abdd42264d49113c683dde6423cb81ec217196200e26711c856c9af99d30a740",
      "bytes": 1370
    },
    {
      "file": "data06-snippets/r/join-one-to-one-left.R",
      "sha256": "130e5bf87b8c3a57672de44d53b71c105b21e2224fac0be1c5c89c4605aa81cd",
      "bytes": 1369
    },
    {
      "file": "data06-snippets/r/keys-composite.R",
      "sha256": "b1f8cd9a434cdd33b8ed24cf9afb7576213fece26573c47883129e13ac737cde",
      "bytes": 1273
    },
    {
      "file": "data06-snippets/r/keys-duplicate.R",
      "sha256": "dd7f98e75641ffd482f6b39edb5c3563717197bf61accadd4cfc6755692b042e",
      "bytes": 1263
    },
    {
      "file": "data06-snippets/r/keys-null.R",
      "sha256": "409123ff851b92dcdc7b39c35908aabde5ec3db01d303296d3e27254f59d0e30",
      "bytes": 1273
    },
    {
      "file": "data06-snippets/r/keys-valid.R",
      "sha256": "c18ffb8e8360b83af330eea29793c4bd8deb6e81d239ae0593af7177d0e1ae0c",
      "bytes": 1263
    },
    {
      "file": "data06-snippets/r/nulls-equal-null.R",
      "sha256": "7f33d767daee2fb30501faf0a332e06132eb824a051e66ed70217e8d62d8815c",
      "bytes": 1616
    },
    {
      "file": "data06-snippets/r/nulls-is-null.R",
      "sha256": "005c4547de43544c797a2ea1bf9a1272ad5ced248da7d65cc56f910db7cab81e",
      "bytes": 1581
    },
    {
      "file": "data06-snippets/r/nulls-on.R",
      "sha256": "d61dc902ba555b41916e235e4361275ebd747998e40fae2344e5260d981c6fb2",
      "bytes": 1605
    },
    {
      "file": "data06-snippets/r/nulls-where.R",
      "sha256": "f3cc74900130d0f16554604a0ed2778bfcad5398a72f7e83fea4246d24fda0d4",
      "bytes": 1597
    },
    {
      "file": "data06-snippets/sql/aggregation-available.sql",
      "sha256": "e22135c0d849c5835fe9e61b2b3f7c4b46af1ad5108588e74c58406b41777493",
      "bytes": 141
    },
    {
      "file": "data06-snippets/sql/aggregation-having.sql",
      "sha256": "e3cf4979bf17c73cd3a0576efa42a83ceacb668048c4ce464ea8282b7bee898f",
      "bytes": 160
    },
    {
      "file": "data06-snippets/sql/aggregation-zero-comparison.sql",
      "sha256": "1adeecd376aabc59d9a89bc696426f64b1c2a1b0d0987af2e0b51e1e67020fa1",
      "bytes": 153
    },
    {
      "file": "data06-snippets/sql/join-many-to-many-inner.sql",
      "sha256": "a74262308e630b90dd51caacf3c33efa5f1ae2b053d67548c84753007bbd6c77",
      "bytes": 115
    },
    {
      "file": "data06-snippets/sql/join-many-to-many-left.sql",
      "sha256": "9c7743ca23b8e74d1596d6675a0f163bc4da79b0abf2062aca2d34c7b41a1108",
      "bytes": 114
    },
    {
      "file": "data06-snippets/sql/join-one-to-many-inner.sql",
      "sha256": "a74262308e630b90dd51caacf3c33efa5f1ae2b053d67548c84753007bbd6c77",
      "bytes": 115
    },
    {
      "file": "data06-snippets/sql/join-one-to-many-left.sql",
      "sha256": "9c7743ca23b8e74d1596d6675a0f163bc4da79b0abf2062aca2d34c7b41a1108",
      "bytes": 114
    },
    {
      "file": "data06-snippets/sql/join-one-to-one-inner.sql",
      "sha256": "a74262308e630b90dd51caacf3c33efa5f1ae2b053d67548c84753007bbd6c77",
      "bytes": 115
    },
    {
      "file": "data06-snippets/sql/join-one-to-one-left.sql",
      "sha256": "9c7743ca23b8e74d1596d6675a0f163bc4da79b0abf2062aca2d34c7b41a1108",
      "bytes": 114
    },
    {
      "file": "data06-snippets/sql/keys-composite.sql",
      "sha256": "fc76bdea460d97bd0c6bcb0e5b03f424a44078b55803b90400adc155e39492db",
      "bytes": 85
    },
    {
      "file": "data06-snippets/sql/keys-duplicate.sql",
      "sha256": "a07007de5923150de6d63534fb4e92b08f504b1b77aa166242fb28b002fee254",
      "bytes": 75
    },
    {
      "file": "data06-snippets/sql/keys-null.sql",
      "sha256": "a07007de5923150de6d63534fb4e92b08f504b1b77aa166242fb28b002fee254",
      "bytes": 75
    },
    {
      "file": "data06-snippets/sql/keys-valid.sql",
      "sha256": "a07007de5923150de6d63534fb4e92b08f504b1b77aa166242fb28b002fee254",
      "bytes": 75
    },
    {
      "file": "data06-snippets/sql/nulls-equal-null.sql",
      "sha256": "a73ebcad7b9ef2d1f5eab0c34a0d18034aeda9640fbb7a81af3ba7d1ab7d4f46",
      "bytes": 129
    },
    {
      "file": "data06-snippets/sql/nulls-is-null.sql",
      "sha256": "2f8aed8433dc7f173916a168a4e8e09a865352f90ecbdb7e15dd465c845def98",
      "bytes": 132
    },
    {
      "file": "data06-snippets/sql/nulls-on.sql",
      "sha256": "6fd9cf4953db3feb3bbdd0c8dfa79f23e23a1e2d58647334de9741178fc7f725",
      "bytes": 125
    },
    {
      "file": "data06-snippets/sql/nulls-where.sql",
      "sha256": "b139b0da1a2711418495aa2dc0e503143a65c7e67270ac1c2c4123f5c32b06b2",
      "bytes": 127
    },
    {
      "file": "data06-snippets/sql/query-company407_wrong_pairs.sql",
      "sha256": "8b6d280f229f3d8d4a0a2beed3eb575a8bcc45689fd84afe3c9144d4fc0c3173",
      "bytes": 238
    },
    {
      "file": "data06-snippets/sql/query-company_correct.sql",
      "sha256": "cf8b52ca77b6e70780deb0fe3d4b3f7cfcf6b4009230b24c91c61c576d4f8127",
      "bytes": 204
    },
    {
      "file": "data06-snippets/sql/query-company_wrong.sql",
      "sha256": "c02997a21f88e41b7c695291e4dcbc083a6b8a119919ca2ab2ff7e0c744b6474",
      "bytes": 215
    },
    {
      "file": "data06-snippets/sql/query-country_correct.sql",
      "sha256": "09423f5bac18c7ab931386a160bdb8ef575eccfbe6c53fcf740ad91e29a36cc7",
      "bytes": 88
    },
    {
      "file": "data06-snippets/sql/query-country_wrong.sql",
      "sha256": "0246e6999e8f75bbb01f4913e2e3d9cdbff2a1115e0a392fbb16ed868646fe96",
      "bytes": 89
    },
    {
      "file": "data06-snippets/sql/query-person_available_inner.sql",
      "sha256": "d86c11ad753470c5c327db5ffd98d99fda2629ceae7f521760963cddf8182f4c",
      "bytes": 148
    },
    {
      "file": "data06-snippets/sql/query-person_available_left.sql",
      "sha256": "96daebe27a4c9e6ff9b1eb8fa3f737bb01127ea6582cc93474ee02f05a56113c",
      "bytes": 147
    },
    {
      "file": "data06-snippets/sql/query-person_full_inner.sql",
      "sha256": "6264f878ffcc9869699e70cbce9ba04082a6cf2e61bef29522fdf038f0ab3e63",
      "bytes": 143
    },
    {
      "file": "data06-snippets/sql/query-person_groups.sql",
      "sha256": "a74b60cb75949c534f5e32dee8e19a25d9093870be7d2fb8cec6c7dc374b4497",
      "bytes": 285
    },
    {
      "file": "data06-snippets/sql/query-person_left_then_where.sql",
      "sha256": "193011092f363b95ca0736d2994cf717fe34de071d1559f87b6c498314a6c68b",
      "bytes": 176
    }
  ]
,
"publicationProjection":{"kind": "recorded-source-and-execution-path-omission", "originalFileSHA256": "9674e5823afb74c75f29cd838662d880775a9f7cde5fcdec0a764b32d5fe15c2", "changedStringFields": 2, "note": {"ko": "원자료·실행 기록의 시스템별 경로를 생략했습니다. 보관 원본·코드·자료·종료 상태·수치는 유지합니다. 이 경로 표시는 새로 실행한 명령을 뜻하지 않습니다.", "en": "System-specific paths in source and execution metadata are omitted. Archived originals, code, data, return status and numerical values are preserved. These path labels do not claim a new or differently executed command."}}}