Qr-Hint:面向纠正错误 SQL 查询的可操作提示
Qr-Hint: Actionable Hints Towards Correcting Wrong SQL Queries
AI总结:
本文提出 Qr-Hint 系统,从用户错误 SQL 查询出发生成可证明正确、局部最优的可操作修复提示,并通过实验与用户研究验证其有效性。
摘要:
我们描述了一个名为 Qr-Hint 的系统:给定一个(正确的)目标查询 Q* 和一个(错误的)工作查询 Q,二者均用 SQL 表示,该系统会为用户提供可操作的提示,以帮助修复工作查询,使其在语义上等价于目标查询。它在教育场景中尤其有用,初学者无需大量人工辅导即可从 Qr-Hint 获得帮助。由于编写正确查询有许多不同方式,我们不希望提示完全依赖 Q* 的写法;相反,Qr-Hint 从用户自己的工作查询出发,有目的地引导用户完成一系列步骤,这些步骤可证明会得到一个正确查询,该查询等价于 Q*,但在“外观”上仍可能与其有很大差异。理想情况下,我们希望 Qr-Hint 的提示能带来对 Q 尽可能“最小”的修正。然而,由于一些基础性障碍,例如 SQL 查询等价性的不可判定性和逻辑最小化的复杂性,在这种情况下并不总能达到最优。尽管如此,通过仔细分解和形式化这些问题,并开发有原则的解决方案,我们能够通过 Qr-Hint 提供可证明正确且局部最优的提示。我们通过质量和性能实验以及教育场景中的用户研究展示了 Qr-Hint 的有效性。
英文摘要:
We describe a system called Qr-Hint that, given a (correct) target query Q* and a (wrong) working query Q, both expressed in SQL, provides actionable hints for the user to fix the working query so that it becomes semantically equivalent to the target. It is particularly useful in an educational setting, where novices can receive help from Qr-Hint without requiring extensive personal tutoring. Since there are many different ways to write a correct query, we do not want to base our hints completely on how Q* is written; instead, starting with the user's own working query, Qr-Hint purposefully guides the user through a sequence of steps that provably lead to a correct query, which will be equivalent to Q* but may still "look" quite different from it. Ideally, we would like Qr-Hint's hints to lead to the "smallest" possible corrections to Q. However, optimality is not always achievable in this case due to some foundational hurdles such as the undecidability of SQL query equivalence and the complexity of logic minimization. Nonetheless, by carefully decomposing and formulating the problems and developing principled solutions, we are able to provide provably correct and locally optimal hints through Qr-Hint. We show the effectiveness of Qr-Hint through quality and performance experiments as well as a user study in an educational setting.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。