非 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 (将#修改为@)