arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2607.03889cs.SE
收藏

使用抽象解释推断R程序中数据框的形状

Inferring the Shape of Data Frames in R Programs using Abstract Interpretation

Ulm University(乌尔姆大学)

Oliver Gerstl, Florian Sihler, Matthias Tichy

AI总结:

研究利用抽象解释推断R程序中数据框形状的问题,通过跟踪列名、行列数量等,定义抽象语义和简化乘积域,评估分析正确性与准确性,为数据分析提供支持。

摘要:

数据框是许多数据分析任务中的基本数据结构,在R等语言中广泛使用。R语言对数据框缺乏静态保证,难以在程序特定点推断其形状。本文提出一种新颖的静态分析方法,使用抽象解释跟踪数据框的相关信息,定义常用操作的抽象语义,评估其正确性和准确性,并展示了该分析在大型数据集上的能力,还识别出含潜在无效数据框访问的脚本。

英文摘要:

Data frames are a fundamental data structure in many data analysis tasks and are widely used in programming languages like R. Due to their omnipresence in data analysis, there are many functions that operate on their shape and content, for example, to clean and transform study data. However, languages like R do not offer static guarantees on data frames making it difficult to reason about their shape at a specific point in the program. In this paper, we present a novel static analysis to infer the shape of data frames in R programs using abstract interpretation by tracking the ensured and potential column names, as well as the potential number of columns and rows. For this, we use a reduced product domain and define abstract semantics for the most commonly used data frame operations, such as mutating, filtering, and subsetting. We evaluate the correctness and accuracy of our analysis on a selection of 78 executable real-world R scripts achieving empirical evidence for soundness by never under-approximating the data frame shape. Additionally, we demonstrate the ability of our analysis to infer the shape of data frames on a large dataset of 33,314 real-world R scripts by inferring concrete shape constraints for 42.1 % and exact shapes for 0.9 % of the data frame operations, improving to 58.7 % and 4.2 % if all datasets read in these scripts are available to our analysis. Using the inferred data frame shapes, we identified 40 real-world R scripts containing potential invalid data frame accesses. This shows the potential of our analysis to significantly support researchers in using data frames in data analysis.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑