Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lazy vector: An unloaded lazy vector cannot be wrapped by two different top level vectors in hash join #12484

Open
zml1206 opened this issue Feb 28, 2025 · 4 comments
Labels
bug Something isn't working triage Newly created issue that needs attention.

Comments

@zml1206
Copy link
Contributor

zml1206 commented Feb 28, 2025

Bug description

    withTable("t1", "t2") {
      Seq((1, "a"), (2, "b")).toDF("c1", "c2").write.saveAsTable("t1")
      Seq(1, 2, 3).toDF("c1").write.saveAsTable("t2")
      val query =
        """
          |select t3.* from
          |(select c1, c2 as a,c2 as b from t1) t3
          |join t2
          |on t3.c1 = t2.c1
          |""".stripMargin
      sql(query).show()
    }

ERROR:
An unloaded lazy vector cannot be wrapped by two different top level vectors.

The vector of c2 is rewrapped here, and there seems to be HashProbe do not load LazyVector before wrapping.

System information

Relevant logs

Reason: An unloaded lazy vector cannot be wrapped by two different top level vectors.
Retriable: False
Expression: dictionaryValues_->markAsContainingLazyAndWrapped()
Context: Operator: HashProbe[3] 2
Function: setInternalState
File: /opt/gluten/ep/build-velox/build/velox_ep/./velox/vector/DictionaryVector-inl.h
Line: 35
Stack trace:
# 0  _ZN8facebook5velox7process10StackTraceC1Ei
# 1  _ZN8facebook5velox14VeloxExceptionC1EPKcmS3_St17basic_string_viewIcSt11char_traitsIcEES7_S7_S7_bNS1_4TypeES7_
# 2  _ZN8facebook5velox6detail14veloxCheckFailINS0_17VeloxRuntimeErrorEPKcEEvRKNS1_18VeloxCheckFailArgsET0_
# 3  _ZN8facebook5velox16DictionaryVectorINS0_10StringViewEE16setInternalStateEv
# 4  _ZN8facebook5velox16DictionaryVectorINS0_10StringViewEEC1EPNS0_6memory10MemoryPoolEN5boost13intrusive_ptrINS0_6BufferEEEmSt10shared_ptrINS0_10BaseVectorEESA_RKNS0_17SimpleVectorStatsIS2_EESt8optionalIiESJ_SI_IbESJ_SJ_
# 5  _ZN8facebook5veloxL13addDictionaryILNS0_8TypeKindE7EEESt10shared_ptrINS0_10BaseVectorEEN5boost13intrusive_ptrINS0_6BufferEEES9_mS5_
# 6  _ZN8facebook5velox10BaseVector16wrapInDictionaryEN5boost13intrusive_ptrINS0_6BufferEEES5_iSt10shared_ptrIS1_Eb
# 7  _ZN8facebook5velox4exec9wrapChildEiN5boost13intrusive_ptrINS0_6BufferEEERKSt10shared_ptrINS0_10BaseVectorEES5_
# 8  _ZN8facebook5velox4exec9HashProbe10fillOutputEi
# 9  _ZN8facebook5velox4exec9HashProbe17getOutputInternalEb
# 10 _ZN8facebook5velox4exec9HashProbe9getOutputEv
# 11 _ZZN8facebook5velox4exec6Driver11runInternalERSt10shared_ptrIS2_ERS3_INS1_13BlockingStateEERS3_INS0_9RowVectorEEENKUlvE3_clEv
# 12 _ZN8facebook5velox4exec6Driver11runInternalERSt10shared_ptrIS2_ERS3_INS1_13BlockingStateEERS3_INS0_9RowVectorEE
# 13 _ZN8facebook5velox4exec6Driver4nextEPN5folly10SemiFutureINS3_4UnitEEE
# 14 _ZN8facebook5velox4exec4Task4nextEPN5folly10SemiFutureINS3_4UnitEEE
# 15 _ZN6gluten24WholeStageResultIterator4nextEv
# 16 Java_org_apache_gluten_vectorized_ColumnarBatchOutIterator_nativeHasNext
# 17 0x00007f97526413b0
@zml1206 zml1206 added bug Something isn't working triage Newly created issue that needs attention. labels Feb 28, 2025
@pedroerp
Copy link
Contributor

Cc: @xiaoxmeng @tanjialiang

@leoluan2009
Copy link
Contributor

We ran into the same issue, Any updates or progress so far? @pedroerp

@zml1206
Copy link
Contributor Author

zml1206 commented Mar 5, 2025

The SQL in the description previously added a filter by mistake, which made it impossible to reproduce. It has been modified.

@zml1206 zml1206 changed the title lazy vector: An unloaded lazy vector cannot be wrapped by two different top level vectors in left hash join lazy vector: An unloaded lazy vector cannot be wrapped by two different top level vectors in hash join Mar 5, 2025
@Yuhta
Copy link
Contributor

Yuhta commented Mar 6, 2025

This is a bug in optimizer, Velox does not allow duplicated projections in the physical plan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Newly created issue that needs attention.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants