You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@kylin.apache.org by "Lu, Kang-Sen" <kl...@rbbn.com> on 2019/06/28 12:16:05 UTC

question about query/src/main/java/org/apache/kylin/query/enumerator/LookupTableEnumerator.java

I am running kylin 2.6.2. Iissued "git diff e3896af234^ e3896af234" cpmmand to study a code change in LookupTableEnumerator.java.

The code piece that puzzled me is the following:

public class LookupTableEnumerator implements Enumerator<Object[]> {
    private final static Logger logger = LoggerFactory.getLogger(LookupTableEnumerator.class);

    private final ILookupTable lookupTable;
    private final List<ColumnDesc> colDescs;
    private final Object[] current;
    private Iterator<String[]> iterator;

    public LookupTableEnumerator(OLAPContext olapContext) {

        //TODO: assuming LookupTableEnumerator is handled by a cube
        CubeInstance cube = null;

        if (olapContext.realization instanceof CubeInstance) {
            cube = (CubeInstance) olapContext.realization;                                                            <== here we got cube value
            ProjectInstance project = cube.getProjectInstance();
            List<RealizationEntry> realizationEntries = project.getRealizationEntries();
            String lookupTableName = olapContext.firstTableScan.getTableName();
            CubeManager cubeMgr = CubeManager.getInstance(cube.getConfig());
            cube = cubeMgr.findLatestSnapshot(realizationEntries, lookupTableName);         <== why do we reset cube to other value??????
            olapContext.realization = cube;
        } else if (olapContext.realization instanceof HybridInstance) {
            final HybridInstance hybridInstance = (HybridInstance) olapContext.realization;
            final IRealization latestRealization = hybridInstance.getLatestRealization();
            if (latestRealization instanceof CubeInstance) {
                cube = (CubeInstance) latestRealization;
            } else {
                throw new IllegalStateException();
            }
        }

Is a bug introduced by that bug fix?

Thanks.

Kang-sen


-----------------------------------------------------------------------------------------------------------------------
Notice: This e-mail together with any attachments may contain information of Ribbon Communications Inc. that
is confidential and/or proprietary for the sole use of the intended recipient.  Any review, disclosure, reliance or
distribution by others or forwarding without express permission is strictly prohibited.  If you are not the intended
recipient, please notify the sender immediately and then delete all copies, including any attachments.
-----------------------------------------------------------------------------------------------------------------------

Re:question about query/src/main/java/org/apache/kylin/query/enumerator/LookupTableEnumerator.java

Posted by Xiaoxiang Yu <hi...@126.com>.
Hi Kang-Sen,
   Thank you for suggestion, this code change is introduced in KYLIN-3628. 
   I find another comment under https://issues.apache.org/jira/browse/KYLIN-3628 which indicated this commit has harmful impact,  we will check it carefully . 
If it is really a bug, we will fix it.




-----------------
-----------------
Best wishes to you ! 
From :Xiaoxiang Yu

At 2019-06-28 20:16:05, "Lu, Kang-Sen" <kl...@rbbn.com> wrote:


I am running kylin 2.6.2. Iissued “git diff e3896af234^ e3896af234” cpmmand to study a code change in LookupTableEnumerator.java.

 

The code piece that puzzled me is the following:

 

public class LookupTableEnumerator implements Enumerator<Object[]> {

    private final static Logger logger = LoggerFactory.getLogger(LookupTableEnumerator.class);

 

    private final ILookupTable lookupTable;

    private final List<ColumnDesc> colDescs;

    private final Object[] current;

    private Iterator<String[]> iterator;

 

    public LookupTableEnumerator(OLAPContext olapContext) {

 

        //TODO: assuming LookupTableEnumerator is handled by a cube

        CubeInstance cube = null;

 

        if (olapContext.realization instanceof CubeInstance) {

            cube = (CubeInstance) olapContext.realization;                                                            ç here we got cube value

            ProjectInstance project = cube.getProjectInstance();

            List<RealizationEntry> realizationEntries = project.getRealizationEntries();

            String lookupTableName = olapContext.firstTableScan.getTableName();

            CubeManager cubeMgr = CubeManager.getInstance(cube.getConfig());

            cube = cubeMgr.findLatestSnapshot(realizationEntries, lookupTableName);         ç why do we reset cube to other value??????

            olapContext.realization = cube;

        } else if (olapContext.realization instanceof HybridInstance) {

            final HybridInstance hybridInstance = (HybridInstance) olapContext.realization;

            final IRealization latestRealization = hybridInstance.getLatestRealization();

            if (latestRealization instanceof CubeInstance) {

                cube = (CubeInstance) latestRealization;

            } else {

                throw new IllegalStateException();

            }

        }

 

Is a bug introduced by that bug fix?

 

Thanks.

 

Kang-sen




Notice: This e-mail together with any attachments may contain information of Ribbon Communications Inc. that is confidential and/or proprietary for the sole use of the intended recipient. Any review, disclosure, reliance or distribution by others or forwarding without express permission is strictly prohibited. If you are not the intended recipient, please notify the sender immediately and then delete all copies, including any attachments.