微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

非 equi selfjoin data.table 错误“vecseq(f__, len__, if (allow.cartesian || notjoin || !anyDuplicated(f__,”)

如何解决非 equi selfjoin data.table 错误“vecseq(f__, len__, if (allow.cartesian || notjoin || !anyDuplicated(f__,”)

我正在尝试对具有 2 百万行和 8 个变量的表上的 data.table 进行非等自联接。 数据如下所示:

const [theId,setTheId] = useState('');
const [authorised,setAuthorised] = useState(false);


  const checkUserAccess = async (empid) => {
    try {
      const response = await fetch("http://localhost:4200/get-valid-users");
      const allUsers = await response.json();

      const validIds = allUsers.map(({ id }) => id);
      const isAuthorised = validIds.includes(empid);

      if (isAuthorised) {
        setAuthorised(true)
      } else {
        setAuthorised(false)
      }
    } catch (err) {
      console.error(err.message);
    }
  }  
    
    const getUser = async () => {
        try {
          const response = await fetch("http://localhost:4200/get-user");
          const theId= await response.json();
          
          setTheId(theId);
          checkUserAccess(theId);
    
        } catch (err) {
          console.error(err.message);
        }
      }
    
     useEffect(() => {
        getUser();
      },[]);  

这是我使用的代码

db table :
product     position_min     position_max      count_pos
A.16        167804              167870              20
A.18        167804              167838              15
A.15        167896              167768              18
A.20        238359              238361              33
A.35        167835              167837              8

dt table:
product_t   position_min_t     position_max_t      count_pos_t
A.16        167804              167870              20
A.18        167804              167838              15
A.15        167896              167768              18
A.20        238359              238361              33
A.35        167835              167837              8

我应该得到:

db_join <- db[dt,.(product,product_t,position_min_t,position_max_t,count_pos_t),on = .(position_min <= position_min_t,position_max >=  position_max_t)]

但我不断收到此错误

A16        A18          167804              167838              15
A16        A15          167896              167768              18
A16        A35          167835              167837              8
A18        A35          167835              167837              8

我确实将 Error in vecseq(f__,len__,if (allow.cartesian || notjoin || !anyDuplicated(f__,: Join results in more than 2^31 rows (internal vecseq reached physical limit). Very likely misspecified join. Check for duplicate key values in i each of which join to the same group in x over and over again. If that's ok,try by=.EACHI to run j for each group to avoid the large allocation. Otherwise,please search for this error message in the FAQ,Wiki,Stack Overflow and data.table issue tracker for advice. 设置为 TRUE 并添加allow.cartesian,但它仍然不起作用。 我在包含 160 万行的表格子集上尝试了相同的代码,它的效果非常好。 你知道如何解决它吗? 任何帮助将不胜感激

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。